From 06b8d43c3fb34bd8773d9d99c9a35410c63efa75 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Tue, 26 Nov 2013 18:40:41 -0200 Subject: Add a new param to return_gateways_array and make it return gateways when interface doesn't exist. Default behavior didn't change. Also check the new gateway parameter (disabled) when filtering --- etc/inc/gwlb.inc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'etc/inc/gwlb.inc') diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index 7984a10..bc5709e 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -359,7 +359,7 @@ function return_gateways_status($byname = false) { } /* Return all configured gateways on the system */ -function return_gateways_array($disabled = false, $localhost = false) { +function return_gateways_array($disabled = false, $localhost = false, $inactive = false) { global $config, $g; $gateways_arr = array(); @@ -379,12 +379,16 @@ function return_gateways_array($disabled = false, $localhost = false) { /* Increment it here to do not skip items */ $i++; - if (empty($config['interfaces'][$gateway['interface']])) - continue; + if (empty($config['interfaces'][$gateway['interface']])) { + if ($inactive === false) + continue; + else + $gateway['inactive'] = true; + } $wancfg = $config['interfaces'][$gateway['interface']]; /* skip disabled interfaces */ - if ($disabled === false && !isset($wancfg['enable'])) + if ($disabled === false && (!isset($wancfg['enable']) || !isset($gateway['disabled']))) continue; /* if the gateway is dynamic and we can find the IPv4, Great! */ -- cgit v1.1