diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-11-04 04:39:43 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-11-04 04:39:43 +0000 |
commit | 25530ad85b9ccdd8eb938de1cbf240b5b403a072 (patch) | |
tree | 8cb4d8954ecb28c4bc7667113600b310d26199df /etc/inc | |
parent | a08220d53d487b57ec8575421bc5d8ed7dba18ae (diff) | |
download | pfsense-25530ad85b9ccdd8eb938de1cbf240b5b403a072.zip pfsense-25530ad85b9ccdd8eb938de1cbf240b5b403a072.tar.gz |
Write out carp commands to a temp file and execute on bootup/
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/interfaces.inc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 9560ba7..f150498 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -385,6 +385,7 @@ function interfaces_carp_configure() { } } $viparr = &$config['virtualip']['vip']; + $fd = fopen("/tmp/carp.sh"); foreach ($viparr as $vip) { if ($vip['mode'] == "carp") { /* @@ -405,11 +406,14 @@ function interfaces_carp_configure() { */ if($debugging) echo "Configuring carp{$carp_instances_counter}.\n"; - mwexec("/sbin/ifconfig carp" . $carp_instances_counter . " " . $vip['subnet'] . "/" . $vip['subnet_bits'] . " broadcast " . $broadcast_address . " vhid " . $vip['vhid'] . "{$carpdev} advskew 200 " . $password); + fwrite($fd, "/sbin/ifconfig carp" . $carp_instances_counter . " " . $vip['subnet'] . "/" . $vip['subnet_bits'] . " broadcast " . $broadcast_address . " vhid " . $vip['vhid'] . "{$carpdev} advskew 200 " . $password); + //mwexec("/sbin/ifconfig carp" . $carp_instances_counter . " " . $vip['subnet'] . "/" . $vip['subnet_bits'] . " broadcast " . $broadcast_address . " vhid " . $vip['vhid'] . "{$carpdev} advskew 200 " . $password); if($g['booting']) mwexec("/sbin/ifconfig carp" . $carp_instances_counter . " up"); $carp_instances_counter++; } + fclose($fd); + mwexec("/bin/sh /tmp/carp.sh"); } if ($g['booting']) { unmute_kernel_msgs(); @@ -428,6 +432,14 @@ function interfaces_carp_bring_up_final() { if(!is_array($viparr)) return; $carp_instances_counter = 0; + $counter = 0; + $supress = intval(`sysctl net.inet.carp.suppress_preempt | cut -d" " -f2`); + while($supress > 0) { + sleep(2); + $supress = intval(`sysctl net.inet.carp.suppress_preempt | cut -d" " -f2`); + if($counter > 15) + $supress = 0; + } sleep(15); foreach ($viparr as $vip) { if($debugging) @@ -1421,4 +1433,4 @@ function discover_bridge($interface1, $interface2) { return "-1"; } -?> +?>
\ No newline at end of file |