summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2008-02-03 05:06:05 +0000
committerScott Ullrich <sullrich@pfsense.org>2008-02-03 05:06:05 +0000
commit0a532641b4c9875b7ec5ab5869545b8407baf4a3 (patch)
treebe598023698861928992bd00f4dec80ccb4b54b3
parentfcc2fc6c3cda29c895bd923b86a6e049ac3dbc46 (diff)
downloadpfsense-0a532641b4c9875b7ec5ab5869545b8407baf4a3.zip
pfsense-0a532641b4c9875b7ec5ab5869545b8407baf4a3.tar.gz
Do not load CARP IP address if we cannot find a matching subnet on a
real interface.
-rw-r--r--etc/inc/interfaces.inc15
1 files changed, 15 insertions, 0 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 053b163..2a933c5 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -437,6 +437,21 @@ function interfaces_carp_configure() {
if ($vip['mode'] == "carp") {
$vip_password = $vip['password'];
$vip_password = str_replace(" ", "", $vip_password);
+
+ /* ensure CARP IP really exists prior to loading up */
+ $found = false;
+ $iflist = array("lan", "wan");
+ for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++)
+ $iflist['opt' . $i] = 'opt' . $i;
+ foreach($iflist as $if) {
+ $ww_subnet_ip = $config['interfaces'][$if]['ipaddr'];
+ $ww_subnet_bits = $config['interfaces'][$if]['subnet'];
+ if (ip_in_subnet($vip['subnet'], gen_subnet($ww_subnet_ip, $ww_subnet_bits) . "/" . $ww_subnet_bits))
+ $found = true;
+ }
+ if($found == false)
+ continue;
+
/* create the carp interface and setup */
mwexec("/sbin/ifconfig carp" . $carp_instances_counter . " create");
OpenPOWER on IntegriCloud