summaryrefslogtreecommitdiffstats
path: root/etc/inc/gwlb.inc
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2010-01-29 01:39:25 +0000
committerErmal Luçi <eri@pfsense.org>2010-01-29 01:44:40 +0000
commit883c53c92f1b99b3aab1d94f05168969423255b3 (patch)
tree8a5858aed01227908218d4eaa4b3bdb6a7fe5970 /etc/inc/gwlb.inc
parent3ff90af790525a8b852562880317f88eaef5bffd (diff)
downloadpfsense-883c53c92f1b99b3aab1d94f05168969423255b3.zip
pfsense-883c53c92f1b99b3aab1d94f05168969423255b3.tar.gz
Ticket #303. Fix very many bugs in this code. From strings that were not quoted propperly to completely broken code paths.
Diffstat (limited to 'etc/inc/gwlb.inc')
-rw-r--r--etc/inc/gwlb.inc71
1 files changed, 35 insertions, 36 deletions
diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc
index 0c8b3b7..3cb4727 100644
--- a/etc/inc/gwlb.inc
+++ b/etc/inc/gwlb.inc
@@ -281,53 +281,52 @@ function return_gateways_array($disabled = false) {
$gateway['monitor'] = $gateway['gateway'];
}
/* include the gateway index as the attribute */
+ $gateway['friendlyiface'] = $gateway['interface'];
$gateway['interface'] = convert_friendly_interface_to_real_interface_name($gateway['interface']);
$gateway['attribute'] = "$i";
$gateways_arr[$gateway['name']] = $gateway;
$i++;
}
- } else {
- foreach($iflist as $ifname => $friendly ) {
- if(! interface_has_gateway($ifname)) {
- continue;
- }
- $gateway = array();
- $gateway['dynamic'] = false;
- $gateway['gateway'] = get_interface_gateway($ifname, $gateway['dynamic']);
- $gateway['interface'] = get_real_interface($ifname);
- $gateway['name'] = "{$ifname}";
- $gateway['attribute'] = "system";
-
- /* Loopback dummy for dynamic interfaces without a IP */
- if(!is_ipaddr(trim($gateway['gateway']))) {
- $gateway['gateway'] = "dynamic";
- }
+ }
+
+ foreach($iflist as $ifname => $friendly ) {
+ if(! interface_has_gateway($ifname)) {
+ continue;
+ }
+ $gateway = array();
+ $gateway['dynamic'] = false;
+ $gateway['gateway'] = get_interface_gateway($ifname, $gateway['dynamic']);
+ $gateway['interface'] = get_real_interface($ifname);
+ $gateway['friendlyiface'] = $ifname;
+ $gateway['name'] = "{$ifname}";
+ $gateway['attribute'] = "system";
- /* automatically skip known static and dynamic gateways we have a array entry for */
- if(is_array($config['gateways']['gateway_item'])) {
- foreach($config['gateways']['gateway_item'] as $gateway_item) {
- if($gateway_item['gateway'] == $gateway['gateway']) {
- continue 2;
- }
- if(($gateway_item['gateway'] == "dynamic") && ($gateway_item['interface'] == $gateway['interface'])) {
- continue 2;
- }
- }
- }
+ /* Loopback dummy for dynamic interfaces without a IP */
+ if(!is_ipaddr(trim($gateway['gateway']))) {
+ $gateway['gateway'] = "dynamic";
+ }
- /* retrieve a proper monitor IP? */
- if(is_ipaddr($interface['monitorip'])) {
- $gateway['monitor'] = $interface['monitorip'];
- } else {
- $gateway['monitor'] = $gateway['gateway'];
- }
- $gateway['descr'] = "Interface $ifname Dynamic Gateway";
+ /* automatically skip known static and dynamic gateways we have a array entry for */
+ foreach($gateways_arr as $gateway_item) {
+ if($gateway_item['gateway'] == $gateway['gateway'] && ($ifname == $gateway_item['friendlyiface']))
+ continue 2;
+ if(($gateway_item['gateway'] == "dynamic") && ($ifname == $gateway_item['friendlyiface']))
+ continue 2;
+ }
- $gateways_arr[$ifname] = $gateway;
- $i++;
+ /* retrieve a proper monitor IP? */
+ $interface = $config['interfaces'][$ifname];
+ if(is_ipaddr($interface['monitorip'])) {
+ $gateway['monitor'] = $interface['monitorip'];
+ } else {
+ $gateway['monitor'] = $gateway['gateway'];
}
+ $gateway['descr'] = "Interface $ifname Dynamic Gateway";
+ $gateways_arr[$ifname] = $gateway;
+ $i++;
}
+
return($gateways_arr);
}
OpenPOWER on IntegriCloud