From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ding Tianhong Subject: [PATCH net-next 4/4] macvlan: don't set the same mac address for non-passthru mode Date: Thu, 5 Jun 2014 14:50:28 +0800 Message-ID: <1401951028-9800-5-git-send-email-dingtianhong@huawei.com> References: <1401951028-9800-1-git-send-email-dingtianhong@huawei.com> Mime-Version: 1.0 Content-Type: text/plain Cc: To: , , , Return-path: Received: from szxga02-in.huawei.com ([119.145.14.65]:26032 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751082AbaFEGv2 (ORCPT ); Thu, 5 Jun 2014 02:51:28 -0400 In-Reply-To: <1401951028-9800-1-git-send-email-dingtianhong@huawei.com> Sender: netdev-owner@vger.kernel.org List-ID: 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, -- 1.8.0