diff options
Diffstat (limited to 'packages/carp_rules.php')
-rw-r--r-- | packages/carp_rules.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/packages/carp_rules.php b/packages/carp_rules.php index 3819da4d..c1635275 100644 --- a/packages/carp_rules.php +++ b/packages/carp_rules.php @@ -28,12 +28,13 @@ */ /* return if there are no carp configured items */ -//if($config['installedpackages']['carp']['config']) return; +if($config['installedpackages']['carp']['config']) return; mwexec("/sbin/pfctl -a carp -Fr"); /* carp records exist, lets process */ $wan_interface = get_real_wan_interface(); +$seen_sync_ints = array(); foreach($config['installedpackages']['carp']['config'] as $carp) { $ip = $carp['ipaddress']; $int = find_ip_interface($ip); @@ -41,8 +42,15 @@ foreach($config['installedpackages']['carp']['config'] as $carp) { $carp_sync_int = convert_friendly_interface_to_real_interface_name($carp['synciface']); add_rule_to_anchor("carp", "pass out quick on {$carp_int} keep state", $carp_int . "1"); if($carp_sync_int <> "") { - add_rule_to_anchor("carp", "pass quick on {$carp_sync_int}", $carp_sync_int . "3"); - add_rule_to_anchor("carp", "pass quick on {$carp_sync_int} proto carp from {$carp_sync_int}:network to 224.0.0.18 keep state \(no-sync\)", $carp_sync_int . "2"); + $already_handled = 0; + foreach($seen_sync_ints as $si) { + if($si == $carp_sync_int) $already_handled = 1; + } + if($already_handled == 0) { + array_push($seen_sync_ints, $carp_sync_int); + add_rule_to_anchor("carp", "pass quick on {$carp_sync_int}", $carp_sync_int . "3"); + add_rule_to_anchor("carp", "pass quick on {$carp_sync_int} proto carp from {$carp_sync_int}:network to 224.0.0.18 keep state \(no-sync\)", $carp_sync_int . "2"); + } } if($int <> false and $int <> $wan_interface) { $ipnet = convert_ip_to_network_format($ip, $carp['netmask']); |