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

Henning Rogge (spam-protected)
Wed Jul 25 09:06:02 CEST 2012


On 07/24/2012 06:09 PM, Ferry Huberts wrote:
> From: Ferry Huberts <(spam-protected)>
>
> it is only used with gateway.c

This makes updating the gateway settings from a plugin more difficult, 
right? But if we ever get a plugin that needs this function, we can make 
it public again.

Henning

> 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);
>


-- 
Diplom-Informatiker Henning Rogge , Fraunhofer-Institut für
Kommunikation, Informationsverarbeitung und Ergonomie FKIE
Kommunikationssysteme (KOM)
Neuenahrer Straße 20, 53343 Wachtberg, Germany
Telefon +49 228 9435-961,   Fax +49 228 9435 685
mailto:(spam-protected) http://www.fkie.fraunhofer.de
GPG: E1C6 0914 490B 3909 D944 F80D 4487 C67C 55EC CFE0

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6169 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20120725/0f03a699/attachment.bin>


More information about the Olsr-dev mailing list