Module: xenomai-3
Branch: master
Commit: 851fa778d7b2bb41a4a5eeaa55f58f70eb2698af
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=851fa778d7b2bb41a4a5eeaa55f58f70eb2698af

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Wed Sep 30 22:27:52 2015 +0200

rtnet/ip: reorder cleanup

Unregistering the packet type must be done first, in order to avoid
receiving packets during cleanup.

---

 kernel/drivers/net/stack/ipv4/af_inet.c   |    3 ++-
 kernel/drivers/net/stack/ipv4/ip_output.c |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/drivers/net/stack/ipv4/af_inet.c 
b/kernel/drivers/net/stack/ipv4/af_inet.c
index 84abbf1..3780ffd 100644
--- a/kernel/drivers/net/stack/ipv4/af_inet.c
+++ b/kernel/drivers/net/stack/ipv4/af_inet.c
@@ -342,6 +342,8 @@ static int __init rt_ipv4_proto_init(void)
 
 static void __exit rt_ipv4_proto_release(void)
 {
+    rt_ip_release();
+
     rtdev_del_event_hook(&rtdev_hook);
     rtnet_unregister_ioctls(&ipv4_ioctls);
     rt_ip_routing_release();
@@ -355,7 +357,6 @@ static void __exit rt_ipv4_proto_release(void)
 
     /* Network-Layer */
     rt_arp_release();
-    rt_ip_release();
 }
 
 
diff --git a/kernel/drivers/net/stack/ipv4/ip_output.c 
b/kernel/drivers/net/stack/ipv4/ip_output.c
index 996aae5..89ca085 100644
--- a/kernel/drivers/net/stack/ipv4/ip_output.c
+++ b/kernel/drivers/net/stack/ipv4/ip_output.c
@@ -275,10 +275,10 @@ void __init rt_ip_init(void)
  */
 void rt_ip_release(void)
 {
-    rt_ip_fragment_cleanup();
     while (rtdev_remove_pack(&ip_packet_type) == -EAGAIN) {
        printk("RTnet IP: waiting for protocol unregistration\n");
        set_current_state(TASK_UNINTERRUPTIBLE);
        schedule_timeout(1*HZ); /* wait a second */
     }
+    rt_ip_fragment_cleanup();
 }


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to