kernel_route: olsr_os_inetgw_tunnel_route now needs the table explicitly
authorFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 13 Dec 2012 12:30:42 +0000 (13:30 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Thu, 13 Dec 2012 12:30:42 +0000 (13:30 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Reviewed-by: Henning Rogge <hrogge@googlemail.com>
src/bsd/dummy.c
src/gateway.c
src/kernel_routes.h
src/linux/kernel_routes_nl.c
src/win32/dummy.c

index 3ce9e80..d1aca7e 100644 (file)
@@ -50,7 +50,7 @@ void olsr_os_niit_6to4_route(const struct olsr_ip_prefix *dst_v6 __attribute__ (
 void olsr_os_inetgw_tunnel_route(uint32_t if_idx __attribute__ ((unused)),
     bool ipv4 __attribute__ ((unused)),
     bool set __attribute__ ((unused)),
-    uint8_t table __attribute__ ((unused))) {
+    uint8_t table __attribute__ ((unused))) {
 }
 
 int olsr_os_policy_rule(int family __attribute__ ((unused)),
index b1990e6..6106df2 100644 (file)
@@ -882,14 +882,14 @@ static void olsr_delete_gateway_tree_entry(struct gateway_entry * gw, uint8_t pr
       gw_in_list = olsr_gw_list_find(&gw_list_ipv4, gw);
       if (gw_in_list) {
         if (current_ipv4_gw && current_ipv4_gw->gw == gw) {
-          olsr_os_inetgw_tunnel_route(current_ipv4_gw->tunnel->if_index, true, false, NULL);
+          olsr_os_inetgw_tunnel_route(current_ipv4_gw->tunnel->if_index, true, false, olsr_cnf->rt_table_tunnel);
           current_ipv4_gw = NULL;
         }
 
         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_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);
@@ -904,14 +904,14 @@ static void olsr_delete_gateway_tree_entry(struct gateway_entry * gw, uint8_t pr
       gw_in_list = olsr_gw_list_find(&gw_list_ipv6, gw);
       if (gw_in_list) {
         if (current_ipv6_gw && current_ipv6_gw->gw == gw) {
-          olsr_os_inetgw_tunnel_route(current_ipv6_gw->tunnel->if_index, false, false, NULL);
+          olsr_os_inetgw_tunnel_route(current_ipv6_gw->tunnel->if_index, false, false, olsr_cnf->rt_table_tunnel);
           current_ipv6_gw = NULL;
         }
 
         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_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);
@@ -1002,7 +1002,7 @@ bool olsr_set_inet_gateway(union olsr_ip_addr *originator, uint64_t path_cost, b
     if (new_gw_in_list) {
       /* new gw is already in the gw list */
       assert(new_gw_in_list->tunnel);
-      olsr_os_inetgw_tunnel_route(new_gw_in_list->tunnel->if_index, true, true, NULL);
+      olsr_os_inetgw_tunnel_route(new_gw_in_list->tunnel->if_index, true, true, olsr_cnf->rt_table_tunnel);
       current_ipv4_gw = olsr_gw_list_update(&gw_list_ipv4, new_gw_in_list, path_cost);
     } else {
       /* new gw is not yet in the gw list */
@@ -1018,7 +1018,7 @@ bool olsr_set_inet_gateway(union olsr_ip_addr *originator, uint64_t path_cost, b
         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_inetgw_tunnel_route(worst->tunnel->if_index, true, false, ifn->mark);
           }
           olsr_os_del_ipip_tunnel(worst->tunnel);
           set_unused_iptunnel_name(worst->gw);
@@ -1032,9 +1032,9 @@ bool olsr_set_inet_gateway(union olsr_ip_addr *originator, uint64_t path_cost, b
       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, interfaceName->mark);
         }
-        olsr_os_inetgw_tunnel_route(new_v4gw_tunnel->if_index, true, true, NULL);
+        olsr_os_inetgw_tunnel_route(new_v4gw_tunnel->if_index, true, true, olsr_cnf->rt_table_tunnel);
 
         new_gw_in_list = olsr_cookie_malloc(gw_container_entry_mem_cookie);
         new_gw_in_list->gw = new_gw;
@@ -1057,7 +1057,7 @@ bool olsr_set_inet_gateway(union olsr_ip_addr *originator, uint64_t path_cost, b
     if (new_gw_in_list) {
       /* new gw is already in the gw list */
       assert(new_gw_in_list->tunnel);
-      olsr_os_inetgw_tunnel_route(new_gw_in_list->tunnel->if_index, true, true, NULL);
+      olsr_os_inetgw_tunnel_route(new_gw_in_list->tunnel->if_index, true, true, olsr_cnf->rt_table_tunnel);
       current_ipv6_gw = olsr_gw_list_update(&gw_list_ipv6, new_gw_in_list, path_cost);
     } else {
       /* new gw is not yet in the gw list */
@@ -1073,7 +1073,7 @@ bool olsr_set_inet_gateway(union olsr_ip_addr *originator, uint64_t path_cost, b
         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_inetgw_tunnel_route(worst->tunnel->if_index, false, false, ifn->mark);
           }
           olsr_os_del_ipip_tunnel(worst->tunnel);
           set_unused_iptunnel_name(worst->gw);
@@ -1087,9 +1087,9 @@ bool olsr_set_inet_gateway(union olsr_ip_addr *originator, uint64_t path_cost, b
       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, interfaceName->mark);
         }
-        olsr_os_inetgw_tunnel_route(new_v6gw_tunnel->if_index, false, true, NULL);
+        olsr_os_inetgw_tunnel_route(new_v6gw_tunnel->if_index, false, true, olsr_cnf->rt_table_tunnel);
 
         new_gw_in_list = olsr_cookie_malloc(gw_container_entry_mem_cookie);
         new_gw_in_list->gw = new_gw;
index c9bf9ae..10e7eca 100644 (file)
@@ -59,7 +59,7 @@ int rtnetlink_register_socket(int);
 
 void olsr_os_niit_4to6_route(const struct olsr_ip_prefix *dst_v4, bool set);
 void olsr_os_niit_6to4_route(const struct olsr_ip_prefix *dst_v6, bool set);
-void olsr_os_inetgw_tunnel_route(uint32_t if_idx, bool ipv4, bool set, uint8_t table);
+void olsr_os_inetgw_tunnel_route(uint32_t if_idx, bool ipv4, bool set, uint8_t table);
 
 int olsr_os_policy_rule(int family, int rttable, uint32_t priority, const char *if_name, bool set);
 int olsr_os_localhost_if(union olsr_ip_addr *ip, bool create);
index c8abaf0..4bf2210 100644 (file)
@@ -466,14 +466,14 @@ void olsr_os_niit_4to6_route(const struct olsr_ip_prefix *dst_v4, bool set) {
   }
 }
 
-void olsr_os_inetgw_tunnel_route(uint32_t if_idx, bool ipv4, bool set, uint8_t table) {
+void olsr_os_inetgw_tunnel_route(uint32_t if_idx, bool ipv4, bool set, uint8_t table) {
   const struct olsr_ip_prefix *dst;
 
   assert(olsr_cnf->ip_version == AF_INET6 || ipv4);
 
   dst = ipv4 ? &ipv4_internet_route : &ipv6_internet_route;
 
-  if (olsr_new_netlink_route(ipv4 ? AF_INET : AF_INET6, table ? *table : olsr_cnf->rt_table_tunnel,
+  if (olsr_new_netlink_route(ipv4 ? AF_INET : AF_INET6, table,
       if_idx, RT_METRIC_DEFAULT, olsr_cnf->rt_proto, NULL, NULL, dst, set, false)) {
     olsr_syslog(OLSR_LOG_ERR, ". error while %s inetgw tunnel route to %s for if %d",
         set ? "setting" : "removing", olsr_ip_prefix_to_string(dst), if_idx);
index bbf3ed9..29e2675 100644 (file)
@@ -46,7 +46,7 @@ void olsr_os_niit_6to4_route(const struct olsr_ip_prefix *dst_v6 __attribute__ (
 void olsr_os_inetgw_tunnel_route(uint32_t if_idx __attribute__ ((unused)),
     bool ipv4 __attribute__ ((unused)),
     bool set __attribute__ ((unused)),
-    uint8_t table __attribute__ ((unused))) {
+    uint8_t table __attribute__ ((unused))) {
 }
 
 int olsr_os_policy_rule(int family __attribute__ ((unused)),