[Olsr-dev] [PATCH v1 09/23] kernel_route: olsr_os_inetgw_tunnel_route can now take the table
Ferry Huberts
(spam-protected)
Tue Dec 4 16:17:16 CET 2012
From: Ferry Huberts <(spam-protected)>
as an optional parameter.
Signed-off-by: Ferry Huberts <(spam-protected)>
---
src/bsd/dummy.c | 3 ++-
src/gateway.c | 12 ++++++------
src/kernel_routes.h | 2 +-
src/linux/kernel_routes_nl.c | 4 ++--
src/win32/dummy.c | 3 ++-
5 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/src/bsd/dummy.c b/src/bsd/dummy.c
index 114d19b..e619362 100644
--- a/src/bsd/dummy.c
+++ b/src/bsd/dummy.c
@@ -49,7 +49,8 @@ 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))) {
+ bool set __attribute__ ((unused)),
+ uint8_t * table __attribute__ ((unused))) {
}
int olsr_os_policy_rule(int family __attribute__ ((unused)),
diff --git a/src/gateway.c b/src/gateway.c
index d16d8dd..e58e66a 100644
--- a/src/gateway.c
+++ b/src/gateway.c
@@ -498,7 +498,7 @@ 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);
+ olsr_os_inetgw_tunnel_route(current_ipv4_gw->tunnel->if_index, true, false, NULL);
current_ipv4_gw = NULL;
}
@@ -515,7 +515,7 @@ 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);
+ olsr_os_inetgw_tunnel_route(current_ipv6_gw->tunnel->if_index, false, false, NULL);
current_ipv6_gw = NULL;
}
@@ -608,13 +608,13 @@ 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);
+ olsr_os_inetgw_tunnel_route(new_gw_in_list->tunnel->if_index, true, true, NULL);
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 */
struct olsr_iptunnel_entry *new_v4gw_tunnel = olsr_os_add_ipip_tunnel(&new_gw->originator, true);
if (new_v4gw_tunnel) {
- olsr_os_inetgw_tunnel_route(new_v4gw_tunnel->if_index, true, true);
+ olsr_os_inetgw_tunnel_route(new_v4gw_tunnel->if_index, true, true, NULL);
if (olsr_gw_list_full(&gw_list_ipv4)) {
/* the list is full: remove the worst active gateway */
@@ -649,13 +649,13 @@ 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);
+ olsr_os_inetgw_tunnel_route(new_gw_in_list->tunnel->if_index, true, true, NULL);
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 */
struct olsr_iptunnel_entry *new_v6gw_tunnel = olsr_os_add_ipip_tunnel(&new_gw->originator, false);
if (new_v6gw_tunnel) {
- olsr_os_inetgw_tunnel_route(new_v6gw_tunnel->if_index, false, true);
+ olsr_os_inetgw_tunnel_route(new_v6gw_tunnel->if_index, false, true, NULL);
if (olsr_gw_list_full(&gw_list_ipv6)) {
/* the list is full: remove the worst active gateway */
diff --git a/src/kernel_routes.h b/src/kernel_routes.h
index 6c7a9e7..96da3af 100644
--- a/src/kernel_routes.h
+++ b/src/kernel_routes.h
@@ -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);
+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);
diff --git a/src/linux/kernel_routes_nl.c b/src/linux/kernel_routes_nl.c
index f59cb59..493c627 100644
--- a/src/linux/kernel_routes_nl.c
+++ b/src/linux/kernel_routes_nl.c
@@ -464,14 +464,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) {
+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, olsr_cnf->rt_table_tunnel,
+ if (olsr_new_netlink_route(ipv4 ? AF_INET : AF_INET6, table ? *table : olsr_cnf->rt_table_tunnel,
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);
diff --git a/src/win32/dummy.c b/src/win32/dummy.c
index 63d7890..3b655a6 100644
--- a/src/win32/dummy.c
+++ b/src/win32/dummy.c
@@ -45,7 +45,8 @@ 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))) {
+ bool set __attribute__ ((unused)),
+ uint8_t * table __attribute__ ((unused))) {
}
int olsr_os_policy_rule(int family __attribute__ ((unused)),
--
1.7.11.7
More information about the Olsr-dev
mailing list