[Olsr-dev] [PATCH v1 20/23] gateway: setup and clear table specific default routes in/for multi-gateway mode

Ferry Huberts (spam-protected)
Tue Dec 4 16:17:27 CET 2012


From: Ferry Huberts <(spam-protected)>

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

diff --git a/src/gateway.c b/src/gateway.c
index 34cab79..6a43361 100644
--- a/src/gateway.c
+++ b/src/gateway.c
@@ -648,6 +648,10 @@ static void olsr_delete_gateway_tree_entry(struct gateway_entry * gw, uint8_t pr
         }
 
         if (gw_in_list->tunnel) {
+          struct interfaceName * ifn = find_interfaceName(gw_in_list->gw);
+          if (ifn) {
+            olsr_os_inetgw_tunnel_route(gw_in_list->tunnel->if_index, true, false, &ifn->mark);
+          }
           olsr_os_del_ipip_tunnel(gw_in_list->tunnel);
           set_unused_iptunnel_name(gw_in_list->gw);
           gw_in_list->tunnel = NULL;
@@ -666,6 +670,10 @@ static void olsr_delete_gateway_tree_entry(struct gateway_entry * gw, uint8_t pr
         }
 
         if (gw_in_list->tunnel) {
+          struct interfaceName * ifn = find_interfaceName(gw_in_list->gw);
+          if (ifn) {
+            olsr_os_inetgw_tunnel_route(gw_in_list->tunnel->if_index, false, false, &ifn->mark);
+          }
           olsr_os_del_ipip_tunnel(gw_in_list->tunnel);
           set_unused_iptunnel_name(gw_in_list->gw);
           gw_in_list->tunnel = NULL;
@@ -769,6 +777,10 @@ bool olsr_set_inet_gateway(union olsr_ip_addr *originator, uint64_t path_cost, b
         assert(worst);
 
         if (worst->tunnel) {
+          struct interfaceName * ifn = find_interfaceName(worst->gw);
+          if (ifn) {
+            olsr_os_inetgw_tunnel_route(worst->tunnel->if_index, true, false, &ifn->mark);
+          }
           olsr_os_del_ipip_tunnel(worst->tunnel);
           set_unused_iptunnel_name(worst->gw);
           worst->tunnel = NULL;
@@ -780,6 +792,9 @@ bool olsr_set_inet_gateway(union olsr_ip_addr *originator, uint64_t path_cost, b
       get_unused_iptunnel_name(new_gw, name, &interfaceName);
       new_v4gw_tunnel = olsr_os_add_ipip_tunnel(&new_gw->originator, true, name);
       if (new_v4gw_tunnel) {
+        if (interfaceName) {
+          olsr_os_inetgw_tunnel_route(new_v4gw_tunnel->if_index, true, true, &interfaceName->mark);
+        }
         olsr_os_inetgw_tunnel_route(new_v4gw_tunnel->if_index, true, true, NULL);
 
         new_gw_in_list = olsr_cookie_malloc(gw_container_entry_mem_cookie);
@@ -817,6 +832,10 @@ bool olsr_set_inet_gateway(union olsr_ip_addr *originator, uint64_t path_cost, b
         assert(worst);
 
         if (worst->tunnel) {
+          struct interfaceName * ifn = find_interfaceName(worst->gw);
+          if (ifn) {
+            olsr_os_inetgw_tunnel_route(worst->tunnel->if_index, false, false, &ifn->mark);
+          }
           olsr_os_del_ipip_tunnel(worst->tunnel);
           set_unused_iptunnel_name(worst->gw);
           worst->tunnel = NULL;
@@ -828,6 +847,9 @@ bool olsr_set_inet_gateway(union olsr_ip_addr *originator, uint64_t path_cost, b
       get_unused_iptunnel_name(new_gw, name, &interfaceName);
       new_v6gw_tunnel = olsr_os_add_ipip_tunnel(&new_gw->originator, false, name);
       if (new_v6gw_tunnel) {
+        if (interfaceName) {
+          olsr_os_inetgw_tunnel_route(new_v6gw_tunnel->if_index, false, true, &interfaceName->mark);
+        }
         olsr_os_inetgw_tunnel_route(new_v6gw_tunnel->if_index, false, true, NULL);
 
         new_gw_in_list = olsr_cookie_malloc(gw_container_entry_mem_cookie);
-- 
1.7.11.7





More information about the Olsr-dev mailing list