#!/usr/local/bin/php -f +{$local_ip}:[0-9]+ +\->'"); $cleared_states = array(); foreach (explode("\n", $nat_states) as $nat_state) { if (preg_match_all('/([\d\.]+):[\d]+[\s->]+/i', $nat_state, $matches, PREG_SET_ORDER) != 3) { continue; } $src = $matches[0][1]; $dst = $matches[2][1]; if (empty($src) || empty($dst) || in_array("{$src},{$dst}", $cleared_states)) { continue; } $cleared_states[] = "{$src},{$dst}"; pfSense_kill_states($src, $dst); } pfSense_kill_states("0.0.0.0/0", "{$local_ip}/{$subnet_bits}"); pfSense_kill_states("{$local_ip}/{$subnet_bits}"); pfSense_kill_srcstates("{$local_ip}/{$subnet_bits}"); } log_error("rc.kill_states: Removing states for interface {$interface}"); mwexec("/sbin/pfctl -i {$interface} -Fs", true); }