From b9f9f37fb7a85dbe58a260f6e1b745a17db66dd5 Mon Sep 17 00:00:00 2001 From: Justin Pettit Date: Tue, 20 Apr 2010 22:46:04 -0700 Subject: [PATCH] veth: Do a better job cleaning up on rmmod The veth driver doesn't clean itself up very well when removed. This commit destroys any outstanding veth devices and then unregisters its sysfs entry. --- datapath/linux-2.6/compat-2.6/veth.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/datapath/linux-2.6/compat-2.6/veth.c b/datapath/linux-2.6/compat-2.6/veth.c index 66aae0b9..26d8dd91 100644 --- a/datapath/linux-2.6/compat-2.6/veth.c +++ b/datapath/linux-2.6/compat-2.6/veth.c @@ -526,7 +526,17 @@ static __init int veth_init(void) static __exit void veth_exit(void) { + struct veth_priv *p, *n; + + rtnl_lock(); + + list_for_each_entry_safe(p, n, &veth_list, list) + veth_dellink(p->dev); + + rtnl_unlock(); + unregister_netdevice_notifier(&veth_notifier_block); + veth_destroy_sysfs(); } module_init(veth_init); -- 2.30.2