From patchwork Thu Jun 5 06:50:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ding Tianhong X-Patchwork-Id: 31399 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f198.google.com (mail-yk0-f198.google.com [209.85.160.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4A01420BF9 for ; Thu, 5 Jun 2014 06:51:39 +0000 (UTC) Received: by mail-yk0-f198.google.com with SMTP id 9sf1851507ykp.5 for ; Wed, 04 Jun 2014 23:51:39 -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=axw9UED0GWPVBhS1bUY910YqTamxqRC9UelV7oqbj03ry0zPl9bjtS48k221xnTeWq hkVDcHuYz5iNyRKS98LXU0iafbN5Q8c50c4utQthLXdB93iwMOv1pLWR7NZiwLVHL/AI ygpOgopG6QBrGY3hG1N7wsSje3sjfIz1xO6psh5tqRfZ/kswL75c7N4uEDMJA6vM16gJ lyzef1h5TDR/fBr0TozisVH9N4j5xBwY8aU5NV7Pf6vHiXYFGzRnNlEX1EgBtUlpmlND 4uMZO9wvZLtoPLWMA8ty7eBw58DC1dTDjcLiIwzK9wKmaApPCvHNs9XRBkG84S1enrz4 CN5Q== X-Gm-Message-State: ALoCoQl9Scm/hgePkk4LKe0NQ7VPj34YJ0PDywwMw2me2/jC+RvMZFC8AtvRYzrVLttBotr34REy X-Received: by 10.224.147.72 with SMTP id k8mr22151907qav.5.1401951099003; Wed, 04 Jun 2014 23:51:39 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.30.165 with SMTP id d34ls9684qgd.25.gmail; Wed, 04 Jun 2014 23:51:38 -0700 (PDT) X-Received: by 10.58.237.199 with SMTP id ve7mr140255vec.66.1401951098874; Wed, 04 Jun 2014 23:51:38 -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 b8si2023991vcf.7.2014.06.04.23.51.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Jun 2014 23:51:38 -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 hq11so645044vcb.25 for ; Wed, 04 Jun 2014 23:51:38 -0700 (PDT) X-Received: by 10.52.227.138 with SMTP id sa10mr40954134vdc.25.1401951098801; Wed, 04 Jun 2014 23:51:38 -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 vs6csp102972vcb; Wed, 4 Jun 2014 23:51:38 -0700 (PDT) X-Received: by 10.68.215.68 with SMTP id og4mr73045429pbc.112.1401951098080; Wed, 04 Jun 2014 23:51:38 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id aq3si10979121pbc.124.2014.06.04.23.51.37; Wed, 04 Jun 2014 23:51:37 -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 S1751222AbaFEGva (ORCPT + 3 others); Thu, 5 Jun 2014 02:51:30 -0400 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 Received: from 172.24.2.119 (EHLO szxeml209-edg.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BUS39462; Thu, 05 Jun 2014 14:50:50 +0800 (CST) Received: from SZXEML451-HUB.china.huawei.com (10.82.67.194) by szxeml209-edg.china.huawei.com (172.24.2.184) with Microsoft SMTP Server (TLS) id 14.3.158.1; Thu, 5 Jun 2014 14:50:37 +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; Thu, 5 Jun 2014 14:50:33 +0800 From: Ding Tianhong To: , , , CC: 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> X-Mailer: git-send-email 1.8.5.2.msysgit.0 In-Reply-To: <1401951028-9800-1-git-send-email-dingtianhong@huawei.com> References: <1401951028-9800-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,