Commit 5ddbfd16 authored by Franco Fichtner's avatar Franco Fichtner

config: straighten out the wan/lan assign code a little

parent 679b72f3
...@@ -106,21 +106,21 @@ EOD; ...@@ -106,21 +106,21 @@ EOD;
do { do {
echo "\n" . gettext("Enter the WAN interface name or 'a' for auto-detection:") . " "; echo "\n" . gettext("Enter the WAN interface name or 'a' for auto-detection:") . " ";
if ($interactive) { if ($interactive) {
$wanif = chop(fgets($fp)); $wanif = chop(fgets($fp));
} else { } else {
$wanif = $ifnames[0]; $wanif = $ifnames[0];
echo $wanif . PHP_EOL; echo $wanif . PHP_EOL;
} }
if ($wanif == '') {
return;
}
if ($wanif == 'a') { if ($wanif == 'a') {
$wanif = autodetect_interface('WAN', $fp); $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); unset($wanif);
continue;
} }
} while (!$wanif); } while (!$wanif);
...@@ -139,12 +139,14 @@ EOD; ...@@ -139,12 +139,14 @@ EOD;
if ($lanif == '') { if ($lanif == '') {
break; break;
} }
if ($lanif == 'a') { if ($lanif == 'a') {
$lanif = autodetect_interface('LAN', $fp); $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"); printf(gettext("%sInvalid interface name '%s'%s"), "\n", $lanif, "\n");
unset($lanif); unset($lanif);
continue;
} }
} while (!$lanif); } while (!$lanif);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment