Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758410AbcCVHwF (ORCPT ); Tue, 22 Mar 2016 03:52:05 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:34676 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755821AbcCVHvj (ORCPT ); Tue, 22 Mar 2016 03:51:39 -0400 From: Yisen Zhuang To: CC: , , , , , , , , , , , , , Subject: [PATCH V2 net 01/10] net: hns: bug fix about ping6 Date: Tue, 22 Mar 2016 16:06:22 +0800 Message-ID: <1458633991-64313-2-git-send-email-Yisen.Zhuang@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1458633991-64313-1-git-send-email-Yisen.Zhuang@huawei.com> References: <1458633991-64313-1-git-send-email-Yisen.Zhuang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.56F0F89F.0015,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: c40371b117276e18fe26e5ed41ccd8c7 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1551 Lines: 52 From: Kejian Yan 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 Signed-off-by: Yisen Zhuang --- change log: PATCH v2: - modifies the wrong charator "whick" to "which" in commit log - use the "eth_hdr()" help to get source mac of packets PATCH v1: - first submit Link: https://lkml.org/lkml/2016/3/21/215 --- --- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c index 3f77ff7..ef84bd7 100644 --- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c +++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c @@ -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; -- 1.9.1