From f4bbec8bf04aa22601cfdea2b9c7513cf01d9d79 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Sun, 8 Jan 2017 20:53:15 +0545 Subject: Helper format_duid() for DUID input --- src/usr/local/www/system_advanced_network.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (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 b99dad8..acfe18d 100644 --- a/src/usr/local/www/system_advanced_network.php +++ b/src/usr/local/www/system_advanced_network.php @@ -56,6 +56,14 @@ if ($_POST) { $input_errors[] = gettext("An IP address to NAT IPv6 packets must be specified."); } + if (!empty($_POST['global-v6duid'])) { + $_POST['global-v6duid'] = format_duid($_POST['global-v6duid']); + $pconfig['global-v6duid'] = $_POST['global-v6duid']; + if (!is_duid($_POST['global-v6duid'])) { + $input_errors[] = gettext("A valid DUID must be specified"); + } + } + ob_flush(); flush(); if (!$input_errors) { @@ -85,12 +93,7 @@ if ($_POST) { } 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']; - } + $config['system']['global-v6duid'] = $_POST['global-v6duid']; } else { unset($config['system']['global-v6duid']); } -- cgit v1.1