now to the list...

On Wed, Mar 28, 2012 at 10:40 AM, David Sommerseth
<openvpn.l...@topphemmelig.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 26/03/12 23:26, Alon Bar-Lev wrote:
>> Signed-off-by: Alon Bar-Lev <alon.bar...@gmail.com> ---
>> src/openvpn/route.c |    2 +- 1 files changed, 1 insertions(+), 1
>> deletions(-)
>>
>> diff --git a/src/openvpn/route.c b/src/openvpn/route.c index
>> bf7af63..608403b 100644 --- a/src/openvpn/route.c +++
>> b/src/openvpn/route.c @@ -268,7 +268,7 @@ init_route (struct route
>> *r, const struct route_option *ro, const struct route_list *rl) { -
>> const in_addr_t default_netmask = ~0; +  const in_addr_t
>> default_netmask = 0xffffffff;
>
> Please can you explain more in detail why this change is needed?  In my
> perspective, using ~0 is safer as it will always set all bits - no matter
> the size of default_netmask.
>
> And there are many more places in in source code where ~0 is used to
> provide that netmask.  I would like to see some consistency, rather to
> just fix warnings which appears on some platform(s).
>
> In general, if you can provide a more verbose description why the patch
> is written in the commit messages, it will also help the review process.
>  Most of us are not that skilled in reading others mind ;-)

Hmmm....
First there is a warning... :)
And I don't like warnings...

The explanation is that ipv4 is always 32bit, while ~0 can be either
32bit or 64bit depends on toolchain.
~0 should be used only if indeed the variable is 32bit/64bit by
architecture, this is not the case with ipv4.

0xffffffff as-is is valid ipv4 address/netmask...

I found only this warning, if there are more places, I guess these
needs to be fixed as well. So if you agree to the above, I will find
the other places.

Alon.

Reply via email to