aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/routing.c
diff options
context:
space:
mode:
authorMartin Hundebøll <martin@hundeboll.net>2012-07-05 05:34:27 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-08-23 08:20:18 -0400
commitff51fd70ad3e6bbf1ffc7d2a1d6a845d081df5a1 (patch)
tree88c7f8d8f8ae1abe9bf3bfee773f64b6efa47071 /net/batman-adv/routing.c
parent807736f6e00714fdeb443b31061d1c27fa903296 (diff)
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/routing.c')
-rw-r--r--net/batman-adv/routing.c50
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,
579 return router; 579 return router;
580} 580}
581 581
582static int batadv_check_unicast_packet(struct sk_buff *skb, int hdr_size)
583{
584 struct ethhdr *ethhdr;
585
586 /* drop packet if it has not necessary minimum size */
587 if (unlikely(!pskb_may_pull(skb, hdr_size)))
588 return -1;
589
590 ethhdr = (struct ethhdr *)skb_mac_header(skb);
591
592 /* packet with unicast indication but broadcast recipient */
593 if (is_broadcast_ether_addr(ethhdr->h_dest))
594 return -1;
595
596 /* packet with broadcast sender address */
597 if (is_broadcast_ether_addr(ethhdr->h_source))
598 return -1;
599
600 /* not for me */
601 if (!batadv_is_my_mac(ethhdr->h_dest))
602 return -1;
603
604 return 0;
605}
606
582int batadv_recv_tt_query(struct sk_buff *skb, struct batadv_hard_iface *recv_if) 607int batadv_recv_tt_query(struct sk_buff *skb, struct batadv_hard_iface *recv_if)
583{ 608{
584 struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface); 609 struct batadv_priv *bat_priv = netdev_priv(recv_if->soft_iface);
@@ -819,31 +844,6 @@ err:
819 return NULL; 844 return NULL;
820} 845}
821 846
822static int batadv_check_unicast_packet(struct sk_buff *skb, int hdr_size)
823{
824 struct ethhdr *ethhdr;
825
826 /* drop packet if it has not necessary minimum size */
827 if (unlikely(!pskb_may_pull(skb, hdr_size)))
828 return -1;
829
830 ethhdr = (struct ethhdr *)skb_mac_header(skb);
831
832 /* packet with unicast indication but broadcast recipient */
833 if (is_broadcast_ether_addr(ethhdr->h_dest))
834 return -1;
835
836 /* packet with broadcast sender address */
837 if (is_broadcast_ether_addr(ethhdr->h_source))
838 return -1;
839
840 /* not for me */
841 if (!batadv_is_my_mac(ethhdr->h_dest))
842 return -1;
843
844 return 0;
845}
846
847static int batadv_route_unicast_packet(struct sk_buff *skb, 847static int batadv_route_unicast_packet(struct sk_buff *skb,
848 struct batadv_hard_iface *recv_if) 848 struct batadv_hard_iface *recv_if)
849{ 849{