aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-03-10 20:56:53 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-03-10 20:56:53 +0000
commit1a1a3daba64fb23df09863138db80fb4070ea429 (patch)
treea6baac7c358fad407d2c4cbc7b1885cba66f045f
parentd0f32825a5a64189d3fde3c053f152a15313c675 (diff)
downloadpfsense-packages-1a1a3daba64fb23df09863138db80fb4070ea429.tar.gz
pfsense-packages-1a1a3daba64fb23df09863138db80fb4070ea429.tar.bz2
pfsense-packages-1a1a3daba64fb23df09863138db80fb4070ea429.zip
Only setup sync for a interface one time.
-rw-r--r--packages/carp_rules.php14
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']);