From faeb7cdd0ddb69f5d2eea33168ea0857c2bf7dd0 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Fri, 23 Sep 2005 00:13:14 +0000 Subject: [PATCH] Reboot after restore --- etc/inc/interfaces.inc | 43 +++++++++++++++++++++++++---------- usr/local/www/diag_backup.php | 4 ++-- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index ca9fa0eaff..1cb842ba07 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -351,7 +351,8 @@ function interfaces_carp_configure() { $carpdev = " carpdev {$ci} "; } */ - mwexec("/sbin/ifconfig carp" . $carp_instances_counter . " " . $vip['subnet'] . "/" . $vip['subnet_bits'] . " broadcast " . $broadcast_address . " vhid " . $vip['vhid'] . "{$carpdev} advskew " . $vip['advskew'] . $password); + mwexec("/sbin/ifconfig carp" . $carp_instances_counter . " " . $vip['subnet'] . "/" . $vip['subnet_bits'] . " broadcast " . $broadcast_address . " vhid " . $vip['vhid'] . "{$carpdev} advskew 50 " . $password ." up"); + mwexec("/sbin/ifconfig carp{$carp_instances_counter} up"); $carp_instances_counter++; } } @@ -359,10 +360,6 @@ function interfaces_carp_configure() { /* hush little pfsync, don't say a word. GeekGod's gonna buy you a mocking bird. */ mwexec("/sbin/ifconfig pfsync0 syncdev lo0 up"); - } - /* remove any dangling carp references */ - for($x=$carp_instances_counter; $x<$total_carp_interfaces_defined; $x++) { - mwexec("/sbin/ifconfig carp{$x} down"); } unmute_kernel_msgs(); if ($g['booting']) { @@ -372,13 +369,35 @@ function interfaces_carp_configure() { } function interfaces_carp_bringup() { - global $g; - /* lets bring the carp interfaces up now */ - if ($g['booting']) - sleep(2); + global $g, $config; + sleep(5); + if($g['booting']) + sleep(15); + $carp_instances_counter=0; + /* lets bring the carp interfaces up now by changing advskew back down */ $carp_ints = find_number_of_created_carp_interfaces(); - for($x=0; $x<$carp_ints; $x++) - mwexec("/sbin/ifconfig carp{$x} up"); + $viparr = &$config['virtualip']['vip']; + foreach ($viparr as $vip) { + if ($vip['mode'] == "carp") { + /* + * create the carp interface + */ + $broadcast_address = gen_subnet_max($vip['subnet'], $vip['subnet_bits']); + if($vip['password'] != "") { + $password = " pass " . $vip['password']; + } + /* XXX: billm - carpdev not in our build? + $carpdev = ""; + if(isset($vip['interface']) && ($vip['interface'] != "AUTO" && $vip['interface'] != "")) { + $ci = filter_opt_interface_to_real($vip['interface']); + $carpdev = " carpdev {$ci} "; + } + */ + mwexec("/sbin/ifconfig carp" . $carp_instances_counter . " " . $vip['subnet'] . "/" . $vip['subnet_bits'] . " broadcast " . $broadcast_address . " vhid " . $vip['vhid'] . "{$carpdev} advskew {$vip['advskew']} " . $password . " up"); + echo "/sbin/ifconfig carp" . $carp_instances_counter . " " . $vip['subnet'] . "/" . $vip['subnet_bits'] . " broadcast " . $broadcast_address . " vhid " . $vip['vhid'] . "{$carpdev} advskew {$vip['advskew']} " . $password . " up\n"; + $carp_instances_counter++; + } + } } function interfaces_wireless_configure($if, $wlcfg) { @@ -1226,4 +1245,4 @@ function is_altq_capable($int) { } -?> +?> \ No newline at end of file diff --git a/usr/local/www/diag_backup.php b/usr/local/www/diag_backup.php index 51f87f51fb..c416dd1191 100755 --- a/usr/local/www/diag_backup.php +++ b/usr/local/www/diag_backup.php @@ -151,7 +151,7 @@ if ($_POST) { touch("/needs_package_sync"); conf_mount_ro(); $reloadall = true; - $savemsg = "The configuration has been restored. The firewall is now reloading the settings."; + $savemsg = "The configuration has been restored. The firewall is now rebooting."; } else { $input_errors[] = "The configuration could not be restored."; } @@ -267,7 +267,7 @@ include("head.inc");