From 4d664bc39d0bcf4635d3a0f758e4171831ed5d3c Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 16 Aug 2018 16:15:49 +0000 Subject: [PATCH] openvpn: allow /32, & bitwise operator is before != ??? PR: https://forum.opnsense.org/index.php?topic=9445.0 --- src/etc/inc/plugins.inc.d/openvpn.inc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/etc/inc/plugins.inc.d/openvpn.inc b/src/etc/inc/plugins.inc.d/openvpn.inc index fc06a05f5..0647a2eca 100644 --- a/src/etc/inc/plugins.inc.d/openvpn.inc +++ b/src/etc/inc/plugins.inc.d/openvpn.inc @@ -419,11 +419,8 @@ function openvpn_validate_cidr_ipv4($value, $allow_hosts = false) return false; } if (!$allow_hosts) { - if ($prefix == 32) { - return false; - } $mask = (0xffffffff << (32 - $prefix)) & 0xffffffff; - if (ip2long($ip) & $mask != ip2long($ip)) { + if ((ip2long($ip) & $mask) != ip2long($ip)) { return false; } }