summaryrefslogtreecommitdiffstats
path: root/net/batman-adv
diff options
context:
space:
mode:
authorAntonio Quartulli <ordex@autistici.org>2012-07-31 17:19:15 +0200
committerAntonio Quartulli <ordex@autistici.org>2012-10-29 09:39:03 +0100
commitd48ddb83666c32f14436106b8c9319f8ab24cf0a (patch)
tree60cf83dd2f2d17df622107c97bd605c140fd94bd /net/batman-adv
parenta932657f51eadb8280166e82dc7034dfbff3985a (diff)
downloadop-kernel-dev-d48ddb83666c32f14436106b8c9319f8ab24cf0a.zip
op-kernel-dev-d48ddb83666c32f14436106b8c9319f8ab24cf0a.tar.gz
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/batman-adv')
-rw-r--r--net/batman-adv/routing.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 376b4cc..8bdafc8 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)
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;
-
- 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, sizeof(*roam_adv_packet)) < 0)
goto out;
batadv_inc_counter(bat_priv, BATADV_CNT_TT_ROAM_ADV_RX);
OpenPOWER on IntegriCloud