Revision e173dd74
Added by Phil Davis over 10 years ago
etc/rc.kill_states | ||
---|---|---|
51 | 51 |
if (!empty($local_ip)) { |
52 | 52 |
list($local_ip, $subnet_bits) = explode("/", $local_ip); |
53 | 53 |
|
54 |
if (empty($subnet_bits)) |
|
54 |
if (empty($subnet_bits)) {
|
|
55 | 55 |
$subnet_bits = "32"; |
56 |
} |
|
56 | 57 |
|
57 | 58 |
if (!is_ipaddr($local_ip)) { |
58 | 59 |
log_error("rc.kill_states: Invalid IP address '{$local_ip}'"); |
... | ... | |
67 | 68 |
"/usr/bin/egrep '\-> +{$local_ip}:[0-9]+ +\->'"); |
68 | 69 |
|
69 | 70 |
$cleared_states = array(); |
70 |
foreach(explode("\n", $nat_states) as $nat_state) { |
|
71 |
if (preg_match_all('/([\d\.]+):[\d]+[\s->]+/i', $nat_state, $matches, PREG_SET_ORDER) != 3) |
|
71 |
foreach (explode("\n", $nat_states) as $nat_state) {
|
|
72 |
if (preg_match_all('/([\d\.]+):[\d]+[\s->]+/i', $nat_state, $matches, PREG_SET_ORDER) != 3) {
|
|
72 | 73 |
continue; |
74 |
} |
|
73 | 75 |
|
74 | 76 |
$src = $matches[0][1]; |
75 | 77 |
$dst = $matches[2][1]; |
76 | 78 |
|
77 |
if (empty($src) || empty($dst) || in_array("{$src},{$dst}", $cleared_states)) |
|
79 |
if (empty($src) || empty($dst) || in_array("{$src},{$dst}", $cleared_states)) {
|
|
78 | 80 |
continue; |
81 |
} |
|
79 | 82 |
|
80 | 83 |
$cleared_states[] = "{$src},{$dst}"; |
81 | 84 |
pfSense_kill_states($src, $dst); |
Also available in: Unified diff
Code style for etc files