diff options
author | Martin Hundebøll <martin@hundeboll.net> | 2012-07-05 11:34:27 +0200 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-08-23 14:20:18 +0200 |
commit | ff51fd70ad3e6bbf1ffc7d2a1d6a845d081df5a1 (patch) | |
tree | 88c7f8d8f8ae1abe9bf3bfee773f64b6efa47071 /net/batman-adv | |
parent | 807736f6e00714fdeb443b31061d1c27fa903296 (diff) | |
download | blackbird-op-linux-ff51fd70ad3e6bbf1ffc7d2a1d6a845d081df5a1.tar.gz blackbird-op-linux-ff51fd70ad3e6bbf1ffc7d2a1d6a845d081df5a1.zip |
batman-adv: Move batadv_check_unicast_packet()
batadv_check_unicast_packet() is needed in batadv_recv_tt_query(), so
move the former to before the latter.
Signed-off-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv')
-rw-r--r-- | net/batman-adv/routing.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c index d5edee7ecfa8..a79ded53dd94 100644 --- a/net/batman-adv/routing.c +++ b/net/batman-adv/routing.c @@ -579,6 +579,31 @@ batadv_find_ifalter_router(struct batadv_orig_node *primary_orig, return router; } +static int batadv_check_unicast_packet(struct sk_buff *skb, int hdr_size) +{ + struct ethhdr *ethhdr; + + /* drop packet if it has not necessary minimum size */ + if (unlikely(!pskb_may_pull(skb, hdr_size))) + return -1; + + ethhdr = (struct ethhdr *)skb_mac_header(skb); + + /* packet with unicast indication but broadcast recipient */ + if (is_broadcast_ether_addr(ethhdr->h_dest)) + return -1; + + /* packet with broadcast sender address */ + if (is_broadcast_ether_addr(ethhdr->h_source)) + return -1; + + /* not for me */ + if (!batadv_is_my_mac(ethhdr->h_dest)) + return -1; + + return 0; +} + int batadv_recv_tt_query(struct sk_buff *skb, struct batadv_hard_iface *recv_if) { struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); @@ -819,31 +844,6 @@ err: return NULL; } -static int batadv_check_unicast_packet(struct sk_buff *skb, int hdr_size) -{ - struct ethhdr *ethhdr; - - /* drop packet if it has not necessary minimum size */ - if (unlikely(!pskb_may_pull(skb, hdr_size))) - return -1; - - ethhdr = (struct ethhdr *)skb_mac_header(skb); - - /* packet with unicast indication but broadcast recipient */ - if (is_broadcast_ether_addr(ethhdr->h_dest)) - return -1; - - /* packet with broadcast sender address */ - if (is_broadcast_ether_addr(ethhdr->h_source)) - return -1; - - /* not for me */ - if (!batadv_is_my_mac(ethhdr->h_dest)) - return -1; - - return 0; -} - static int batadv_route_unicast_packet(struct sk_buff *skb, struct batadv_hard_iface *recv_if) { |