From patchwork Sat Jun 7 07:45:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ding Tianhong X-Patchwork-Id: 31508 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0A2AC2100A for ; Sat, 7 Jun 2014 07:46:36 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id nu7sf8059200obb.8 for ; Sat, 07 Jun 2014 00:46:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=A5Z3YEjjrNTlbmgmg+z/03yiCnPYtfzgutDNsaqJUuQ=; b=i8tx/3TNx4RguP+yweNB1WRvvHgDycaxXDM7+HWMEgToy+9qIclheVDFgj8AQ8Nu/6 jovIiIJ2uffM8LrGHTMcY4ZdYicQtCXPdGuwQtUF27qWqfqPDVcKv69s1JpxhSOLPTbC 2OyiLTBZUcPnM0WSPP7qTpp+8CS2UuC5cpqY7p9YPk4NXwdgkxqTdWQ4Gi7UbjpCDsGn LrqEaJiAbud/N92cZISdfG0u7Vwk600qEHgilfG0ieITZ4IzrFSZw2a5leoEMNVHIBoe CkV3Y73QBpYGv3zIkVbWUQJtAIDzrYZAZ0VXhUO6RlB84PE65IKPqTAh/JXgs6Ma0bPN IsnQ== X-Gm-Message-State: ALoCoQkyKtzblW2iY4PZtiVnVdqd9alJCF+724iVPTZIe6BfLQtoxobjg7ZUK1Jx/dr02Gu7kjWd X-Received: by 10.50.67.37 with SMTP id k5mr5520393igt.5.1402127195612; Sat, 07 Jun 2014 00:46:35 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.85.40 with SMTP id m37ls1030059qgd.18.gmail; Sat, 07 Jun 2014 00:46:35 -0700 (PDT) X-Received: by 10.220.69.72 with SMTP id y8mr11192255vci.21.1402127195507; Sat, 07 Jun 2014 00:46:35 -0700 (PDT) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by mx.google.com with ESMTPS id t3si7145526vcx.5.2014.06.07.00.46.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 07 Jun 2014 00:46:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.178 as permitted sender) client-ip=209.85.128.178; Received: by mail-ve0-f178.google.com with SMTP id sa20so4469253veb.37 for ; Sat, 07 Jun 2014 00:46:35 -0700 (PDT) X-Received: by 10.52.52.168 with SMTP id u8mr6443634vdo.25.1402127195421; Sat, 07 Jun 2014 00:46:35 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.54.6 with SMTP id vs6csp6582vcb; Sat, 7 Jun 2014 00:46:35 -0700 (PDT) X-Received: by 10.68.222.196 with SMTP id qo4mr9946288pbc.14.1402127194602; Sat, 07 Jun 2014 00:46:34 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bh2si23941557pbb.204.2014.06.07.00.46.34; Sat, 07 Jun 2014 00:46:34 -0700 (PDT) Received-SPF: none (google.com: netdev-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752812AbaFGHqY (ORCPT + 3 others); Sat, 7 Jun 2014 03:46:24 -0400 Received: from szxga01-in.huawei.com ([119.145.14.64]:32052 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752760AbaFGHqX (ORCPT ); Sat, 7 Jun 2014 03:46:23 -0400 Received: from 172.24.2.119 (EHLO szxeml208-edg.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BWN55051; Sat, 07 Jun 2014 15:45:51 +0800 (CST) Received: from SZXEML451-HUB.china.huawei.com (10.82.67.194) by szxeml208-edg.china.huawei.com (172.24.2.57) with Microsoft SMTP Server (TLS) id 14.3.158.1; Sat, 7 Jun 2014 15:45:47 +0800 Received: from localhost (10.177.22.246) by szxeml451-hub.china.huawei.com (10.82.67.194) with Microsoft SMTP Server id 14.3.158.1; Sat, 7 Jun 2014 15:45:48 +0800 From: Ding Tianhong To: , , , , CC: Subject: [PATCH net-next v2 RESEND 3/4] macvlan: don't set the same mac address for non-passthru mode Date: Sat, 7 Jun 2014 15:45:42 +0800 Message-ID: <1402127143-6456-4-git-send-email-dingtianhong@huawei.com> X-Mailer: git-send-email 1.8.5.2.msysgit.0 In-Reply-To: <1402127143-6456-1-git-send-email-dingtianhong@huawei.com> References: <1402127143-6456-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: list List-ID: X-Mailing-List: netdev@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: dingtianhong@huawei.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 67485ab..b6a0065 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -1206,8 +1206,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,