From 352defe4356b9ee6ac0042b4c34957006e0a9f77 Mon Sep 17 00:00:00 2001 From: schinken Date: Sat, 9 Jan 2016 13:37:17 +0100 Subject: Add possibility to configure radvd valid lifetime --- src/etc/inc/services.inc | 9 ++++++++ .../local/www/services_router_advertisements.php | 27 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/etc/inc/services.inc b/src/etc/inc/services.inc index 0a1d56a..1ddc1c5 100644 --- a/src/etc/inc/services.inc +++ b/src/etc/inc/services.inc @@ -181,6 +181,15 @@ function services_radvd_configure($blacklist = array()) { $radvdconf .= "\t\tAdvRouterAddr on;\n"; break; } + + if(is_numericint($dhcpv6ifconf['ravalidlifetime'])) { + $radvdconf .= "\t\tAdvValidLifetime {$dhcpv6ifconf['ravalidlifetime']};\n"; + } + + if(is_numericint($dhcpv6ifconf['rapreferredlifetime'])) { + $radvdconf .= "\t\tAdvPreferredLifetime {$dhcpv6ifconf['rapreferredlifetime']};\n"; + } + $radvdconf .= "\t};\n"; if (is_array($dhcpv6ifconf['subnets']['item'])) { diff --git a/src/usr/local/www/services_router_advertisements.php b/src/usr/local/www/services_router_advertisements.php index 1693b4a..bcc896b 100644 --- a/src/usr/local/www/services_router_advertisements.php +++ b/src/usr/local/www/services_router_advertisements.php @@ -118,6 +118,10 @@ if (is_array($config['dhcpdv6'][$if])) { if ($pconfig['rapriority'] == "") { $pconfig['rapriority'] = "medium"; } + + $pconfig['ravalidlifetime'] = $config['dhcpdv6'][$if]['ravalidlifetime']; + $pconfig['rapreferredlifetime'] = $config['dhcpdv6'][$if]['rapreferredlifetime']; + $pconfig['rainterface'] = $config['dhcpdv6'][$if]['rainterface']; $pconfig['radomainsearchlist'] = $config['dhcpdv6'][$if]['radomainsearchlist']; list($pconfig['radns1'], $pconfig['radns2'], $pconfig['radns3']) = $config['dhcpdv6'][$if]['radnsserver']; @@ -188,6 +192,10 @@ if ($_POST) { } } + if ($_POST['ravalidlifetime'] && (!is_numeric($_POST['ravalidlifetime']) || ($_POST['ravalidlifetime'] < 7200))) { + $input_errors[] = gettext("A valid lifetime below 2 hrs will be ignored by clients (RFC 4862 Section 5.5.3 point e)"); + } + if (!$input_errors) { if (!is_array($config['dhcpdv6'][$if])) { $config['dhcpdv6'][$if] = array(); @@ -197,6 +205,9 @@ if ($_POST) { $config['dhcpdv6'][$if]['rapriority'] = $_POST['rapriority']; $config['dhcpdv6'][$if]['rainterface'] = $_POST['rainterface']; + $config['dhcpdv6'][$if]['ravalidlifetime'] = $_POST['ravalidlifetime']; + $config['dhcpdv6'][$if]['rapreferredlifetime'] = $_POST['rapreferredlifetime']; + $config['dhcpdv6'][$if]['radomainsearchlist'] = $_POST['radomainsearchlist']; unset($config['dhcpdv6'][$if]['radnsserver']); if ($_POST['radns1']) { @@ -295,6 +306,22 @@ $section->addInput(new Form_Select( $priority_modes ))->setHelp('Select the Priority for the Router Advertisement (RA) Daemon.'); +$section->addInput(new Form_Input( + 'ravalidlifetime', + 'Default valid lifetime', + 'text', + $pconfig['ravalidlifetime'] +))->setHelp('Seconds. The length of time in seconds (relative to the time the packet is sent) that the prefix is valid for the purpose of on-link determination.' . '
' . +'The default is 86400 seconds.'); + +$section->addInput(new Form_Input( + 'rapreferredlifetime', + 'Default preferred lifetime', + 'text', + $pconfig['rapreferredlifetime'] +))->setHelp('Seconds. The length of time in seconds (relative to the time the packet is sent) that addresses generated from the prefix via stateless address autoconfiguration remain preferred.' . '
' . + 'The default is 14400 seconds.'); + $carplistif = array(); if (count($carplist) > 0) { foreach ($carplist as $ifname => $vip) { -- cgit v1.1