Skip to content

Commit

Permalink
net: vrf: Set slave's private flag before linking
Browse files Browse the repository at this point in the history
Allow listeners of the subsequent CHANGEUPPER notification to retrieve
the VRF's table ID by calling l3mdev_fib_table() with the slave netdev.
Without this change, the netdev won't be considered an L3 slave and the
function would return 0.

This is consistent with other master device such as bridge and bond that
set the slave's private flag before linking. It also makes
do_vrf_{add,del}_slave() symmetric.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ido Schimmel authored and David S. Miller committed Mar 16, 2017
1 parent 5d7bfd1 commit fdeea7b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/net/vrf.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,14 +747,18 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev)
{
int ret;

port_dev->priv_flags |= IFF_L3MDEV_SLAVE;
ret = netdev_master_upper_dev_link(port_dev, dev, NULL, NULL);
if (ret < 0)
return ret;
goto err;

port_dev->priv_flags |= IFF_L3MDEV_SLAVE;
cycle_netdev(port_dev);

return 0;

err:
port_dev->priv_flags &= ~IFF_L3MDEV_SLAVE;
return ret;
}

static int vrf_add_slave(struct net_device *dev, struct net_device *port_dev)
Expand Down

0 comments on commit fdeea7b

Please sign in to comment.