Skip to content

Commit

Permalink
bridge: Handle IFLA_ADDRESS correctly when creating bridge device
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Toshiaki Makita authored and davem330 committed Apr 27, 2014
1 parent 535cdf3 commit 30313a3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions net/bridge/br_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
};

Expand Down

0 comments on commit 30313a3

Please sign in to comment.