From 3cd21b4e4c980d706c6412102fca2c5c7ec7f2ba Mon Sep 17 00:00:00 2001 From: PiBa-NL Date: Sun, 27 Jan 2019 15:17:24 +0100 Subject: [PATCH] Routing, actually show the "(default)" mark on the default route as it is present on the OS Most obvious problem was when manually switching from WANGW1 to WANGW2 it showed both as (default) after saving the setting and before applying it. Also after applying it would require another page refresh to show the updated situation. Also add a little information box that shows what (Default) means for the user. --- src/etc/inc/gwlb.inc | 4 ++-- src/usr/local/www/system_gateways.php | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/etc/inc/gwlb.inc b/src/etc/inc/gwlb.inc index 0b803217dd..8a200bad03 100644 --- a/src/etc/inc/gwlb.inc +++ b/src/etc/inc/gwlb.inc @@ -671,11 +671,11 @@ function return_gateways_array($disabled = false, $localhost = false, $inactive } if ($gateway['ipprotocol'] == "inet" && - ($config['gateways']['defaultgw4'] == $gateway['name'] || $gateway['gateway'] == $cgw4)) { + ($gateway['gateway'] == $cgw4)) { $gateway['isdefaultgw'] = true; $found_defaultv4 = 1; } else if ($gateway['ipprotocol'] == "inet6" && - ($config['gateways']['defaultgw6'] == $gateway['name'] || $gateway['gateway'] == $cgw6)) { + ($gateway['gateway'] == $cgw6)) { $gateway['isdefaultgw'] = true; $found_defaultv6 = 1; } diff --git a/src/usr/local/www/system_gateways.php b/src/usr/local/www/system_gateways.php index 9fc4b094ef..7631385930 100644 --- a/src/usr/local/www/system_gateways.php +++ b/src/usr/local/www/system_gateways.php @@ -65,8 +65,6 @@ if ($_POST['order-store']) { write_config("System - Gateways: save default gateway"); } -$a_gateways = return_gateways_array(true, false, true, true); - if ($_POST['apply']) { $retval = 0; @@ -84,6 +82,7 @@ if ($_POST['apply']) { } } +$a_gateways = return_gateways_array(true, false, true, true); function can_delete_disable_gateway_item($id, $disable = false) { global $config, $input_errors, $a_gateways; @@ -343,7 +342,7 @@ foreach ($a_gateways as $i => $gateway): (default)"; + echo ' '; } ?> @@ -445,6 +444,13 @@ $form->add($section); print $form; ?> +
+', '', '') + ); +?> +