[Devel,RHEL7,COMMIT] ms/net: allow macvlans to move to net namespace

Submitted by Konstantin Khorenko on Nov. 9, 2016, 1:49 p.m.

Details

Message ID 201611091349.uA9DnD7E002187@finist_cl7.x64_64.work.ct
State New
Series "ms/net: allow macvlans to move to net namespace"
Headers show

Commit Message

Konstantin Khorenko Nov. 9, 2016, 1:49 p.m.
The commit is pushed to "branch-rh7-3.10.0-327.36.1.vz7.19.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.36.1.vz7.19.6
------>
commit 1cf4840dbcdd04d7503de4f2270150677756bcce
Author: Francesco Ruggeri <fruggeri@arista.com>
Date:   Wed Nov 9 17:49:11 2016 +0400

    ms/net: allow macvlans to move to net namespace
    
    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@arista.com>
      Acked-by: Cong Wang <cwang@twopensource.com>
      Signed-off-by: David S. Miller <davem@davemloft.net>
    
    Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Acked-by: Andrew Vagin <avagin@virtuozzo.com>
---
 drivers/net/macvlan.c | 1 +
 1 file changed, 1 insertion(+)

Patch hide | download patch | download mbox

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;
 }