diff options
author | Antonio Quartulli <ordex@autistici.org> | 2012-07-31 11:19:15 -0400 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-10-29 04:39:03 -0400 |
commit | d48ddb83666c32f14436106b8c9319f8ab24cf0a (patch) | |
tree | 60cf83dd2f2d17df622107c97bd605c140fd94bd /net | |
parent | a932657f51eadb8280166e82dc7034dfbff3985a (diff) |
batman-adv: use check_unicast_packet() in recv_roam_adv()
To avoid code duplication and to simplify further changes,
check_unicast_packet() is now used in recv_roam_adv() to check for not
well formed packets and so discard them.
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/batman-adv/routing.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index 376b4cc6ca82..8bdafc85ba4f 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c | |||
@@ -687,21 +687,8 @@ int batadv_recv_roam_adv(struct sk_buff *skb, struct batadv_hard_iface *recv_if) | |||
687 | struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); | 687 | struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); |
688 | struct batadv_roam_adv_packet *roam_adv_packet; | 688 | struct batadv_roam_adv_packet *roam_adv_packet; |
689 | struct batadv_orig_node *orig_node; | 689 | struct batadv_orig_node *orig_node; |
690 | struct ethhdr *ethhdr; | ||
691 | |||
692 | /* drop packet if it has not necessary minimum size */ | ||
693 | if (unlikely(!pskb_may_pull(skb, | ||
694 | sizeof(struct batadv_roam_adv_packet)))) | ||
695 | goto out; | ||
696 | |||
697 | ethhdr = (struct ethhdr *)skb_mac_header(skb); | ||
698 | 690 | ||
699 | /* packet with unicast indication but broadcast recipient */ | 691 | if (batadv_check_unicast_packet(skb, sizeof(*roam_adv_packet)) < 0) |
700 | if (is_broadcast_ether_addr(ethhdr->h_dest)) | ||
701 | goto out; | ||
702 | |||
703 | /* packet with broadcast sender address */ | ||
704 | if (is_broadcast_ether_addr(ethhdr->h_source)) | ||
705 | goto out; | 692 | goto out; |
706 | 693 | ||
707 | batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX); | 694 | batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX); |