router advertisements: remove AdvRDNSSLifetime / AdvDNSSLLifetime bounds; closes #4893

RFC 8106 removes the bound of acceptable values:

https://tools.ietf.org/html/rfc8106#section-5.1
https://tools.ietf.org/html/rfc8106#section-5.2
This commit is contained in:
Maurice Walker 2021-04-02 21:44:49 +02:00 committed by Franco Fichtner
parent c7c629945e
commit 3807cf8b73

View File

@ -117,36 +117,36 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (!val_int_in_range($pconfig['ramaxinterval'], 4, 1800)) {
$input_errors[] = sprintf(gettext('Maximum interval must be between %s and %s seconds.'), 4, 1800);
} else {
$int_max = 4294967295;
if (!val_int_in_range($pconfig['ramininterval'], 3, intval($pconfig['ramaxinterval'] * 0.75))) {
$input_errors[] = sprintf(gettext('Minimum interval must be between %s and %s seconds.'), 3, intval($pconfig['ramaxinterval'] * 0.75));
}
if (!empty($pconfig['AdvDefaultLifetime']) && !val_int_in_range($pconfig['AdvDefaultLifetime'], $pconfig['ramaxinterval'], 9000)) {
$input_errors[] = sprintf(gettext('AdvDefaultLifetime must be between %s and %s seconds.'), $pconfig['ramaxinterval'], 9000);
}
if (!empty($pconfig['AdvValidLifetime']) && !val_int_in_range($pconfig['AdvValidLifetime'], 1, 4294967295)) {
$input_errors[] = sprintf(gettext('AdvValidLifetime must be between %s and %s seconds.'), 1, 4294967295);
if (!empty($pconfig['AdvValidLifetime']) && !val_int_in_range($pconfig['AdvValidLifetime'], 1, $int_max)) {
$input_errors[] = sprintf(gettext('AdvValidLifetime must be between %s and %s seconds.'), 1, $int_max);
}
if (!empty($pconfig['AdvPreferredLifetime']) && !val_int_in_range($pconfig['AdvPreferredLifetime'], 1, 4294967295)) {
$input_errors[] = sprintf(gettext('AdvPreferredLifetime must be between %s and %s seconds.'), 1, 4294967295);
if (!empty($pconfig['AdvPreferredLifetime']) && !val_int_in_range($pconfig['AdvPreferredLifetime'], 1, $int_max)) {
$input_errors[] = sprintf(gettext('AdvPreferredLifetime must be between %s and %s seconds.'), 1, $int_max);
}
if (!empty($pconfig['AdvRDNSSLifetime']) && !val_int_in_range($pconfig['AdvRDNSSLifetime'], $pconfig['ramaxinterval'], $pconfig['ramaxinterval'] * 2)) {
$input_errors[] = sprintf(gettext('AdvRDNSSLifetime must be between %s and %s seconds.'), $pconfig['ramaxinterval'], $pconfig['ramaxinterval'] * 2);
if (!empty($pconfig['AdvRDNSSLifetime']) && !val_int_in_range($pconfig['AdvRDNSSLifetime'], 1, $int_max)) {
$input_errors[] = sprintf(gettext('AdvRDNSSLifetime must be between %s and %s seconds.'), 1, $int_max);
}
if (!empty($pconfig['AdvDNSSLLifetime']) && !val_int_in_range($pconfig['AdvDNSSLLifetime'], $pconfig['ramaxinterval'], $pconfig['ramaxinterval'] * 2)) {
$input_errors[] = sprintf(gettext('AdvDNSSLLifetime must be between %s and %s seconds.'), $pconfig['ramaxinterval'], $pconfig['ramaxinterval'] * 2);
if (!empty($pconfig['AdvDNSSLLifetime']) && !val_int_in_range($pconfig['AdvDNSSLLifetime'], 1, $int_max)) {
$input_errors[] = sprintf(gettext('AdvDNSSLLifetime must be between %s and %s seconds.'), 1, $int_max);
}
if (!empty($pconfig['AdvRouteLifetime']) && !val_int_in_range($pconfig['AdvRouteLifetime'], 1, 4294967295)) {
$input_errors[] = sprintf(gettext('AdvRouteLifetime must be between %s and %s seconds.'), 1, 4294967295);
if (!empty($pconfig['AdvRouteLifetime']) && !val_int_in_range($pconfig['AdvRouteLifetime'], 1, $int_max)) {
$input_errors[] = sprintf(gettext('AdvRouteLifetime must be between %s and %s seconds.'), 1, $int_max);
}
$mtu_low = 1280;
$mtu_high = 65535;
if (!empty($pconfig['AdvLinkMTU']) && !val_int_in_range($pconfig['AdvLinkMTU'], $mtu_low, $mtu_high)) {
$input_errors[] = sprintf(gettext('AdvLinkMTU must be between %s and %s bytes.'), $mtu_low, $mtu_high);
$input_errors[] = sprintf(gettext('AdvLinkMTU must be between %s and %s bytes.'), $mtu_low, $mtu_high);
}
}
if (count($input_errors) == 0) {
config_read_array('dhcpdv6', $if);