Remove gateway if HNA 0/0 or originators TC is removed
authorHenning Rogge <hrogge@googlemail.com>
Wed, 6 Jan 2010 20:51:14 +0000 (21:51 +0100)
committerHenning Rogge <hrogge@googlemail.com>
Wed, 6 Jan 2010 20:51:14 +0000 (21:51 +0100)
src/hna_set.c
src/tc_set.c

index 97317da..f68c75a 100644 (file)
@@ -248,7 +248,12 @@ olsr_delete_hna_net_entry(struct hna_net *net_to_delete) {
 static void
 olsr_expire_hna_net_entry(void *context)
 {
-  olsr_delete_hna_net_entry(context);
+  struct hna_net *net = context;
+  olsr_delete_hna_net_entry(net);
+  if (net->prefixlen == 0) {
+    /* remove gateway if HNA 0/0 times out */
+    olsr_delete_gateway(&net->hna_gw->A_gateway_addr);
+  }
 }
 
 /**
index c227955..9cf22a0 100644 (file)
@@ -53,6 +53,7 @@
 #include "lq_plugin.h"
 #include "olsr_cookie.h"
 #include "duplicate_set.h"
+#include "gateway.h"
 
 #include <assert.h>
 
@@ -284,6 +285,9 @@ olsr_delete_tc_entry(struct tc_entry *tc)
   OLSR_PRINTF(1, "TC: del entry %s\n", olsr_ip_to_string(&buf, &tc->addr));
 #endif
 
+  /* delete gateway if available */
+  olsr_delete_gateway(&tc->addr);
+
   /*
    * Delete the rt_path for ourselves.
    */