Netdev List
 help / color / mirror / Atom feed
From: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
To: "David S. Miller" <davem@davemloft.net>,
	Stephen Hemminger <stephen@networkplumber.org>
Cc: Tom Gundersen <teg@jklm.no>, netdev <netdev@vger.kernel.org>,
	bridge <bridge@lists.linux-foundation.org>,
	"C. R. Oldham" <cr@saltstack.com>
Subject: [PATCH net v2] bridge: Handle IFLA_ADDRESS correctly when creating bridge device
Date: Fri, 25 Apr 2014 17:01:18 +0900	[thread overview]
Message-ID: <1398412878.3920.7.camel@ubuntu-vm-makita> (raw)
In-Reply-To: <1398412451.3920.3.camel@ubuntu-vm-makita>

When bridge device is created with IFLA_ADDRESS, we are not calling
br_stp_change_bridge_id(), which leads to incorrect local fdb
management and bridge id calculation, and prevents us from receiving
frames on the bridge device.

Reported-by: Tom Gundersen <teg@jklm.no>
Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
---

v1->v2:
- Remove variable "err" and directly return register_netdevice().

 net/bridge/br_netlink.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index e74b6d53..e8844d9 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -445,6 +445,20 @@ static int br_validate(struct nlattr *tb[], struct nlattr *data[])
 	return 0;
 }
 
+static int br_dev_newlink(struct net *src_net, struct net_device *dev,
+			  struct nlattr *tb[], struct nlattr *data[])
+{
+	struct net_bridge *br = netdev_priv(dev);
+
+	if (tb[IFLA_ADDRESS]) {
+		spin_lock_bh(&br->lock);
+		br_stp_change_bridge_id(br, nla_data(tb[IFLA_ADDRESS]));
+		spin_unlock_bh(&br->lock);
+	}
+
+	return register_netdevice(dev);
+}
+
 static size_t br_get_link_af_size(const struct net_device *dev)
 {
 	struct net_port_vlans *pv;
@@ -473,6 +487,7 @@ struct rtnl_link_ops br_link_ops __read_mostly = {
 	.priv_size	= sizeof(struct net_bridge),
 	.setup		= br_dev_setup,
 	.validate	= br_validate,
+	.newlink	= br_dev_newlink,
 	.dellink	= br_dev_delete,
 };
 
-- 
1.8.1.2

  reply	other threads:[~2014-04-25  8:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-21 19:33 [BUG?] bridge_id not getting set for bridges created with Tom Gundersen
2014-04-21 20:56 ` Tom Gundersen
2014-04-24 12:06   ` Toshiaki Makita
2014-04-24 12:16     ` [PATCH net] bridge: Handle IFLA_ADDRESS correctly when creating bridge device Toshiaki Makita
2014-04-24 16:04       ` Tom Gundersen
2014-04-25  8:18         ` Toshiaki Makita
2014-04-24 18:38       ` Stephen Hemminger
2014-04-25  7:54         ` Toshiaki Makita
2014-04-25  8:01           ` Toshiaki Makita [this message]
2014-04-27 23:54             ` [PATCH net v2] " David Miller
2014-04-24 12:30     ` Unsubscribe me in this Forum Amidu Sila

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=1398412878.3920.7.camel@ubuntu-vm-makita \
    --to=makita.toshiaki@lab.ntt.co.jp \
    --cc=bridge@lists.linux-foundation.org \
    --cc=cr@saltstack.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=teg@jklm.no \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox