Skip to content

Commit b667744

Browse files
iveceradavem330
authored andcommitted
bridge: netlink: call br_changelink() during br_dev_newlink()
Any bridge options specified during link creation (e.g. ip link add) are ignored as br_dev_newlink() does not process them. Use br_changelink() to do it. Fixes: 1332351 ("bridge: implement rtnl_link_ops->changelink") Signed-off-by: Ivan Vecera <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 90c311b commit b667744

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

net/bridge/br_netlink.c

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -781,20 +781,6 @@ static int br_validate(struct nlattr *tb[], struct nlattr *data[])
781781
return 0;
782782
}
783783

784-
static int br_dev_newlink(struct net *src_net, struct net_device *dev,
785-
struct nlattr *tb[], struct nlattr *data[])
786-
{
787-
struct net_bridge *br = netdev_priv(dev);
788-
789-
if (tb[IFLA_ADDRESS]) {
790-
spin_lock_bh(&br->lock);
791-
br_stp_change_bridge_id(br, nla_data(tb[IFLA_ADDRESS]));
792-
spin_unlock_bh(&br->lock);
793-
}
794-
795-
return register_netdevice(dev);
796-
}
797-
798784
static int br_port_slave_changelink(struct net_device *brdev,
799785
struct net_device *dev,
800786
struct nlattr *tb[],
@@ -1115,6 +1101,25 @@ static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
11151101
return 0;
11161102
}
11171103

1104+
static int br_dev_newlink(struct net *src_net, struct net_device *dev,
1105+
struct nlattr *tb[], struct nlattr *data[])
1106+
{
1107+
struct net_bridge *br = netdev_priv(dev);
1108+
int err;
1109+
1110+
if (tb[IFLA_ADDRESS]) {
1111+
spin_lock_bh(&br->lock);
1112+
br_stp_change_bridge_id(br, nla_data(tb[IFLA_ADDRESS]));
1113+
spin_unlock_bh(&br->lock);
1114+
}
1115+
1116+
err = br_changelink(dev, tb, data);
1117+
if (err)
1118+
return err;
1119+
1120+
return register_netdevice(dev);
1121+
}
1122+
11181123
static size_t br_get_size(const struct net_device *brdev)
11191124
{
11201125
return nla_total_size(sizeof(u32)) + /* IFLA_BR_FORWARD_DELAY */

0 commit comments

Comments
 (0)