gateway: minor simplification to olsr_trigger_gatewayloss_check
authorFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 24 Jul 2012 15:32:17 +0000 (17:32 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 25 Jul 2012 06:55:06 +0000 (08:55 +0200)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
src/gateway.c

index 114fbe6..a29dfd3 100644 (file)
@@ -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);
   }