From: chantra Date: Fri, 11 Jun 2010 14:23:03 +0000 (+0200) Subject: Handle non standard subnets in PF grammar X-Git-Tag: v2.2-beta4~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2ad24c062c0d1870d826ecbb9506f893896f50c;p=thirdparty%2Fopenvpn.git 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 --- diff --git a/pf.c b/pf.c index 3ce2ef24b..aed836edc 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 {