openvpn: allow /32, & bitwise operator is before != ???

PR: https://forum.opnsense.org/index.php?topic=9445.0
This commit is contained in:
Franco Fichtner 2018-08-16 16:15:49 +00:00
parent 8287fcf32a
commit 4d664bc39d

View File

@ -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;
}
}