]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
net: hns: bug fix about ping6
authorKejian Yan <yankejian@huawei.com>
Tue, 22 Mar 2016 08:06:22 +0000 (16:06 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 22 Mar 2016 19:45:57 +0000 (15:45 -0400)
The current upstreaming code fails to ping other IPv6 net device, because
the enet receives the multicast packets with the src mac addr which is the
same as its mac addr. These packets need to be dropped.

Signed-off-by: Kejian Yan <yankejian@huawei.com>
Signed-off-by: Yisen Zhuang <Yisen.Zhuang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns/hns_enet.c

index 3f77ff77abbc4594f8aeb0ccc40c6691fc122fac..ef84bd72e3ca3c028e4db2835c3efff3d985da1c 100644 (file)
@@ -564,6 +564,7 @@ static int hns_nic_poll_rx_skb(struct hns_nic_ring_data *ring_data,
        struct sk_buff *skb;
        struct hnae_desc *desc;
        struct hnae_desc_cb *desc_cb;
+       struct ethhdr *eh;
        unsigned char *va;
        int bnum, length, i;
        int pull_len;
@@ -670,6 +671,14 @@ out_bnum_err:
                return -EFAULT;
        }
 
+       /* filter out multicast pkt with the same src mac as this port */
+       eh = eth_hdr(skb);
+       if (unlikely(is_multicast_ether_addr(eh->h_dest) &&
+                    ether_addr_equal(ndev->dev_addr, eh->h_source))) {
+               dev_kfree_skb_any(skb);
+               return -EFAULT;
+       }
+
        ring->stats.rx_pkts++;
        ring->stats.rx_bytes += skb->len;