Commit de3baa3e authored by David Ahern's avatar David Ahern Committed by David S. Miller

net: vrf: Add extack messages for enslave errors

Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 42ab19ee
...@@ -772,8 +772,11 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev, ...@@ -772,8 +772,11 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev,
/* do not allow loopback device to be enslaved to a VRF. /* do not allow loopback device to be enslaved to a VRF.
* The vrf device acts as the loopback for the vrf. * The vrf device acts as the loopback for the vrf.
*/ */
if (port_dev == dev_net(dev)->loopback_dev) if (port_dev == dev_net(dev)->loopback_dev) {
NL_SET_ERR_MSG(extack,
"Can not enslave loopback device to a VRF");
return -EOPNOTSUPP; return -EOPNOTSUPP;
}
port_dev->priv_flags |= IFF_L3MDEV_SLAVE; port_dev->priv_flags |= IFF_L3MDEV_SLAVE;
ret = netdev_master_upper_dev_link(port_dev, dev, NULL, NULL, extack); ret = netdev_master_upper_dev_link(port_dev, dev, NULL, NULL, extack);
...@@ -792,7 +795,13 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev, ...@@ -792,7 +795,13 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev,
static int vrf_add_slave(struct net_device *dev, struct net_device *port_dev, static int vrf_add_slave(struct net_device *dev, struct net_device *port_dev,
struct netlink_ext_ack *extack) struct netlink_ext_ack *extack)
{ {
if (netif_is_l3_master(port_dev) || netif_is_l3_slave(port_dev)) if (netif_is_l3_master(port_dev)) {
NL_SET_ERR_MSG(extack,
"Can not enslave an L3 master device to a VRF");
return -EINVAL;
}
if (netif_is_l3_slave(port_dev))
return -EINVAL; return -EINVAL;
return do_vrf_add_slave(dev, port_dev, extack); return do_vrf_add_slave(dev, port_dev, extack);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment