[Olsr-dev] [PATCH v1 14/19] gateway: push an if condition into its nested if's

Ferry Huberts (spam-protected)
Thu Aug 23 15:12:38 CEST 2012


From: Ferry Huberts <(spam-protected)>

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

diff --git a/src/gateway.c b/src/gateway.c
index 3f91cd7..5244e8f 100644
--- a/src/gateway.c
+++ b/src/gateway.c
@@ -493,15 +493,13 @@ bool olsr_set_inet_gateway(union olsr_ip_addr *originator, bool ipv4, bool ipv6)
   }
 
   entry = node2gateway(avl_find(&gateway_tree, originator));
-  if (entry != NULL) {
-    if (ipv4 && entry->ipv4 && (!entry->ipv4nat || olsr_cnf->smart_gw_allow_nat)) {
-      /* valid ipv4 gateway */
-      current_ipv4_gw = entry;
-    }
-    if (ipv6 && entry->ipv6) {
-      /* valid ipv6 gateway */
-      current_ipv6_gw = entry;
-    }
+  if (entry != NULL && ipv4 && entry->ipv4 && (!entry->ipv4nat || olsr_cnf->smart_gw_allow_nat)) {
+    /* valid ipv4 gateway */
+    current_ipv4_gw = entry;
+  }
+  if (entry != NULL && ipv6 && entry->ipv6) {
+    /* valid ipv6 gateway */
+    current_ipv6_gw = entry;
   }
 
   /* handle IPv4 */
-- 
1.7.11.4





More information about the Olsr-dev mailing list