diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2008-11-05 15:59:38 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-05 15:59:38 -0800 |
commit | d0c082cea6dfb9b674b4f6e1e84025662dbd24e8 (patch) | |
tree | a101a51c9158e4ed4ce335e6c68a555e631280f6 /net/core | |
parent | 270acefafeb74ce2fe93d35b75733870bf1e11e7 (diff) | |
download | op-kernel-dev-d0c082cea6dfb9b674b4f6e1e84025662dbd24e8.zip op-kernel-dev-d0c082cea6dfb9b674b4f6e1e84025662dbd24e8.tar.gz |
netns: Delete virtual interfaces during namespace cleanup
When physical devices are inside of network namespace and that
network namespace terminates we can not make them go away. We
have to keep them and moving them to the initial network namespace
is the best we can do.
For virtual devices left in a network namespace that is exiting
we have no need to preserve them and we now have the infrastructure
that allows us to delete them. So delete virtual devices when we
exit a network namespace. Keeping the necessary user space clean up
after a network namespace exits much more tractable.
Acked-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Acked-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/dev.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 8f9d3b3..9475f3e 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -4852,6 +4852,12 @@ static void __net_exit default_device_exit(struct net *net) if (dev->features & NETIF_F_NETNS_LOCAL) continue; + /* Delete virtual devices */ + if (dev->rtnl_link_ops && dev->rtnl_link_ops->dellink) { + dev->rtnl_link_ops->dellink(dev); + continue; + } + /* Push remaing network devices to init_net */ snprintf(fb_name, IFNAMSIZ, "dev%d", dev->ifindex); err = dev_change_net_namespace(dev, &init_net, fb_name); |