From 549a06bd65a0d7109c14703cd862a48125c4e2a5 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Fri, 14 Jan 2005 23:01:37 +0000 Subject: PFSYNC is now feature complete. Needs testing. --- packages/carp.xml | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 85 insertions(+), 8 deletions(-) (limited to 'packages') diff --git a/packages/carp.xml b/packages/carp.xml index ce2b1227..644845f7 100644 --- a/packages/carp.xml +++ b/packages/carp.xml @@ -10,7 +10,7 @@ - ['carp'] + ['installedpackages']['carp']['config'] VHID Group @@ -43,9 +43,50 @@ Virtual IP Address ipaddress - Enter the IPAddress that you would like to share on both machines + Enter the IP Address that you would like to share on both machines input + + Virtual IP Netmask + netmask + Enter the IP Address's netmask that you would like to share on both machines + select + 24 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + VHID Group vhid @@ -53,7 +94,7 @@ select 1 - + @@ -152,11 +193,47 @@ function sync_package() { - global $config; - /* create /usr/local/etc/rc.d/carp.sh here */ - - } - sync_package(); + /* + * XXX: find out how many carp and pfsync interfaces are established + * and destroy/down them before sweeping through the list + */ + $fout = fopen("/usr/local/etc/rc.d/carp.sh","w"); + fwrite($fout, "#!/bin/sh \n"); + global $config; + $using_arp_balance = 0; + $using_preempt = 0; + $carp_instances_counter = 0; + $pfsync_instances_counter = 0; + if($config['installedpackages']['carp']['config'] != "") { + foreach($config['installedpackages']['carp']['config'] as $carp) { + $pfsync = 0; + /* + * create the carp interface + */ + system("/sbin/ifconfig carp" . $carp_instances_counter . " create"); + $broadcast_address = gen_subnet_max($carp['ipaddress'], $carp['netmask']); + $carp_command = "/sbin/ifconfig carp" . $carp_instances_counter . " " . $carp['ipaddress'] . " " . $carp['netmask'] . " broadcast " . $broadcast_address . " vhid " . $carp['vhid'] . $carp['advskew '] . " pass " . $carp['password']; + if($carp['balancing'] == "true") $using_arp_balance = 1; + if($carp['preempt'] == "true") $using_preempt = 1; + fwrite($fout, $carp_command . "\n"); + if($carp['pfsync'] != "") $pfsync = 1; + if($pfsync != 0) { + /* + * user has selected pfsync, bring it up. + */ + fwrite($fout, "/sbin/ifconfig pfsync" . $pfsync_instances_counter . " create \n"); + fwrite($fout, "/sbin/ifconfig pfsync" . $pfsync_instances_counter . " up syncif " . $carp['synciface'] . "\n"); + $pfsync_instances_counter++; + } + $carp_instances_counter++; + } + } + fclose($fout); + system("chmod a+x /usr/local/etc/rc.d/carp.sh"); + system("/usr/local/etc/rc.d/carp.sh"); + if($using_arp_balance == 1) system("sysctl net.inet.arpbalance=1"); + if($preempt == 1) system("sysctl net.inet.carp.preempt=1"); + sync_package(); sync_package(); -- cgit v1.2.3