Skip to content

Commit 30313a3

Browse files
Toshiaki Makitadavem330
Toshiaki Makita
authored andcommitted
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 <[email protected]> Signed-off-by: Toshiaki Makita <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 535cdf3 commit 30313a3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

net/bridge/br_netlink.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,20 @@ static int br_validate(struct nlattr *tb[], struct nlattr *data[])
445445
return 0;
446446
}
447447

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+
448462
static size_t br_get_link_af_size(const struct net_device *dev)
449463
{
450464
struct net_port_vlans *pv;
@@ -473,6 +487,7 @@ struct rtnl_link_ops br_link_ops __read_mostly = {
473487
.priv_size = sizeof(struct net_bridge),
474488
.setup = br_dev_setup,
475489
.validate = br_validate,
490+
.newlink = br_dev_newlink,
476491
.dellink = br_dev_delete,
477492
};
478493

0 commit comments

Comments
 (0)