* [PATCH] netns: Delete virtual interfaces during namespace cleanup
@ 2008-07-11 20:07 Eric W. Biederman
0 siblings, 0 replies; only message in thread
From: Eric W. Biederman @ 2008-07-11 20:07 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Linux Containers
When physical devices are inside of network namespace and that network
namespace terminates 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.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
---
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 ea480a4..670abad 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4492,6 +4492,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);
--
1.5.3.rc6.17.g1911
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-07-11 20:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-11 20:07 [PATCH] netns: Delete virtual interfaces during namespace cleanup Eric W. Biederman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).