summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Buechler <cmb@pfsense.org>2008-12-07 23:51:33 +0000
committerChris Buechler <cmb@pfsense.org>2008-12-07 23:51:33 +0000
commitf11deb5bf45e982440094131004e13577f3e26c5 (patch)
tree86187e1d07353606fe3aa7f23d844d5bf7ed18ec
parent61c6b6c1ffa1e57c17c6096c41c15654de9a7970 (diff)
downloadpfsense-f11deb5bf45e982440094131004e13577f3e26c5.zip
pfsense-f11deb5bf45e982440094131004e13577f3e26c5.tar.gz
Don't add CARP IPs on an interface that doesn't exist to prevent panic.
-rw-r--r--etc/inc/interfaces.inc11
1 files changed, 10 insertions, 1 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index ca06084..c006c5d 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -865,7 +865,16 @@ function interfaces_carp_configure() {
if($found == false) {
file_notice("CARP", "Sorry but we could not find a matching real interface subnet for the virtual IP address {$vip['subnet']}.", "Firewall: Virtual IP", "");
continue;
- }
+ }
+ /* ensure the interface containing the VIP really exists
+ prevents a panic if the interface is missing or invalid
+ */
+ $realif = convert_friendly_interface_to_real_interface_name($vip['interface']);
+ $intcount = exec("/sbin/ifconfig | grep $realif | wc -l | awk '{print $1}'");
+ if($intcount < 1) {
+ file_notice("CARP", "Interface specified for the virtual IP address {$vip['subnet']} does not exist. Skipping this VIP.", "Firewall: Virtual IP", "");
+ continue;
+ }
/* create the carp interface and setup */
$cmdchain->add("create CARP interface", "/sbin/ifconfig {$carpint} create", false);
OpenPOWER on IntegriCloud