net: vrf: Do not allow looback to be moved to a VRF
Subsystems (3)
PATCH 1/1 net: vrf: Do not allow looback to be moved to a VRF
Moving the loopback into a VRF breaks networking for the default VRF. Since the VRF device is the loopback for VRF domains, there is no reason to move the loopback. Given the repercussions, block attempts to set lo into a VRF.
--- drivers/net/vrf.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/vrf.c +6 -0
@@ -877,6 +877,12 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev) {int ret; +/* do not allow loopback device to be enslaved to a VRF. +* The vrf device acts as the loopback for the vrf. +*/ +if (port_dev ==dev_net (dev)->loopback_dev) +return -EOPNOTSUPP ; + port_dev->priv_flags |=IFF_L3MDEV_SLAVE ; ret =netdev_master_upper_dev_link (port_dev, dev,NULL ,NULL );if (ret <0 )
Signature · 1 line
2.1.4
Quoted 17 lines · David Ahern
Moving the loopback into a VRF breaks networking for the default VRF. Since the VRF device is the loopback for VRF domains, there is no reason to move the loopback. Given the repercussions, block attempts to set lo into a VRF.
Signed-off-by David Ahern <[email protected]>--- drivers/net/vrf.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/net/vrf.c +0
-0@@ -877,6 +877,12 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev) {int ret;
drivers/net/vrf.c static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev) · line 888
Quoted 10 lines
drivers/net/vrf.c +6
-0+/* do not allow loopback device to be enslaved to a VRF. +* The vrf device acts as the loopback for the vrf. +*/ +if (port_dev ==dev_net (dev)->loopback_dev) +return -EOPNOTSUPP ; + port_dev->priv_flags |=IFF_L3MDEV_SLAVE ; ret =netdev_master_upper_dev_link (port_dev, dev,NULL ,NULL );if (ret <0 )
I think that's a great idea.
From: David Ahern <[email protected]>
Date: Wed, 26 Apr 2017 07:58:22 -0700
Quoted 6 lines
Moving the loopback into a VRF breaks networking for the default VRF. Since the VRF device is the loopback for VRF domains, there is no reason to move the loopback. Given the repercussions, block attempts to set lo into a VRF.
Signed-off-by David Ahern <[email protected]>
Applied, thanks David.