From 21bffecd67f474b8f165b7076d056099ae47f91c Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Fri, 12 May 2017 18:24:17 +0200 Subject: [PATCH] rc: address missing newline after default gw question #1606 --- src/etc/rc.initial.setlanip | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/etc/rc.initial.setlanip b/src/etc/rc.initial.setlanip index 809e4d96e..037dec753 100755 --- a/src/etc/rc.initial.setlanip +++ b/src/etc/rc.initial.setlanip @@ -232,16 +232,18 @@ function add_gateway_to_config($interface, $gatewayip, $inet_type, $is_in_subnet } } - if (!$is_default && console_prompt_for_yn(sprintf('Do you want to use it as the default %s gateway?', $label_IPvX), $interface == 'wan' ? 'y' : 'n')) { - foreach ($a_gateways as &$item) { - if ($item['ipprotocol'] === $inet_type) { - if (isset($item['defaultgw'])) { - unset($item['defaultgw']); + if (!$is_default) { + if (console_prompt_for_yn(sprintf('Do you want to use it as the default %s gateway?', $label_IPvX), $interface == 'wan' ? 'y' : 'n')) { + foreach ($a_gateways as &$item) { + if ($item['ipprotocol'] === $inet_type) { + if (isset($item['defaultgw'])) { + unset($item['defaultgw']); + } } } - } - $is_default = true; + $is_default = true; + } echo "\n"; } @@ -258,7 +260,7 @@ function add_gateway_to_config($interface, $gatewayip, $inet_type, $is_in_subnet 'gateway' => $gatewayip, 'monitor_disable' => 1, 'name' => $new_name, - 'interval' => true, + 'interval' => true, 'weight' => 1, ); if (!$is_in_subnet) {