X-Git-Url: http://git.archive.openwrt.org/?p=project%2Ffirewall3.git;a=blobdiff_plain;f=iptables.c;h=7d91452ff6f455cd3551a08cbe38c1d1590109b3;hp=df0d70425eaf4cc48dd9c382f2a88d83477ea01e;hb=098b7d6add425aadb0cfe5af34c5d88d5320d33f;hpb=9e7b8360c3f9c7d518322e732e6d8ddfbbf43c60 diff --git a/iptables.c b/iptables.c index df0d704..7d91452 100644 --- a/iptables.c +++ b/iptables.c @@ -609,7 +609,10 @@ fw3_ipt_rule_in_out(struct fw3_ipt_rule *r, static void ip4prefix2mask(int prefix, struct in_addr *mask) { - mask->s_addr = htonl(~((1 << (32 - prefix)) - 1)); + if (prefix > 0) + mask->s_addr = htonl(~((1 << (32 - prefix)) - 1)); + else + mask->s_addr = 0; } #ifndef DISABLE_IPV6