From b9abac57ece83c4baeedfcd470dcab1084f98ae6 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Mon, 18 Jan 2016 21:49:32 +0545 Subject: [PATCH 1/2] Fix #5778 do not save changes if interface description matches an alias name - RELENG_2_2 --- usr/local/www/interfaces.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index 7184dee254..baf59af687 100644 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -504,6 +504,16 @@ if ($_POST['apply']) { break; } } + + /* Is the description already used as an alias name? */ + if (is_array($config['aliases']['alias'])) { + foreach ($config['aliases']['alias'] as $alias) { + if ($alias['name'] == $_POST['descr']) { + $input_errors[] = sprintf(gettext("Sorry, an alias with the name %s already exists."), $_POST['descr']); + } + } + } + if(is_numeric($_POST['descr'])) { $input_errors[] = gettext("The interface description cannot contain only numbers."); } From 1d44f99f358e8b19972dfbe252233e7b099e94be Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Mon, 18 Jan 2016 22:18:07 +0545 Subject: [PATCH 2/2] Use current interface description for breadcrumb - RELENG_2_2 If you enter invalid stuff in the interface description - e.g. "123" - and press save, then you get a warning about it, but the breadcrumb changes to "Interfaces: 123" - the wrongly entered description (that was not applied). If you enter a valid string for 'descr' then by this point $wancfg has the new value anyway and so the breadcrumb will change correctly if you make a valid entry in 'descr' and save. --- usr/local/www/interfaces.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index baf59af687..6a140b7480 100644 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -1503,7 +1503,7 @@ foreach ($mediaopts as $mediaopt){ } } -$pgtitle = array(gettext("Interfaces"), $pconfig['descr']); +$pgtitle = array(gettext("Interfaces"), $wancfg['descr']); $shortcut_section = "interfaces"; $closehead = false;