diff options
Diffstat (limited to 'net')
| -rw-r--r-- | net/batman-adv/distributed-arp-table.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c index 8e1d89d2b1c1..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 */ |
| @@ -777,9 +778,23 @@ static uint16_t batadv_arp_get_type(struct batadv_priv *bat_priv, | |||
| 777 | ip_src = batadv_arp_ip_src(skb, hdr_size); | 778 | ip_src = batadv_arp_ip_src(skb, hdr_size); |
| 778 | ip_dst = batadv_arp_ip_dst(skb, hdr_size); | 779 | ip_dst = batadv_arp_ip_dst(skb, hdr_size); |
| 779 | if (ipv4_is_loopback(ip_src) || ipv4_is_multicast(ip_src) || | 780 | if (ipv4_is_loopback(ip_src) || ipv4_is_multicast(ip_src) || |
| 780 | ipv4_is_loopback(ip_dst) || ipv4_is_multicast(ip_dst)) | 781 | ipv4_is_loopback(ip_dst) || ipv4_is_multicast(ip_dst) || |
| 782 | ipv4_is_zeronet(ip_src) || ipv4_is_lbcast(ip_src) || | ||
| 783 | ipv4_is_zeronet(ip_dst) || ipv4_is_lbcast(ip_dst)) | ||
| 781 | goto out; | 784 | goto out; |
| 782 | 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 | |||
| 783 | type = ntohs(arphdr->ar_op); | 798 | type = ntohs(arphdr->ar_op); |
| 784 | out: | 799 | out: |
| 785 | return type; | 800 | return type; |
| @@ -1012,6 +1027,8 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, | |||
| 1012 | */ | 1027 | */ |
| 1013 | ret = !batadv_is_my_client(bat_priv, hw_dst); | 1028 | ret = !batadv_is_my_client(bat_priv, hw_dst); |
| 1014 | out: | 1029 | out: |
| 1030 | if (ret) | ||
| 1031 | kfree_skb(skb); | ||
| 1015 | /* if ret == false -> packet has to be delivered to the interface */ | 1032 | /* if ret == false -> packet has to be delivered to the interface */ |
| 1016 | return ret; | 1033 | return ret; |
| 1017 | } | 1034 | } |
