From patchwork Thu Jun 5 12:01:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ding Tianhong X-Patchwork-Id: 356320 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id F2AA4140077 for ; Thu, 5 Jun 2014 22:01:33 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751326AbaFEMB2 (ORCPT ); Thu, 5 Jun 2014 08:01:28 -0400 Received: from szxga01-in.huawei.com ([119.145.14.64]:3502 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750840AbaFEMB2 (ORCPT ); Thu, 5 Jun 2014 08:01:28 -0400 Received: from 172.24.2.119 (EHLO szxeml205-edg.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BWL78374; Thu, 05 Jun 2014 20:01:11 +0800 (CST) Received: from SZXEML420-HUB.china.huawei.com (10.82.67.159) by szxeml205-edg.china.huawei.com (172.24.2.58) with Microsoft SMTP Server (TLS) id 14.3.158.1; Thu, 5 Jun 2014 20:01:07 +0800 Received: from localhost (10.177.22.246) by szxeml420-hub.china.huawei.com (10.82.67.159) with Microsoft SMTP Server id 14.3.158.1; Thu, 5 Jun 2014 20:01:07 +0800 From: Ding Tianhong To: , , , , CC: Subject: [PATCH net-next v2 3/3] macvlan: don't set the same mac address for non-passthru mode Date: Thu, 5 Jun 2014 20:01:03 +0800 Message-ID: <1401969663-4464-4-git-send-email-dingtianhong@huawei.com> X-Mailer: git-send-email 1.8.5.2.msysgit.0 In-Reply-To: <1401969663-4464-1-git-send-email-dingtianhong@huawei.com> References: <1401969663-4464-1-git-send-email-dingtianhong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.22.246] X-CFilter-Loop: Reflected Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The macvlan should have the same mac address only for passthru mode, so the underlying device couldn't set a new address if it is in use by macvlan for non-passthru mode, otherwise it will break the work mechanism. Signed-off-by: Ding Tianhong --- drivers/net/macvlan.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index c3a54a6..edf1a1c 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -1185,8 +1185,12 @@ static int macvlan_device_event(struct notifier_block *unused, } break; case NETDEV_CHANGEADDR: - if (!port->passthru) + if (!port->passthru) { + if (macvlan_hash_lookup(port, dev->dev_addr)) + return NOTIFY_BAD; + return NOTIFY_DONE; + } vlan = list_first_entry_or_null(&port->vlans, struct macvlan_dev,