summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2006-08-23 17:59:17 +0000
committerScott Ullrich <sullrich@pfsense.org>2006-08-23 17:59:17 +0000
commitc990c23f38bec8e87350a8072c9690c8534dd9c0 (patch)
treea7ac80d42cd4473d91e51814ff6fa094d66397c7 /etc
parenta320d8592add1dd570b78567e7f839656247a5e1 (diff)
downloadpfsense-c990c23f38bec8e87350a8072c9690c8534dd9c0.zip
pfsense-c990c23f38bec8e87350a8072c9690c8534dd9c0.tar.gz
Work around a FreeBSD bug in both RELENG_6_1 and do not destroy CARP interfaces unless absolutely necessary.
This will help minimize panics until this situation can be repaired.
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/pfsense-utils.inc25
1 files changed, 24 insertions, 1 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index 000778d..7a2f431 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -51,6 +51,24 @@ function get_tmp_file() {
return "/tmp/tmp-" . time();
}
+/****f* pfsense-utils/find_number_of_needed_carp_interfaces
+ * NAME
+ * find_number_of_needed_carp_interfaces
+ * INPUTS
+ * null
+ * RESULT
+ * the number of needed carp interfacs
+ ******/
+function find_number_of_needed_carp_interfaces() {
+ global $config, $g;
+ $carp_counter=0;
+ foreach($config['virtualip']['vip'] as $vip) {
+ if($vip['mode'] == "carp")
+ $carp_counter++;
+ }
+ return $carp_counter;
+}
+
/****f* pfsense-utils/reset_carp
* NAME
* reset_carp - resets carp after primary interface changes
@@ -61,10 +79,15 @@ function get_tmp_file() {
******/
function reset_carp() {
$carp_counter=find_number_of_created_carp_interfaces();
+ $needed_carp_interfaces = find_number_of_needed_carp_interfaces();
mwexec("/sbin/sysctl net.inet.carp.allow=0");
for($x=0; $x<$carp_counter; $x++) {
mwexec("/sbin/ifconfig carp{$x} down");
- mwexec("/sbin/ifconfig carp{$x} destroy");
+ mwexec("/sbin/ifconfig carp{$x} delete");
+ if($needed_carp_interfaces < $carp_counter) {
+ $needed_carp_interfaces--;
+ mwexec("/sbin/ifconfig carp{$x} destroy");
+ }
}
find_number_of_created_carp_interfaces(true);
sleep(1);
OpenPOWER on IntegriCloud