netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv6: Do cleanup for ip_mr_init
@ 2008-06-24  3:42 Wang Chen
  2008-07-02  8:49 ` Wang Chen
  2008-07-02  9:18 ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 2 replies; 8+ messages in thread
From: Wang Chen @ 2008-06-24  3:42 UTC (permalink / raw)
  To: David S. Miller; +Cc: NETDEV, YOSHIFUJI Hideaki

If do not do it, we will get following issues:
1. Leaving junks after inet6_init failing halfway.
2. Leaving proc and notifier junks after ipv6 modules unloading.

Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
---
 include/linux/mroute6.h |    1 +
 net/ipv6/af_inet6.c     |    5 +++++
 net/ipv6/ip6mr.c        |   10 ++++++++++
 3 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index e798959..05ffaac 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -136,6 +136,7 @@ extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *
 extern int ip6_mr_input(struct sk_buff *skb);
 extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg);
 extern void ip6_mr_init(void);
+extern void ip6_mr_cleanup(void);
 
 struct mif_device
 {
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index e84b3fd..15d4138 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -1061,6 +1061,9 @@ netfilter_fail:
 igmp_fail:
 	ndisc_cleanup();
 ndisc_fail:
+#ifdef CONFIG_IPV6_MROUTE
+	ip6_mr_cleanup();
+#endif
 	icmpv6_cleanup();
 icmp_fail:
 	unregister_pernet_subsys(&inet6_net_ops);
@@ -1115,7 +1118,9 @@ static void __exit inet6_exit(void)
 	ipv6_netfilter_fini();
 	igmp6_cleanup();
 	ndisc_cleanup();
+#ifdef CONFIG_IPV6_MROUTE
 	icmpv6_cleanup();
+#endif
 	rawv6_exit();
 
 	unregister_pernet_subsys(&inet6_net_ops);
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 1479618..245c350 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -973,6 +973,16 @@ void __init ip6_mr_init(void)
 #endif
 }
 
+void ip6_mr_cleanup(void)
+{
+#ifdef CONFIG_PROC_FS
+	proc_net_remove(&init_net, "ip6_mr_cache");
+	proc_net_remove(&init_net, "ip6_mr_vif");
+#endif
+	unregister_netdevice_notifier(&ip6_mr_notifier);
+	del_timer(&ipmr_expire_timer);
+	kmem_cache_destroy(mrt_cachep);
+}
 
 static int ip6mr_mfc_add(struct mf6cctl *mfc, int mrtsock)
 {
-- 
1.5.3.4



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-07-03  7:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-24  3:42 [PATCH] ipv6: Do cleanup for ip_mr_init Wang Chen
2008-07-02  8:49 ` Wang Chen
2008-07-02  9:18 ` YOSHIFUJI Hideaki / 吉藤英明
2008-07-02  9:38   ` Wang Chen
2008-07-03  4:13   ` v2 [PATCH 1/2] ipv6: Do cleanup for ip6_mr_init Wang Chen
2008-07-03  7:09     ` YOSHIFUJI Hideaki / 吉藤英明
     [not found]   ` <486C50AE.7000207@cn.fujitsu.com>
2008-07-03  4:13     ` v2 [PATCH 2/2] ipv4: Do cleanup for ip_mr_init Wang Chen
2008-07-03  7:10       ` YOSHIFUJI Hideaki / 吉藤英明

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).