Commit 1583c0a1 authored by Ad Schellevis's avatar Ad Schellevis

fix cashreport

parent 9a253152
......@@ -157,17 +157,28 @@ function gen_subnet_max($ipaddr, $bits) {
/* Generate end number for a given ipv6 subnet mask */
function gen_subnetv6_max($ipaddr, $bits)
{
$result = false;
if (!is_ipaddrv6($ipaddr)) {
return false;
}
set_error_handler (
function () {
return;
}
);
$mask = Net_IPv6::getNetmask('FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF',$bits);
$inet_ip = (binary)inet_pton($ipaddr);
$inet_mask = (binary)inet_pton($mask);
$inet_end = $inet_ip | ~$inet_mask;
if ($inet_ip) {
$inet_mask = (binary)inet_pton($mask);
if ($inet_mask) {
$inet_end = $inet_ip | ~$inet_mask;
$result = inet_ntop($inet_end);
}
}
restore_error_handler();
return (inet_ntop($inet_end));
return $result;
}
/* Returns the calculated bit length of the prefix delegation from the WAN interface */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment