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] bridge: Handle IFLA_ADDRESS correctly when creating bridge device
Date: Thu, 24 Apr 2014 21:16:27 +0900 [thread overview]
Message-ID: <1398341787.4171.16.camel@ubuntu-vm-makita> (raw)
In-Reply-To: <1398341177.4171.11.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>
---
net/bridge/br_netlink.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index e74b6d53..a8b664e 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -445,6 +445,25 @@ 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[])
+{
+ int err;
+ 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);
+ }
+
+ err = register_netdevice(dev);
+ if (err)
+ return err;
+
+ return 0;
+}
+
static size_t br_get_link_af_size(const struct net_device *dev)
{
struct net_port_vlans *pv;
@@ -473,6 +492,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
next prev parent reply other threads:[~2014-04-24 12:16 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 ` Toshiaki Makita [this message]
2014-04-24 16:04 ` [PATCH net] bridge: Handle IFLA_ADDRESS correctly when creating bridge device 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 ` [PATCH net v2] " Toshiaki Makita
2014-04-27 23:54 ` 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=1398341787.4171.16.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;
as well as URLs for NNTP newsgroup(s).