[Olsr-dev] [olsrd] [PATCH v1 25/29] gateway: minor simplification to olsr_trigger_gatewayloss_check

Ferry Huberts (spam-protected)
Tue Jul 24 18:09:14 CEST 2012


From: Ferry Huberts <(spam-protected)>

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

diff --git a/src/gateway.c b/src/gateway.c
index 2ca3c00..bcbcd23 100644
--- a/src/gateway.c
+++ b/src/gateway.c
@@ -256,20 +256,18 @@ olsr_trigger_inetgw_startup(void) {
  * ETX = infinity
  */
 void olsr_trigger_gatewayloss_check(void) {
-  struct tc_entry *tc;
-  bool ipv4 = false, ipv6 = false;
+  bool ipv4 = false;
+  bool ipv6 = false;
+
   if (current_ipv4_gw) {
-    tc = olsr_lookup_tc_entry(&current_ipv4_gw->originator);
-    if (tc == NULL || tc->path_cost == ROUTE_COST_BROKEN) {
-      ipv4 = true;
-    }
+	struct tc_entry *tc = olsr_lookup_tc_entry(&current_ipv4_gw->originator);
+	ipv4 = (tc == NULL || tc->path_cost == ROUTE_COST_BROKEN);
   }
   if (current_ipv6_gw) {
-    tc = olsr_lookup_tc_entry(&current_ipv6_gw->originator);
-    if (tc == NULL || tc->path_cost == ROUTE_COST_BROKEN) {
-      ipv6 = true;
-    }
+	struct tc_entry *tc = olsr_lookup_tc_entry(&current_ipv6_gw->originator);
+	ipv6 = (tc == NULL || tc->path_cost == ROUTE_COST_BROKEN);
   }
+
   if (ipv4 || ipv6) {
     olsr_trigger_inetgw_selection(ipv4, ipv6);
   }
-- 
1.7.10.4





More information about the Olsr-dev mailing list