summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2008-02-03 05:05:26 +0000
committerScott Ullrich <sullrich@pfsense.org>2008-02-03 05:05:26 +0000
commitbb0e29e8f74344a89982c7b088ccbe63f34b6161 (patch)
treef2ef9bce972ff765afa4daff83b37a277b4eb8ef
parent9c9fd51686966c161c00c5ad892e33ca387ebd87 (diff)
downloadpfsense-bb0e29e8f74344a89982c7b088ccbe63f34b6161.zip
pfsense-bb0e29e8f74344a89982c7b088ccbe63f34b6161.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 cad6346..4a3c244 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