Skip to content

Commit

Permalink
openvpn: allow /32, & bitwise operator is before != ???
Browse files Browse the repository at this point in the history
  • Loading branch information
fichtner committed Aug 16, 2018
1 parent 8287fcf commit 4d664bc
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/etc/inc/plugins.inc.d/openvpn.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 4d664bc

Please sign in to comment.