diff options
author | Ermal <eri@pfsense.org> | 2013-09-05 12:24:27 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2013-09-05 12:24:27 +0000 |
commit | 5aa44e98465dcdb4bde806b5c3cb0a16d30dcb5d (patch) | |
tree | bacf1fa3848470519139fc63c14318ce281016c5 /etc | |
parent | c22f4809542d57430020bc0727a77b35cf580f4c (diff) | |
download | pfsense-5aa44e98465dcdb4bde806b5c3cb0a16d30dcb5d.zip pfsense-5aa44e98465dcdb4bde806b5c3cb0a16d30dcb5d.tar.gz |
Revert "Revert back the behaviour to cleanup all states for 2.1 Fixes #3181 and related to Ticket #1629. This commit is only for 2.1 since on master development will continue for better alternatives"
A bit too excessive need to get right.
This reverts commit c59dd719e0a6d9ee8deecaa7bff0d6ee8c76e4ca.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/filter.inc | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index ee5e3c7..0656a56 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -144,7 +144,33 @@ function filter_delete_states_for_down_gateways() { if (isset($config['system']['kill_states'])) return; - filter_flush_state_table(); + $a_gateways = return_gateways_status(); + if (is_array($GatewaysList)) { + foreach ($GatewaysList as $gwname => $gateway) { + if (empty($gateway['monitor'])) + continue; + if (!is_ipaddr($gateway['monitor'])) + continue; + if (strstr($gateway['monitor'], "127.0.0.")) + continue; + if (empty($a_gateways[$gateway['monitor']])) + continue; + $gwstatus =& $a_gateways[$gateway['monitor']]; + if (strstr($gwstatus['status'], "down")) { + if (!empty($gateway['interface'])) + $gwiface = $gateway['interface']; + else + $gwiface = get_real_interface($gateway['friendlyiface']); + $cmd = "/sbin/pfctl -i {$gwiface} -Fs"; + mwexec($cmd); + $gwip = $gateway['gateway']; + if (is_ipaddr($gwip)) { + $cmd = "/sbin/pfctl -i {$gwiface} -Fs -G {$gwip}"; + mwexec($cmd); + } + } + } + } } /* reload filter sync */ |