[Olsr-dev] [PATCH v2 7/7] gateway: walk the gateway tree to properly cleanup

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


From: Ferry Huberts <(spam-protected)>

No need to explicitly remove the tunnels, since these are
removed by the olsr_delete_gateway_entry function.

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

diff --git a/src/gateway.c b/src/gateway.c
index 993122a..cd9ee33 100644
--- a/src/gateway.c
+++ b/src/gateway.c
@@ -187,15 +187,14 @@ int olsr_init_gateways(void) {
  * Cleanup gateway tunnel system
  */
 void olsr_cleanup_gateways(void) {
+  struct avl_node * avlnode = NULL;
+
   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);
-  }
-  if (current_ipv6_gw) {
-    olsr_os_del_ipip_tunnel(v6gw_tunnel);
+  while ((avlnode = avl_walk_first(&gateway_tree))) {
+    olsr_delete_gateway_tree_entry(node2gateway(avlnode), FORCE_DELETE_GW_ENTRY, true);
   }
 
   assert(gw_handler);
-- 
1.7.11.7





More information about the Olsr-dev mailing list