diff options
author | Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp> | 2014-04-25 04:01:18 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-04-27 19:46:17 -0400 |
commit | 30313a3d5794472c3548d7288e306a5492030370 (patch) | |
tree | ef0932905b96576771b2f51a8f292e954815bf81 | |
parent | 535cdf3c195ed4125414f6bb780382aed1b4e19c (diff) |
bridge: Handle IFLA_ADDRESS correctly when creating bridge device
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/bridge/br_netlink.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index e74b6d530cb6..e8844d975b32 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[]) | |||
445 | return 0; | 445 | return 0; |
446 | } | 446 | } |
447 | 447 | ||
448 | static int br_dev_newlink(struct net *src_net, struct net_device *dev, | ||
449 | struct nlattr *tb[], struct nlattr *data[]) | ||
450 | { | ||
451 | struct net_bridge *br = netdev_priv(dev); | ||
452 | |||
453 | if (tb[IFLA_ADDRESS]) { | ||
454 | spin_lock_bh(&br->lock); | ||
455 | br_stp_change_bridge_id(br, nla_data(tb[IFLA_ADDRESS])); | ||
456 | spin_unlock_bh(&br->lock); | ||
457 | } | ||
458 | |||
459 | return register_netdevice(dev); | ||
460 | } | ||
461 | |||
448 | static size_t br_get_link_af_size(const struct net_device *dev) | 462 | static size_t br_get_link_af_size(const struct net_device *dev) |
449 | { | 463 | { |
450 | struct net_port_vlans *pv; | 464 | struct net_port_vlans *pv; |
@@ -473,6 +487,7 @@ struct rtnl_link_ops br_link_ops __read_mostly = { | |||
473 | .priv_size = sizeof(struct net_bridge), | 487 | .priv_size = sizeof(struct net_bridge), |
474 | .setup = br_dev_setup, | 488 | .setup = br_dev_setup, |
475 | .validate = br_validate, | 489 | .validate = br_validate, |
490 | .newlink = br_dev_newlink, | ||
476 | .dellink = br_dev_delete, | 491 | .dellink = br_dev_delete, |
477 | }; | 492 | }; |
478 | 493 | ||