From 5ddbfd16c7cdcaac888a4e34a68a2014faadf6b2 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Wed, 1 Jul 2015 21:05:14 +0200 Subject: [PATCH] config: straighten out the wan/lan assign code a little --- src/etc/inc/config.console.inc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/etc/inc/config.console.inc b/src/etc/inc/config.console.inc index 7297d7c49..fbfeae746 100644 --- a/src/etc/inc/config.console.inc +++ b/src/etc/inc/config.console.inc @@ -106,21 +106,21 @@ EOD; do { echo "\n" . gettext("Enter the WAN interface name or 'a' for auto-detection:") . " "; + if ($interactive) { $wanif = chop(fgets($fp)); } else { $wanif = $ifnames[0]; echo $wanif . PHP_EOL; } - if ($wanif == '') { - return; - } + if ($wanif == 'a') { $wanif = autodetect_interface('WAN', $fp); - } elseif (!array_key_exists($wanif, $iflist)) { - printf(gettext("%sInvalid interface name '%s'%s"), "\n", $wanif, "\n"); + } + + if (!array_key_exists($wanif, $iflist)) { + printf("\n" . gettext("Invalid interface name '%s'") . "\n", $wanif); unset($wanif); - continue; } } while (!$wanif); @@ -139,12 +139,14 @@ EOD; if ($lanif == '') { break; } + if ($lanif == 'a') { $lanif = autodetect_interface('LAN', $fp); - } elseif (!array_key_exists($lanif, $iflist)) { + } + + if (!array_key_exists($lanif, $iflist)) { printf(gettext("%sInvalid interface name '%s'%s"), "\n", $lanif, "\n"); unset($lanif); - continue; } } while (!$lanif);