Hi and thanks for reviewing this patch,

On 16/08/17 20:41, Steffan Karger wrote:
> Hi,
> 
> On 16-08-17 13:46, Antonio Quartulli wrote:
>> From: Antonio Quartulli <anto...@openvpn.net>
>>
>> Although this patch adds more ifdefs, this is an easy
>> fix towards a no-warning-build process.
>>
>> A proper cleanup should be carried out later on route.c.
> 
> Even though the #ifdefs are ugly,  Given the perspective of a cleanup I
> think this is worth it.  I'd love to make at least travis compile with
> --enable-werror and yell when we add new warnings for linux.

Yeah, that's my goal as well. Although we still have a warning about a
deprecated LZ4 function to fix before being able to use -Werror.
(patches to fix this warning have been sent by David but are waiting for
review).

> 
>> Signed-off-by: Antonio Quartulli <anto...@openvpn.net>
>> ---
>> v2:
>> - add commit message
>> - fix warning about another unused variable when --enable-iproute2 is 
>> selected
>> v3:
>> - don't write into (now) removed variables
>>
>>
>>  src/openvpn/route.c | 12 ++++++++++++
>>  1 file changed, 12 insertions(+)
>>
>> diff --git a/src/openvpn/route.c b/src/openvpn/route.c
>> index 1d8bb001..081cfec0 100644
>> --- a/src/openvpn/route.c
>> +++ b/src/openvpn/route.c
>> @@ -1530,7 +1530,9 @@ add_route(struct route_ipv4 *r,
>>      struct gc_arena gc;
>>      struct argv argv = argv_new();
>>      const char *network;
>> +#ifndef ENABLE_IPROUTE
>>      const char *netmask;
>> +#endif
> 
> Even though probably nobody but Gert will notice, this technically needs
> to be "#if !defined(ENABLE_IPROUTE) && !defined(TARGET_AIX)".

Right, I just checked and I saw that in AIX we directly convert to
netbits without using a netmask string. Thanks!

> 
>>      const char *gateway;
>>      bool status = false;
>>      int is_local_route;
>> @@ -1543,7 +1545,9 @@ add_route(struct route_ipv4 *r,
>>      gc_init(&gc);
>>  
>>      network = print_in_addr_t(r->network, 0, &gc);
>> +#ifndef ENABLE_IPROUTE
>>      netmask = print_in_addr_t(r->netmask, 0, &gc);
>> +#endif
>>      gateway = print_in_addr_t(r->gateway, 0, &gc);
>>  
>>      is_local_route = local_route(r->network, r->netmask, r->gateway, rgi);
>> @@ -2132,8 +2136,12 @@ delete_route(struct route_ipv4 *r,
>>      struct gc_arena gc;
>>      struct argv argv = argv_new();
>>      const char *network;
>> +#ifndef ENABLE_IPROUTE
>>      const char *netmask;
>> +#endif
> 
> As above, "#if !defined(ENABLE_IPROUTE) && !defined(TARGET_AIX)".

ditto.

> 
>> +#if !defined(TARGET_LINUX) && !defined(TARGET_ANDROID)
>>      const char *gateway;
>> +#endif
>>      int is_local_route;
>>  
>>      if ((r->flags & (RT_DEFINED|RT_ADDED)) != (RT_DEFINED|RT_ADDED))
>> @@ -2144,8 +2152,12 @@ delete_route(struct route_ipv4 *r,
>>      gc_init(&gc);
>>  
>>      network = print_in_addr_t(r->network, 0, &gc);
>> +#ifndef ENABLE_IPROUTE
>>      netmask = print_in_addr_t(r->netmask, 0, &gc);
>> +#endif
>> +#if !defined(TARGET_LINUX) && !defined(TARGET_ANDROID)
>>      gateway = print_in_addr_t(r->gateway, 0, &gc);
>> +#endif
>>  
>>      is_local_route = local_route(r->network, r->netmask, r->gateway, rgi);
>>      if (is_local_route == LR_ERROR)
>>
> 
> -Steffan

v4 is coming!

Cheers,


-- 
Antonio Quartulli

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to