diff options
author | Ermal <eri@pfsense.org> | 2010-06-03 18:22:13 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-06-03 18:22:13 +0000 |
commit | ae9618afa8ee7bc7292bf844760692c4e12bd1a4 (patch) | |
tree | 9ed41bdaa3cbe4c025c94d8bafa87aef32dc1133 | |
parent | b72eb6c8cc0aa927ee79d4c389429eef1a648433 (diff) | |
download | pfsense-ae9618afa8ee7bc7292bf844760692c4e12bd1a4.zip pfsense-ae9618afa8ee7bc7292bf844760692c4e12bd1a4.tar.gz |
Return the gateway status only for gateways apinger knows about instead of assuming that all gateways are down, which might give consecuences. Also prepend 'filter_' to the function used to kill states for down gateways in filter.inc to be consistent.
-rw-r--r-- | etc/inc/filter.inc | 5 | ||||
-rw-r--r-- | etc/inc/gwlb.inc | 19 |
2 files changed, 4 insertions, 20 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index ee9317e..0d4e9a1 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -140,8 +140,9 @@ function filter_configure() { touch($g['tmp_path'] . "/filter_dirty"); } -function delete_states_for_down_gateways() { +function filter_delete_states_for_down_gateways() { global $config; + $a_gateways = return_gateways_status(); foreach ($a_gateways as $gateway) { if ($gateway['status'] == "down") { @@ -369,7 +370,7 @@ function filter_configure_sync() { echo "."; update_filter_reload_status("Processing down interface states"); - delete_states_for_down_gateways(); + filter_delete_states_for_down_gateways(); update_filter_reload_status("Running plugins"); diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index 846d33d..70bfd52 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -243,9 +243,7 @@ EOD; /* return the status of the apinger targets as a array */ function return_gateways_status() { - global $config; - global $g; - $gateways_arr = return_gateways_array(); + global $config, $g; $apingerstatus = array(); if (file_exists("{$g['tmp_path']}/apinger.status")) { @@ -253,21 +251,6 @@ function return_gateways_status() { } $status = array(); - $i = 2; - /* assign a dummy IP address for dynamic interfaces in case we need it */ - $monitor = array(); - foreach($gateways_arr as $name => $gateway) { - if($gateway['monitor'] == "dynamic") { - $gateway['monitor'] = "127.0.0.{$i}"; - $i++; - } - $status[$gateway['monitor']]['monitor'] = $gateway['monitor']; - $status[$gateway['monitor']]['interface'] = $gateway['interface']; - $status[$gateway['monitor']]['gateway'] = $gateway['gateway']; - $status[$gateway['monitor']]['name'] = $gateway['name']; - $status[$gateway['monitor']]['status'] = "down"; - - } foreach($apingerstatus as $line) { $info = explode("|", $line); $target = $info[0]; |