To avoid code duplication and simplify later changes, check_unicast_packet() is
now used into recv_roam_adv() instead of letting it perform all the checks by
itself
Signed-off-by: Antonio Quartulli <redacted>
---
routing.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/routing.c b/routing.c
index 939fc01..7ebd922 100644
--- a/routing.c
+++ b/routing.c
@@ -687,21 +687,9 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct batadv_hard_iface *recv_if)
struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface);
struct batadv_roam_adv_packet *roam_adv_packet;
struct batadv_orig_node *orig_node;
- struct ethhdr *ethhdr;
-
- /* drop packet if it has not necessary minimum size */
- if (unlikely(!pskb_may_pull(skb,
- sizeof(struct batadv_roam_adv_packet))))
- goto out;
+ int hdr_size = sizeof(struct batadv_roam_adv_packet);
- ethhdr = (struct ethhdr *)skb_mac_header(skb);
-
- /* packet with unicast indication but broadcast recipient */
- if (is_broadcast_ether_addr(ethhdr->h_dest))
- goto out;
-
- /* packet with broadcast sender address */
- if (is_broadcast_ether_addr(ethhdr->h_source))
+ if (batadv_check_unicast_packet(skb, hdr_size) < 0)
goto out;
batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX);
--
1.7.9.4