From 78ae2b1406d4651d408bb2db843d531dc9dffd08 Mon Sep 17 00:00:00 2001 From: Ermal Date: Fri, 1 Oct 2010 16:51:21 +0000 Subject: Make sure we do not overwrite the gateway stored in config with a dynamic gateway info. Correct POST var name(Found by ghnb). Also correctly reload only the defaultgw interface changed only if it is different than the present one. --- etc/inc/gwlb.inc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'etc') diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index 3ccbbb7..ffc7c37 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -275,7 +275,7 @@ function return_gateways_array($disabled = false) { /* Process/add all the configured gateways. */ if (is_array($config['gateways']['gateway_item'])) { foreach($config['gateways']['gateway_item'] as $gateway) { - if($gateway['gateway'] == "dynamic") { + if(empty($gateway['gateway']) || $gateway['gateway'] == "dynamic") { $gateway['gateway'] = get_interface_gateway($gateway['interface']); /* no IP address found, set to dynamic */ if(! is_ipaddr($gateway['gateway'])) @@ -331,12 +331,8 @@ function return_gateways_array($disabled = false) { /* automatically skip known static and dynamic gateways we have a array entry for */ foreach($gateways_arr as $gateway_item) { - if ($ifname == $gateway_item['friendlyiface'] || $friendly == $gateway_item['name']) { - if ($gateway_item['gateway'] == $gateway['gateway']) + if ($ifname == $gateway_item['friendlyiface'] && $friendly == $gateway_item['name']) continue 2; - if ($gateway_item['gateway'] == "dynamic") - continue 2; - } } if (is_ipaddr($gateway['gateway'])) -- cgit v1.1