mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
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
This commit is contained in:
parent
a524987400
commit
06b8d43c3f
@ -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! */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user