mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
parent
15db02a6ab
commit
6c8beed345
@ -2871,6 +2871,42 @@ function merge_ipv6_delegated_prefix($prefix, $suffix, $len = 64) {
|
||||
substr($suffix, $prefix_len));
|
||||
}
|
||||
|
||||
function dhcpv6_pd_str_help($pdlen) {
|
||||
$result = '';
|
||||
|
||||
switch ($pdlen) {
|
||||
case 48:
|
||||
$result = '::xxxx:xxxx:xxxx:xxxx:xxxx';
|
||||
break;
|
||||
case 52:
|
||||
$result = '::xxx:xxxx:xxxx:xxxx:xxxx';
|
||||
break;
|
||||
case 56:
|
||||
$result = '::xx:xxxx:xxxx:xxxx:xxxx';
|
||||
break;
|
||||
case 60:
|
||||
$result = '::x:xxxx:xxxx:xxxx:xxxx';
|
||||
break;
|
||||
/*
|
||||
* XXX 63, 62 and 61 should use same mask of 60 but it would
|
||||
* we let user chose this bit it can end up out of PD network
|
||||
*
|
||||
* Leave this with the same of 64 for now until we find a way to
|
||||
* let user chose it. The side-effect is users with PD with one
|
||||
* of these lengths will not be able to setup DHCP server range
|
||||
* for full PD size, only for last /64 network
|
||||
*/
|
||||
case 61:
|
||||
case 62:
|
||||
case 63:
|
||||
case 64:
|
||||
$result = '::xxxx:xxxx:xxxx:xxxx';
|
||||
break;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function huawei_rssi_to_string($rssi) {
|
||||
$dbm = array();
|
||||
$i = 0;
|
||||
|
||||
@ -153,8 +153,12 @@ if (is_array($config['dhcpdv6'][$if])) {
|
||||
}
|
||||
|
||||
if ($config['interfaces'][$if]['ipaddrv6'] == 'track6') {
|
||||
$trackifname = $config['interfaces'][$if]['track6-interface'];
|
||||
$trackcfg = $config['interfaces'][$trackifname];
|
||||
$ifcfgsn = 64 - $trackcfg['dhcp6-ia-pd-len'];
|
||||
$ifcfgip = '::';
|
||||
$ifcfgsn = 64;
|
||||
|
||||
$str_help_mask = dhcpv6_pd_str_help($ifcfgsn);
|
||||
} else {
|
||||
$ifcfgip = get_interface_ipv6($if);
|
||||
$ifcfgsn = get_interface_subnetv6($if);
|
||||
@ -244,16 +248,20 @@ if ($_POST) {
|
||||
if (!is_ipaddrv6($_POST['range_from'])) {
|
||||
$input_errors[] = gettext("A valid range must be specified.");
|
||||
} elseif ($config['interfaces'][$if]['ipaddrv6'] == 'track6' &&
|
||||
!Net_IPv6::isInNetmask($_POST['range_from'], '::', 64)) {
|
||||
$input_errors[] = gettext("The prefix (upper 64 bits) must be zero. Use the form ::x:x:x:x");
|
||||
!Net_IPv6::isInNetmask($_POST['range_from'], '::', $ifcfgsn)) {
|
||||
$input_errors[] = sprintf(gettext(
|
||||
"The prefix (upper %s bits) must be zero. Use the form %s"),
|
||||
$ifcfgsn, $str_help_mask);
|
||||
}
|
||||
}
|
||||
if ($_POST['range_to']) {
|
||||
if (!is_ipaddrv6($_POST['range_to'])) {
|
||||
$input_errors[] = gettext("A valid range must be specified.");
|
||||
} elseif ($config['interfaces'][$if]['ipaddrv6'] == 'track6' &&
|
||||
!Net_IPv6::isInNetmask($_POST['range_to'], '::', 64)) {
|
||||
$input_errors[] = gettext("The prefix (upper 64 bits) must be zero. Use the form ::x:x:x:x");
|
||||
!Net_IPv6::isInNetmask($_POST['range_to'], '::', $ifcfgsn)) {
|
||||
$input_errors[] = sprintf(gettext(
|
||||
"The prefix (upper %s bits) must be zero. Use the form %s"),
|
||||
$ifcfgsn, $str_help_mask);
|
||||
}
|
||||
}
|
||||
if (($_POST['gateway'] && !is_ipaddrv6($_POST['gateway']))) {
|
||||
|
||||
@ -158,9 +158,15 @@ if ($_POST) {
|
||||
if ($_POST['ipaddrv6']) {
|
||||
if (!is_ipaddrv6($_POST['ipaddrv6'])) {
|
||||
$input_errors[] = gettext("A valid IPv6 address must be specified.");
|
||||
} elseif ($config['interfaces'][$if]['ipaddrv6'] == 'track6' &&
|
||||
!Net_IPv6::isInNetmask($_POST['ipaddrv6'], '::', 64)) {
|
||||
$input_errors[] = gettext("The prefix (upper 64 bits) must be zero. Use the form ::x:x:x:x");
|
||||
} elseif ($config['interfaces'][$if]['ipaddrv6'] == 'track6') {
|
||||
$trackifname = $config['interfaces'][$if]['track6-interface'];
|
||||
$trackcfg = $config['interfaces'][$trackifname];
|
||||
$pdlen = 64 - $trackcfg['dhcp6-ia-pd-len'];
|
||||
if (!Net_IPv6::isInNetmask($_POST['ipaddrv6'], '::', $pdlen)) {
|
||||
$input_errors[] = sprintf(gettext(
|
||||
"The prefix (upper %s bits) must be zero. Use the form %s"),
|
||||
$pdlen, dhcpv6_pd_str_help($ifcfgsn));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user