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: 31414 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f72.google.com (mail-qg0-f72.google.com [209.85.192.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 818D4203AC for ; Thu, 5 Jun 2014 12:01:33 +0000 (UTC) Received: by mail-qg0-f72.google.com with SMTP id q108sf2706178qgd.3 for ; Thu, 05 Jun 2014 05:01:33 -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=g/RMGEW/3LLKun4HhVqdGg322zB8Fk8J+9rb3oPRvNE=; b=nJxl1xkg70k6z0bL/0on9NfnA1xWpu/bMMHR4GNUc7IWmLxqDNK/7aOoylXiKkbbJi 4KAcGttiJevsFjli72ZSHze9FPcy0eCAx7qYY631nGed/w3y6VJ6KuKjBz5+vkdT0Gnx WOnxwJ1JlhrgWEf/10KqZbRAQ7YxjOvcmsh12ShApDpBQn5MOFVDOv0mC6BsF8zRW38V y8tHisqoQnFqpY0X0GwQ273zvNDM1ZgM7ZCutlqaP9gZ3uSXnpCeP/tB32fQCOT8DLpA 0zluBInQel2mRL7V9Oi2m6z9L2bcFOSSj9m3d49mRG1uey7DveqtQd0uDzJDdui9iRny qOPQ== X-Gm-Message-State: ALoCoQn+xnzGkJvzWvOKFjLe40CS5hhwWJAaQ7CH2LdSzQzRL6efOUOaAr+3wFL705FKPU6lgv0z X-Received: by 10.236.207.164 with SMTP id n24mr23730711yho.5.1401969693662; Thu, 05 Jun 2014 05:01:33 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.36.14 with SMTP id o14ls112698qgo.63.gmail; Thu, 05 Jun 2014 05:01:33 -0700 (PDT) X-Received: by 10.58.246.132 with SMTP id xw4mr50538905vec.2.1401969693505; Thu, 05 Jun 2014 05:01:33 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id hl8si3538576vdb.98.2014.06.05.05.01.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Jun 2014 05:01:33 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id hq11so973684vcb.25 for ; Thu, 05 Jun 2014 05:01:33 -0700 (PDT) X-Received: by 10.220.44.141 with SMTP id a13mr309799vcf.71.1401969693414; Thu, 05 Jun 2014 05:01:33 -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 vs6csp10833vcb; Thu, 5 Jun 2014 05:01:33 -0700 (PDT) X-Received: by 10.50.9.104 with SMTP id y8mr19205603iga.43.1401969692709; Thu, 05 Jun 2014 05:01:32 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ga2si15753114igd.0.2014.06.05.05.01.32; Thu, 05 Jun 2014 05:01:32 -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 S1751326AbaFEMB2 (ORCPT + 3 others); 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: 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.220.180 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 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,