projects
/
project
/
firewall3.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Fix processing of CIDRs with mask 0
[project/firewall3.git]
/
iptables.c
diff --git
a/iptables.c
b/iptables.c
index
df0d704
..
7d91452
100644
(file)
--- 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