mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Validate Prefix Delegation range to make sure addresses match first network address, otherwise DHCPd will silently fail
This commit is contained in:
parent
0e00ad80b0
commit
bcc2b417c2
@ -208,6 +208,30 @@ if ($_POST) {
|
||||
if (($_POST['prefixrange_to'] && !is_ipaddrv6($_POST['prefixrange_to']))) {
|
||||
$input_errors[] = gettext("A valid prefix range must be specified.");
|
||||
}
|
||||
|
||||
if ($_POST['prefixrange_from'] && $_POST['prefixrange_to'] &&
|
||||
$_POST['prefixrange_length']) {
|
||||
$netmask = Net_IPv6::getNetmask($_POST['prefixrange_from'],
|
||||
$_POST['prefixrange_length']);
|
||||
$netmask = Net_IPv6::compress($netmask);
|
||||
|
||||
if ($netmask != Net_IPv6::compress($_POST['prefixrange_from'])) {
|
||||
$input_errors[] = sprintf(gettext(
|
||||
"Prefix Delegation From address is not a valid IPv6 Netmask for %s"),
|
||||
$netmask . '/' . $_POST['prefixrange_length']);
|
||||
}
|
||||
|
||||
$netmask = Net_IPv6::getNetmask($_POST['prefixrange_to'],
|
||||
$_POST['prefixrange_length']);
|
||||
$netmask = Net_IPv6::compress($netmask);
|
||||
|
||||
if ($netmask != Net_IPv6::compress($_POST['prefixrange_to'])) {
|
||||
$input_errors[] = sprintf(gettext(
|
||||
"Prefix Delegation To address is not a valid IPv6 Netmask for %s"),
|
||||
$netmask . '/' . $_POST['prefixrange_length']);
|
||||
}
|
||||
}
|
||||
|
||||
if (($_POST['range_from'] && !is_ipaddrv6($_POST['range_from']))) {
|
||||
$input_errors[] = gettext("A valid range must be specified.");
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user