gateway: move refresh_smartgw_netmask to exported functions section
authorFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 21 Aug 2012 13:02:14 +0000 (15:02 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Tue, 21 Aug 2012 13:06:59 +0000 (15:06 +0200)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
src/gateway.c

index 181dd69..d308459 100644 (file)
@@ -129,30 +129,6 @@ static void smartgw_tunnel_monitor (int if_index __attribute__ ((unused)),
 }
 
 /**
- * Setup the gateway netmask
- */
-void refresh_smartgw_netmask(void) {
-  uint8_t *ip;
-  memset(&smart_gateway_netmask, 0, sizeof(smart_gateway_netmask));
-
-  if (olsr_cnf->smart_gw_active) {
-    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);
-    }
-  }
-}
-
-/**
  * Triggers an instant gateway selection based on the current data
  *
  * @param ipv4 trigger a ipv4 gateway lookup
@@ -199,6 +175,30 @@ static void cleanup_gateway_handler(void *ptr) {
  */
 
 /**
+ * Setup the gateway netmask
+ */
+void refresh_smartgw_netmask(void) {
+  uint8_t *ip;
+  memset(&smart_gateway_netmask, 0, sizeof(smart_gateway_netmask));
+
+  if (olsr_cnf->smart_gw_active) {
+    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
  */
 int