On 5 January 2015 at 22:58, Ulrich Weber <[email protected]> wrote: > otherwise 0.0.0.0/0 is set as 0.0.0.0/255.255.255.255 on x86_64 > > Signed-off-by: Ulrich Weber <[email protected]> > --- > utils.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/utils.c b/utils.c > index 71a0f13..b2fbe02 100644 > --- a/utils.c > +++ b/utils.c > @@ -803,7 +803,7 @@ fw3_bitlen2netmask(int family, int bits, void *mask) > return false; > > v4 = mask; > - v4->s_addr = htonl(~((1 << (32 - abs(bits))) - 1)); > + v4->s_addr = bits ? htonl(~((1 << (32 - abs(bits))) - 1)) : 0; >
Quite a catch! But the culprit should be that shifting a 32-bit integer left/right by not less than 32 is supposed to be undefined behaviour in C. > if (bits < 0) > v4->s_addr = ~v4->s_addr; > -- > 1.9.1 > _______________________________________________ > openwrt-devel mailing list > [email protected] > https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
