diff options
Diffstat (limited to 'src/usr/local/www/services_dhcpv6.php')
-rw-r--r-- | src/usr/local/www/services_dhcpv6.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/usr/local/www/services_dhcpv6.php b/src/usr/local/www/services_dhcpv6.php index 781eaaf..9ddd158 100644 --- a/src/usr/local/www/services_dhcpv6.php +++ b/src/usr/local/www/services_dhcpv6.php @@ -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."); } |