[Olsr-dev] [olsrd] [PATCH v1 13/29] gateway: make refresh_smartgw_netmask static

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


From: Ferry Huberts <(spam-protected)>

it is only used with gateway.c

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 src/gateway.c |   48 ++++++++++++++++++++++++------------------------
 src/gateway.h |    1 -
 2 files changed, 24 insertions(+), 25 deletions(-)

diff --git a/src/gateway.c b/src/gateway.c
index 3fc5bca..a5dfec6 100644
--- a/src/gateway.c
+++ b/src/gateway.c
@@ -91,6 +91,30 @@ static void smartgw_tunnel_monitor (int if_index __attribute__ ((unused)),
   return;
 }
 
+static void refresh_smartgw_netmask(void) {
+  uint8_t *ip;
+  memset(&smart_gateway_netmask, 0, sizeof(smart_gateway_netmask));
+
+  if (olsr_cnf->smart_gw_active) {
+    union olsr_ip_addr gw_net;
+    memset(&gw_net, 0, sizeof(gw_net));
+
+    ip = (uint8_t *) &smart_gateway_netmask;
+
+    if (olsr_cnf->smart_gw_uplink > 0 && olsr_cnf->smart_gw_downlink > 0) {
+      /* the link is bi-directional with a non-zero bandwidth */
+      ip[GW_HNA_FLAGS] |= GW_HNA_FLAG_LINKSPEED;
+      ip[GW_HNA_DOWNLINK] = serialize_gw_speed(olsr_cnf->smart_gw_downlink);
+      ip[GW_HNA_UPLINK] = serialize_gw_speed(olsr_cnf->smart_gw_uplink);
+    }
+    if (olsr_cnf->ip_version == AF_INET6 && olsr_cnf->smart_gw_prefix.prefix_len > 0) {
+      ip[GW_HNA_FLAGS] |= GW_HNA_FLAG_IPV6PREFIX;
+      ip[GW_HNA_V6PREFIXLEN] = olsr_cnf->smart_gw_prefix.prefix_len;
+      memcpy(&ip[GW_HNA_V6PREFIX], &olsr_cnf->smart_gw_prefix.prefix, 8);
+    }
+  }
+}
+
 /**
  * Initialize gateway system
  */
@@ -122,30 +146,6 @@ olsr_init_gateways(void) {
   return 0;
 }
 
-void refresh_smartgw_netmask(void) {
-  uint8_t *ip;
-  memset(&smart_gateway_netmask, 0, sizeof(smart_gateway_netmask));
-
-  if (olsr_cnf->smart_gw_active) {
-    union olsr_ip_addr gw_net;
-    memset(&gw_net, 0, sizeof(gw_net));
-
-    ip = (uint8_t *) &smart_gateway_netmask;
-
-    if (olsr_cnf->smart_gw_uplink > 0 && olsr_cnf->smart_gw_downlink > 0) {
-      /* the link is bi-directional with a non-zero bandwidth */
-      ip[GW_HNA_FLAGS] |= GW_HNA_FLAG_LINKSPEED;
-      ip[GW_HNA_DOWNLINK] = serialize_gw_speed(olsr_cnf->smart_gw_downlink);
-      ip[GW_HNA_UPLINK] = serialize_gw_speed(olsr_cnf->smart_gw_uplink);
-    }
-    if (olsr_cnf->ip_version == AF_INET6 && olsr_cnf->smart_gw_prefix.prefix_len > 0) {
-      ip[GW_HNA_FLAGS] |= GW_HNA_FLAG_IPV6PREFIX;
-      ip[GW_HNA_V6PREFIXLEN] = olsr_cnf->smart_gw_prefix.prefix_len;
-      memcpy(&ip[GW_HNA_V6PREFIX], &olsr_cnf->smart_gw_prefix.prefix, 8);
-    }
-  }
-}
-
 /**
  * Cleanup gateway tunnel system
  */
diff --git a/src/gateway.h b/src/gateway.h
index 727b3bd..9f554f1 100644
--- a/src/gateway.h
+++ b/src/gateway.h
@@ -67,7 +67,6 @@ extern struct avl_tree gateway_tree;
 
 int olsr_init_gateways(void);
 void olsr_cleanup_gateways(void);
-void refresh_smartgw_netmask(void);
 void olsr_trigger_inetgw_startup(void);
 int olsr_trigger_inetgw_selection(bool ipv4, bool ipv6);
 void olsr_trigger_gatewayloss_check(void);
-- 
1.7.10.4





More information about the Olsr-dev mailing list