From 2f6f9dc381fee47735b8fdf2bcad02ca12540f6e Mon Sep 17 00:00:00 2001 From: Chris Buechler Date: Mon, 8 Dec 2008 02:31:36 +0000 Subject: [PATCH] fix CARP panics with VLANs --- etc/inc/interfaces.inc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 1621a29d9c..c305910ec9 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -68,7 +68,18 @@ function interface_vlan_configure($if, $tag, $vlanif = "") { mwexec("/sbin/ifconfig " . escapeshellarg($if) . " up vlanhwtag vlanmtu"); if ($g['booting'] || !(empty($vlanif))) { - mwexec("/sbin/ifconfig {$vlanif} destroy", true); + /* before destroying, see if CARP is in use + If an interface containing an active CARP IP is destroyed, + the CARP interface will hang in INIT and must be destroyed + itself before it will function again (which causes a panic). + Trying to configure a CARP interface stuck in INIT will + cause a panic as well. -cmb + */ + $carpcount = find_number_of_needed_carp_interfaces(); + /* will continue to destroy VLANs where CARP is not in use + to retain previous behavior and avoid regressions */ + if($carpcount < 1) + mwexec("/sbin/ifconfig {$vlanif} destroy"); mwexec("/sbin/ifconfig {$vlanif} create"); } else $vlanif = exec("/sbin/ifconfig vlan create");