[Olsr-dev] [RFC] [PATCH v1 3/7] gateway: add path_cost to 'set gateway' interface
Ferry Huberts
(spam-protected)
Tue Nov 13 11:32:57 CET 2012
From: Ferry Huberts <(spam-protected)>
We need it when we are going to keep the active gateway(s) in a list
Signed-off-by: Ferry Huberts <(spam-protected)>
---
src/gateway.c | 3 ++-
src/gateway.h | 2 +-
src/gateway_default_handler.c | 4 ++--
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/gateway.c b/src/gateway.c
index 2fdaf9d..27b9341 100644
--- a/src/gateway.c
+++ b/src/gateway.c
@@ -535,11 +535,12 @@ void olsr_trigger_gatewayloss_check(void) {
* Sets a new internet gateway.
*
* @param originator ip address of the node with the new gateway
+ * @param path_cost the path cost
* @param ipv4 set ipv4 gateway
* @param ipv6 set ipv6 gateway
* @return true if an error happened, false otherwise
*/
-bool olsr_set_inet_gateway(union olsr_ip_addr *originator, bool ipv4, bool ipv6) {
+bool olsr_set_inet_gateway(union olsr_ip_addr *originator, uint64_t path_cost __attribute__((unused)), bool ipv4, bool ipv6) {
struct gateway_entry *new_gw;
ipv4 = ipv4 && (olsr_cnf->ip_version == AF_INET || olsr_cnf->use_niit);
diff --git a/src/gateway.h b/src/gateway.h
index 385a48e..5643884 100644
--- a/src/gateway.h
+++ b/src/gateway.h
@@ -163,7 +163,7 @@ void olsr_trigger_gatewayloss_check(void);
* Gateway Plugin Functions
*/
-bool olsr_set_inet_gateway(union olsr_ip_addr *originator, bool ipv4, bool ipv6);
+bool olsr_set_inet_gateway(union olsr_ip_addr *originator, uint64_t path_cost, bool ipv4, bool ipv6);
struct gateway_entry *olsr_get_inet_gateway(bool ipv6);
#endif /* GATEWAY_H_ */
diff --git a/src/gateway_default_handler.c b/src/gateway_default_handler.c
index 62e0d77..1d683f4 100644
--- a/src/gateway_default_handler.c
+++ b/src/gateway_default_handler.c
@@ -233,11 +233,11 @@ static void gw_default_choose_gateway(void) {
if (inet_ipv4) {
/* we are dealing with an IPv4 or dual stack gateway */
- olsr_set_inet_gateway(&inet_ipv4->originator, true, dual);
+ olsr_set_inet_gateway(&inet_ipv4->originator, cost_ipv4, true, dual);
}
if (inet_ipv6 && !dual) {
/* we are dealing with an IPv6-only gateway */
- olsr_set_inet_gateway(&inet_ipv6->originator, false, true);
+ olsr_set_inet_gateway(&inet_ipv6->originator, cost_ipv6, false, true);
}
if ((olsr_cnf->smart_gw_thresh == 0) && gw_def_finished_ipv4 && gw_def_finished_ipv6) {
--
1.7.11.7
More information about the Olsr-dev
mailing list