Kill states associated with the old WAN IP when WAN IP has changed. Retain

hidden config option to wipe all states on IP change, as there seemed to
be circumstances where the 'pfctl -k $oldip' didn't suffice for others
(much of history in redmine ticket, some on forum and elsewhere). ticket
This commit is contained in:
Chris Buechler 2014-10-30 16:37:14 -05:00
parent 737b18f23b
commit 1ae41bfe84
1 changed files with 4 additions and 1 deletions

View File

@ -185,9 +185,12 @@ if(is_array($config['gifs']['gif'])){
* could be failing back in which case we need to switch IPs back anyhow.
*/
if (!is_ipaddr($oldip) || $curwanip != $oldip || !is_ipaddrv4($config['interfaces'][$interface]['ipaddr'])) {
/* option to flush state table on IP change */
/* IP changed, kill states accordingly */
if ($curwanip != $oldip) {
log_error("IP has changed, killing states on former IP $oldip.");
mwexec_bg("/sbin/pfctl -k $oldip");
if (isset($config['system']['ip_change_kill_states'])) {
/* hidden config option to wipe all states if needed */
log_error("Killing all states post-IP change.");
filter_flush_state_table();
}