fix errors ipam pandora_enterprise#9282

This commit is contained in:
Daniel Barbero 2022-08-04 10:10:20 +02:00
parent 56196b12c7
commit 38c7bcc061
1 changed files with 20 additions and 0 deletions

View File

@ -5996,6 +5996,26 @@ function send_test_email(
}
/**
* Check ip is valid into network
*
* @param string $ip Ip XXX.XXX.XXX.XXX.
* @param string $cidr Network XXX.XXX.XXX.XXX/XX.
*
* @return boolean
*/
function cidr_match($ip, $cidr)
{
list($subnet, $mask) = explode('/', $cidr);
if ((ip2long($ip) & ~((1 << (32 - $mask)) - 1) ) == ip2long($subnet)) {
return true;
}
return false;
}
/**
* Microtime float number.
*