diff options
author | Seth Mos <seth.mos@xs4all.nl> | 2008-11-03 19:00:30 +0000 |
---|---|---|
committer | Seth Mos <seth.mos@xs4all.nl> | 2008-11-03 19:00:30 +0000 |
commit | 3439b0330b9804ef367bf253c04d3fbd279a2b72 (patch) | |
tree | 49decc2c540aa981ec5780db4f8fda7ad87933dc /etc/inc/gwlb.inc | |
parent | 6dd2a1e4d7b8a330af2b25026c0089dbfc4f3e13 (diff) | |
download | pfsense-3439b0330b9804ef367bf253c04d3fbd279a2b72.zip pfsense-3439b0330b9804ef367bf253c04d3fbd279a2b72.tar.gz |
Do a better job of detecting existing configured gateways
Diffstat (limited to 'etc/inc/gwlb.inc')
-rw-r--r-- | etc/inc/gwlb.inc | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index e1f76fa..f7bb2e8 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -222,20 +222,24 @@ function return_gateways_array() { /* Loop through all interfaces with a gateway and add it to a array */ $iflist = get_interface_list(); foreach($iflist as $ifname => $if ) { - $gateway = array(); - $friendly = convert_real_interface_to_friendly_interface_name($ifname); - if(lookup_gateway_ip_by_name($config['interfaces'][$friendly]['gateway'])) { - /* static configs are automatically from the array */ - continue; - } if(interface_has_gateway($ifname)) { + $gateway = array(); + $friendly = convert_real_interface_to_friendly_interface_name($ifname); $gateway['gateway'] = get_interface_gateway($ifname); - $gateway['interface'] = $ifname; - $descr = convert_friendly_interface_to_friendly_descr($friendly); /* Loopback for dynamic interfaces without a IP */ if(!is_ipaddr($gateway['gateway'])) { $gateway['gateway'] = "127.0.0.2"; } + /* do not add dynamic gateways if it is also found in the gateways array */ + if(is_array($config['gateways']['gateway_item'])) { + foreach($config['gateways']['gateway_item'] as $gateway_item) { + if($gateway_item['gateway'] == $gateway['gateway']) + continue 2; + } + } + + $gateway['interface'] = $ifname; + $descr = convert_friendly_interface_to_friendly_descr($friendly); /* FIXME: somehow retrieve a proper monitor IP? */ $gateway['monitor'] = $gateway['gateway']; $gateway['name'] = "{$friendly}"; |