Skip to contentSkip to conversation

ipv6: delete protocol when cleanup

PATCH Superseded Duan Jiong 4 participants 8 messages Nov 18, 2014 – Nov 19, 2014

Subsystems (3)
lore
Share & tools
lore

Duan Jiong

author
#0 lore raw

PATCH 1/1 ipv6: delete protocol when cleanup

pim6_protocol was added when initiation, but it not deleted.

---
 net/ipv6/ip6mr.c | 3 +++
 1 file changed, 3 insertions(+)
net/ipv6/ip6mr.c +3 -0
index 0171f08..6dcdecd 100644
@@ -1439,6 +1439,9 @@ reg_pernet_fail:
 
 void ip6_mr_cleanup(void)
 {
+#ifdef CONFIG_IPV6_PIMSM_V2
+	inet6_del_protocol(&pim6_protocol, IPPROTO_PIM);
+#endif
 	unregister_netdevice_notifier(&ip6_mr_notifier);
 	unregister_pernet_subsys(&ip6mr_net_ops);
 	kmem_cache_destroy(mrt_cachep);
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 13 lines · Duan Jiong

pim6_protocol was added when initiation, but it not deleted.

---
 net/ipv6/ip6mr.c | 3 +++
 1 file changed, 3 insertions(+)
net/ipv6/ip6mr.c +0 -0
index 0171f08..6dcdecd 100644

net/ipv6/ip6mr.c reg_pernet_fail: · line 1447

Quoted 9 lines
net/ipv6/ip6mr.c +3 -0
@@ -1439,6 +1439,9 @@ reg_pernet_fail:
 
 void ip6_mr_cleanup(void)
 {
+#ifdef CONFIG_IPV6_PIMSM_V2
+       inet6_del_protocol(&pim6_protocol, IPPROTO_PIM);
+#endif
        unregister_netdevice_notifier(&ip6_mr_notifier);
        unregister_pernet_subsys(&ip6mr_net_ops);
        kmem_cache_destroy(mrt_cachep);

Looks like rtnl_unregister() is missing as well.

#2 lore raw
Quoted 5 lines · Cong Wang
Quoted 4 lines · Duan Jiong

pim6_protocol was added when initiation, but it not deleted.

...

Quoted 1 line

Looks like rtnl_unregister() is missing as well.

Is it really worth bothering ?

May I remind you we took the decision one year ago to not bother about removing ipv6 module.

commit 8ce440610357b77587433d0df647cea69a6890a8

Author: Cong Wang <[email protected]>
Date:   Sat Sep 21 11:12:21 2013 +0800

ipv6: do not allow ipv6 module to be removed

There was some bug report on ipv6 module removal path before. Also, as Stephen pointed out, after vxlan module gets ipv6 support, the ipv6 stub it used is not safe against this module removal either. So, let's just remove inet6_exit() so that ipv6 module will not be able to be unloaded.

Cc Hideaki YOSHIFUJI <[email protected]>
Cc Stephen Hemminger <[email protected]>
Cc David S. Miller <[email protected]>
#3 lore raw
Quoted 7 lines · Eric Dumazet
Quoted 5 lines · Cong Wang
Quoted 4 lines · Duan Jiong

pim6_protocol was added when initiation, but it not deleted.

Quoted 9 lines

...

Quoted 1 line

Looks like rtnl_unregister() is missing as well.

Is it really worth bothering ?

May I remind you we took the decision one year ago to not bother about removing ipv6 module.

It is still called in error path of init, so just for completeness.

author
#4 lore raw
In reply to Cong Wang
Quoted 15 lines · Cong Wang
Quoted 14 lines · Duan Jiong

pim6_protocol was added when initiation, but it not deleted.

---
 net/ipv6/ip6mr.c | 3 +++
 1 file changed, 3 insertions(+)
net/ipv6/ip6mr.c +0 -0
index 0171f08..6dcdecd 100644
@@ -1439,6 +1439,9 @@ reg_pernet_fail:
 
Quoted 12 lines

net/ipv6/ip6mr.c reg_pernet_fail: · line 1447

Quoted 8 lines
net/ipv6/ip6mr.c +3 -0
 void ip6_mr_cleanup(void)
 {
+#ifdef CONFIG_IPV6_PIMSM_V2
+       inet6_del_protocol(&pim6_protocol, IPPROTO_PIM);
+#endif
        unregister_netdevice_notifier(&ip6_mr_notifier);
        unregister_pernet_subsys(&ip6mr_net_ops);
        kmem_cache_destroy(mrt_cachep);

Looks like rtnl_unregister() is missing as well.

Thanks for pointing this, i will send v2.

Thanks,
Duan

author
#5 lore raw

PATCH v2 1/1 ipv6: delete protocol and unregister rtnetlink when cleanup

In reply to Cong Wang

pim6_protocol was added when initiation, but it not deleted. Similarly, unregister RTNL_FAMILY_IP6MR rtnetlink.

---
v2: add missing rtnl_unregister()

 net/ipv6/ip6mr.c | 4 ++++
 1 file changed, 4 insertions(+)
net/ipv6/ip6mr.c +4 -0
index 0171f08..1a01d79 100644
@@ -1439,6 +1439,10 @@ reg_pernet_fail:
 
 void ip6_mr_cleanup(void)
 {
+	rtnl_unregister(RTNL_FAMILY_IP6MR, RTM_GETROUTE);
+#ifdef CONFIG_IPV6_PIMSM_V2
+	inet6_del_protocol(&pim6_protocol, IPPROTO_PIM);
+#endif
 	unregister_netdevice_notifier(&ip6_mr_notifier);
 	unregister_pernet_subsys(&ip6mr_net_ops);
 	kmem_cache_destroy(mrt_cachep);
Signature · 1 line
1.8.3.1
Reviewed-by on v2 1/1
#6 lore raw

Re: [PATCH v2] ipv6: delete protocol and unregister rtnetlink when cleanup

Quoted 8 lines · Duan Jiong

pim6_protocol was added when initiation, but it not deleted. Similarly, unregister RTNL_FAMILY_IP6MR rtnetlink.

---
v2: add missing rtnl_unregister()

maintainer Applied
#7 lore raw

Re: [PATCH v2] ipv6: delete protocol and unregister rtnetlink when cleanup

In reply to Duan Jiong

From: Duan Jiong <[email protected]>
Date: Wed, 19 Nov 2014 09:35:39 +0800

Quoted 6 lines

pim6_protocol was added when initiation, but it not deleted. Similarly, unregister RTNL_FAMILY_IP6MR rtnetlink.

---
v2: add missing rtnl_unregister()

Applied, thanks.