gateway: cleanup the server tunnel later
authorFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 9 Jan 2013 10:53:49 +0000 (11:53 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 9 Jan 2013 11:10:50 +0000 (12:10 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
src/gateway.c

index 9bb4028..058794a 100644 (file)
@@ -569,8 +569,6 @@ void olsr_cleanup_gateways(void) {
 
   olsr_remove_ifchange_handler(smartgw_tunnel_monitor);
 
-  olsr_os_cleanup_iptunnel(server_tunnel_name());
-
   /* remove all gateways in the gateway tree that are not the active gateway */
   while ((avlnode = avl_walk_first(&gateway_tree))) {
     struct gateway_entry* tree_gw = node2gateway(avlnode);
@@ -600,6 +598,8 @@ void olsr_cleanup_gateways(void) {
   assert(!current_ipv4_gw);
   assert(!current_ipv6_gw);
 
+  olsr_os_cleanup_iptunnel(server_tunnel_name());
+
   assert(gw_handler);
   gw_handler->cleanup();
   gw_handler = NULL;