From 79b7f49845b0b7efebd9fbc1cbb84456d6a47b93 Mon Sep 17 00:00:00 2001 From: Ermal Date: Tue, 10 Aug 2010 20:47:03 +0000 Subject: Ticket #8. Use proper IP to pfctl -b and run the command after the rules have been removed for the not 'down' interfaces. --- etc/inc/filter.inc | 5 ++--- etc/inc/gwlb.inc | 11 ++++++----- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'etc/inc') diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 3a6c37a..5fe9cfb 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -146,9 +146,8 @@ function filter_delete_states_for_down_gateways() { $a_gateways = return_gateways_status(); foreach ($a_gateways as $gateway) { if (stristr($status['status'], "down")) { - $int_ip = get_interface_ip($gateway['interface']); - if (is_ipaddr($int_ip)) - mwexec("/sbin/pfctl -b {$int_ip}"); + if (is_ipaddr($gateway['srcip'])) + mwexec("/sbin/pfctl -b {$gateway['srcip']}"); } } } diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index f574d8e..4a9decb 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -267,11 +267,12 @@ function return_gateways_status() { foreach($apingerstatus as $line) { $info = explode("|", $line); $target = $info[0]; - $status[$target]['name'] = $info[1]; - $status[$target]['lastcheck'] = $info[4] ? date('r', $info[4]) : date('r'); - $status[$target]['delay'] = empty($info[5]) ? 0 : $info[5]; - $status[$target]['loss'] = empty($info[6]) ? "0.0%" : $info[6] . ""; - $status[$target]['status'] = trim($info[7]); + $status[$target]['srcip'] = $info[1]; + $status[$target]['name'] = $info[2]; + $status[$target]['lastcheck'] = $info[5] ? date('r', $info[5]) : date('r'); + $status[$target]['delay'] = empty($info[6]) ? 0 : $info[6]; + $status[$target]['loss'] = empty($info[7]) ? "0.0%" : $info[7] . ""; + $status[$target]['status'] = trim($info[8]); } return($status); } -- cgit v1.1