Merge branch 'ent-3884-Error-Superredes' into 'develop'

fixed errors IPAM subneting

See merge request artica/pandorafms!2395
This commit is contained in:
Alejandro Fraguas 2019-05-08 15:57:53 +02:00
commit 4b7f9e4882
1 changed files with 12 additions and 10 deletions

View File

@ -3853,9 +3853,10 @@ function pandora_xhprof_display_result($key='', $method='link')
/**
* From a network with a mask remove the smallest ip and the highest
*
* @param string address to identify the network.
* @param string mask to identify the mask network
* @return array or false with smallest ip and highest ip
* @param string $address Identify the network.
* @param string $mask Identify the mask network.
*
* @return array or false with smallest ip and highest ip.
*/
function range_ips_for_network($address, $mask)
{
@ -3863,15 +3864,15 @@ function range_ips_for_network($address, $mask)
return false;
}
// convert ip addresses to long form
// Convert ip addresses to long form.
$address_long = ip2long($address);
$mask_long = ip2long($mask);
// caculate first usable address
// Calculate first usable address.
$ip_host_first = ((~$mask_long) & $address_long);
$ip_first = (($address_long ^ $ip_host_first) + 1);
$ip_first = (($address_long ^ $ip_host_first));
// caculate last usable address
// Calculate last usable address.
$ip_broadcast_invert = ~$mask_long;
$ip_last = (($address_long | $ip_broadcast_invert) - 1);
@ -3887,9 +3888,10 @@ function range_ips_for_network($address, $mask)
/**
* from two ips find out if there is such an ip
*
* @param string ip ip wont validate
* @param string ip_lower
* @param string ip_upper
* @param string ip ip wont validate
* @param string ip_lower
* @param string ip_upper
*
* @return boolean true or false if the ip is between the two ips
*/
function is_in_network($ip, $ip_lower, $ip_upper)