From d2ad24c062c0d1870d826ecbb9506f893896f50c Mon Sep 17 00:00:00 2001 From: chantra Date: Fri, 11 Jun 2010 16:23:03 +0200 Subject: Handle non standard subnets in PF grammar Allow subnets for like 192.168.100.8/28 to be understood. A warning will be logged when subnet is incorrect and is being corrected to what is assumed to be correct. Signed-off-by: chantra Acked-by: Gert Doering Signed-off-by: David Sommerseth --- pf.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'pf.c') diff --git a/pf.c b/pf.c index 3ce2ef2..aed836e 100644 --- a/pf.c +++ b/pf.c @@ -109,6 +109,11 @@ add_subnet (const char *line, const char *prefix, const int line_num, struct pf_ return false; } netmask = netbits_to_netmask (netbits); + if ((network.s_addr & htonl (netmask)) != network.s_addr) + { + network.s_addr &= htonl (netmask); + msg (M_WARN, "WARNING: PF: %s/%d: incorrect subnet %s/%d changed to %s/%d", prefix, line_num, line, netbits, inet_ntoa (network), netbits); + } } else { -- cgit v1.2.3