[Olsr-dev] [PATCH v2 3/7] gateway: ensure cleanup uses the reverse order of init

Ferry Huberts (spam-protected)
Thu Oct 18 11:50:39 CEST 2012


From: Ferry Huberts <(spam-protected)>

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 src/gateway.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gateway.c b/src/gateway.c
index 10e1b9f..d8c2fb2 100644
--- a/src/gateway.c
+++ b/src/gateway.c
@@ -181,6 +181,10 @@ int olsr_init_gateways(void) {
  * Cleanup gateway tunnel system
  */
 void olsr_cleanup_gateways(void) {
+  olsr_remove_ifchange_handler(smartgw_tunnel_monitor);
+
+  olsr_os_cleanup_iptunnel(olsr_cnf->ip_version == AF_INET ? TUNNEL_ENDPOINT_IF : TUNNEL_ENDPOINT_IF6);
+
   if (current_ipv4_gw) {
     olsr_os_del_ipip_tunnel(v4gw_tunnel);
   }
@@ -188,14 +192,10 @@ void olsr_cleanup_gateways(void) {
     olsr_os_del_ipip_tunnel(v6gw_tunnel);
   }
 
-  olsr_remove_ifchange_handler(smartgw_tunnel_monitor);
-
   assert(gw_handler);
   gw_handler->cleanup();
   gw_handler = NULL;
 
-  olsr_os_cleanup_iptunnel(olsr_cnf->ip_version == AF_INET ? TUNNEL_ENDPOINT_IF : TUNNEL_ENDPOINT_IF6);
-
   olsr_free_cookie(gw_mem_cookie);
 }
 
-- 
1.7.11.7





More information about the Olsr-dev mailing list