diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-01-24 12:18:27 -0500 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2013-01-27 08:02:39 -0500 |
commit | b618ad1103c9ea0c4a69b44f42fc3c7b4e231e22 (patch) | |
tree | 58c80e65cc784f33ca4e627b867031fddb674430 | |
parent | 757dd82ea7008ddaccfecff3397bec3e3203a89e (diff) |
batman-adv: filter ARP packets with invalid MAC addresses in DAT
We never want multicast MAC addresses in the Distributed ARP Table, so it's
best to completely ignore ARP packets containing them where we expect unicast
addresses.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Acked-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
-rw-r--r-- | net/batman-adv/distributed-arp-table.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c index ccb3c6c96ba7..183f97a86bb2 100644 --- a/net/batman-adv/distributed-arp-table.c +++ b/net/batman-adv/distributed-arp-table.c | |||
@@ -738,6 +738,7 @@ static uint16_t batadv_arp_get_type(struct batadv_priv *bat_priv, | |||
738 | struct arphdr *arphdr; | 738 | struct arphdr *arphdr; |
739 | struct ethhdr *ethhdr; | 739 | struct ethhdr *ethhdr; |
740 | __be32 ip_src, ip_dst; | 740 | __be32 ip_src, ip_dst; |
741 | uint8_t *hw_src, *hw_dst; | ||
741 | uint16_t type = 0; | 742 | uint16_t type = 0; |
742 | 743 | ||
743 | /* pull the ethernet header */ | 744 | /* pull the ethernet header */ |
@@ -782,6 +783,18 @@ static uint16_t batadv_arp_get_type(struct batadv_priv *bat_priv, | |||
782 | ipv4_is_zeronet(ip_dst) || ipv4_is_lbcast(ip_dst)) | 783 | ipv4_is_zeronet(ip_dst) || ipv4_is_lbcast(ip_dst)) |
783 | goto out; | 784 | goto out; |
784 | 785 | ||
786 | hw_src = batadv_arp_hw_src(skb, hdr_size); | ||
787 | if (is_zero_ether_addr(hw_src) || is_multicast_ether_addr(hw_src)) | ||
788 | goto out; | ||
789 | |||
790 | /* we don't care about the destination MAC address in ARP requests */ | ||
791 | if (arphdr->ar_op != htons(ARPOP_REQUEST)) { | ||
792 | hw_dst = batadv_arp_hw_dst(skb, hdr_size); | ||
793 | if (is_zero_ether_addr(hw_dst) || | ||
794 | is_multicast_ether_addr(hw_dst)) | ||
795 | goto out; | ||
796 | } | ||
797 | |||
785 | type = ntohs(arphdr->ar_op); | 798 | type = ntohs(arphdr->ar_op); |
786 | out: | 799 | out: |
787 | return type; | 800 | return type; |