[Devel] [PATCH RH7] ms/net: allow macvlans to move to net namespace

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Mon Oct 31 02:37:08 PDT 2016


From: Francesco Ruggeri <fruggeri at arista.com>

We have a problem in macvlan criu test on VZ7:

https://ci.openvz.org/job/CRIU/job/CRIU-virtuozzo/branch/criu-dev/837/consoleFull
======================== Run zdtm/static/macvlan in ns =========================
Start test
Test is SUID
./macvlan --pidfile=macvlan.pid --outfile=macvlan.out
RTNETLINK answers: Invalid argument
Running zdtm/static/macvlan.hook(--post-start)

because macvlan_fix_features called from register_netdevice
updates features from lowerdev and not dropping NETIF_F_NETNS_LOCAL.

And thus moving zdtmmvlan0 to other ns fails, so changing it to
be mainstream like. (That do not changes behaviour in CT as macvlan
is still forbidden there.)

  net: allow macvlans to move to net namespace

  I cannot move a macvlan interface created on top of a bonding interface
  to a different namespace:

  % ip netns add dummy0
  % ip link add link bond0 mac0 type macvlan
  % ip link set mac0 netns dummy0
  RTNETLINK answers: Invalid argument
  %

  The problem seems to be that commit f9399814927a ("bonding: Don't allow
  bond devices to change network namespaces.") sets NETIF_F_NETNS_LOCAL
  on bonding interfaces, and commit 797f87f83b60 ("macvlan: fix netdev
  feature propagation from lower device") causes macvlan interfaces
  to inherit its features from the lower device.

  NETIF_F_NETNS_LOCAL should not be inherited from the lower device
  by a macvlan.
  Patch tested on 3.16.

  Signed-off-by: Francesco Ruggeri <fruggeri at arista.com>
  Acked-by: Cong Wang <cwang at twopensource.com>
  Signed-off-by: David S. Miller <davem at davemloft.net>

Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 drivers/net/macvlan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 108ceb8..cb3d4de 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -734,6 +734,7 @@ static netdev_features_t macvlan_fix_features(struct net_device *dev,
 					     features,
 					     mask);
 	features |= ALWAYS_ON_FEATURES;
+	features &= ~NETIF_F_NETNS_LOCAL;
 
 	return features;
 }
-- 
2.7.4



More information about the Devel mailing list