All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ding Tianhong <dingtianhong@huawei.com>
To: <kaber@trash.net>, <davem@davemloft.net>, <edumazet@google.com>,
	<vyasevic@redhat.com>, <makita.toshiaki@lab.ntt.co.jp>
Cc: <netdev@vger.kernel.org>
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	[thread overview]
Message-ID: <1402127143-6456-4-git-send-email-dingtianhong@huawei.com> (raw)
In-Reply-To: <1402127143-6456-1-git-send-email-dingtianhong@huawei.com>

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 <dingtianhong@huawei.com>
---
 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,
-- 
1.8.0

  parent reply	other threads:[~2014-06-07  7:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-07  7:45 [PATCH net-next v2 RESEND 0/4] macvlan: fix some problem if mac address changes Ding Tianhong
2014-06-07  7:45 ` [PATCH net-next v2 RESEND 1/4] macvlan: support mac address changes when fwd_priv is enable Ding Tianhong
2014-06-09 16:51   ` Vlad Yasevich
2014-06-12  1:45     ` Ding Tianhong
2014-06-12 14:24       ` Vlad Yasevich
2014-06-13  3:10         ` Ding Tianhong
2014-06-13 13:30           ` Vlad Yasevich
2014-06-14  5:01             ` Ding Tianhong
2014-06-07  7:45 ` [PATCH net-next v2 RESEND 2/4] net: dev: revert the mac address when notifier failed Ding Tianhong
2014-06-07  7:45 ` Ding Tianhong [this message]
2014-06-07  7:45 ` [PATCH net-next v2 RESEND 4/4] net: dev: don't set the same mac address for netdev Ding Tianhong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1402127143-6456-4-git-send-email-dingtianhong@huawei.com \
    --to=dingtianhong@huawei.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kaber@trash.net \
    --cc=makita.toshiaki@lab.ntt.co.jp \
    --cc=netdev@vger.kernel.org \
    --cc=vyasevic@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.