From 7be23d53705ccbcee64d3236bf74b34c513da686 Mon Sep 17 00:00:00 2001 From: marjohn56 Date: Wed, 21 Dec 2016 15:26:17 +0000 Subject: User Defined DUID User may define a DUID to use in System->Advanced->Networking. The entered DUID is validated for composition and length, if valid it is stored in the config.xml. On call of wan_dhcp6_configure() the DUID is written to file to be read by dhcp6c on launch. --- src/usr/local/www/system_advanced_network.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/usr/local/www/system_advanced_network.php') diff --git a/src/usr/local/www/system_advanced_network.php b/src/usr/local/www/system_advanced_network.php index 06a4e2d..b453045 100644 --- a/src/usr/local/www/system_advanced_network.php +++ b/src/usr/local/www/system_advanced_network.php @@ -40,6 +40,7 @@ require_once("shaper.inc"); $pconfig['ipv6nat_enable'] = isset($config['diag']['ipv6nat']['enable']); $pconfig['ipv6nat_ipaddr'] = $config['diag']['ipv6nat']['ipaddr']; $pconfig['ipv6allow'] = isset($config['system']['ipv6allow']); +$pconfig['global-v6duid'] = $config['system']['global-v6duid']; $pconfig['prefer_ipv4'] = isset($config['system']['prefer_ipv4']); $pconfig['sharednet'] = $config['system']['sharednet']; $pconfig['disablechecksumoffloading'] = isset($config['system']['disablechecksumoffloading']); @@ -83,6 +84,18 @@ if ($_POST) { unset($config['system']['prefer_ipv4']); } + if (!empty($_POST['global-v6duid'])) { + $_POST['global-v6duid'] = strtolower(str_replace("-", ":", $_POST['global-v6duid'])); + if (!is_duid($_POST['global-v6duid'])) { + $input_errors[] = gettext("A valid DUID must be specified"); + } else { + $config['system']['global-v6duid'] = $_POST['global-v6duid']; + } + } + else { + unset($config['system']['global-v6duid']); + } + if ($_POST['sharednet'] == "yes") { $config['system']['sharednet'] = true; system_disable_arp_wrong_if(); @@ -186,6 +199,15 @@ $section->addInput(new Form_Checkbox( ))->setHelp('By default, if IPv6 is configured and a hostname resolves IPv6 and IPv4 addresses, '. 'IPv6 will be used. If this option is selected, IPv4 will be preferred over IPv6.'); +$section->addInput(new Form_Input( + 'global-v6duid', + 'DHCP6 DUID', + 'text', + $pconfig['global-v6duid'], + ['placeholder' => 'xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx'] + ))->setWidth(9)->sethelp('Enter the DUID to use here. Use this option if using RAM Disk, as the DUID will be lost on reboot. The existing DUID may be found in var/db/dhcp6_duid.' .'
' . + 'NOTE: Do not use this option with multiple DHCP6 interfaces.'); + $form->add($section); $section = new Form_Section('Network Interfaces'); -- cgit v1.1