summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2013-02-13 22:40:22 +0000
committerErmal <eri@pfsense.org>2013-02-13 22:40:22 +0000
commita1e4e2a79fce4c734cf3d8e485531f60da5763e8 (patch)
tree4726208cfc520ee50772f7d8d593c482bb0e865b
parent72f25519a9ee36cd9c0ba33a3b8736ef0fb7ae26 (diff)
downloadpfsense-a1e4e2a79fce4c734cf3d8e485531f60da5763e8.zip
pfsense-a1e4e2a79fce4c734cf3d8e485531f60da5763e8.tar.gz
Two interfaces, carp, ip aliases might be on the same subnet as their parent. What needs to be checked is the ip itself
-rw-r--r--etc/inc/pfsense-utils.inc21
-rw-r--r--etc/inc/util.inc11
-rwxr-xr-xusr/local/www/firewall_virtual_ip_edit.php2
-rwxr-xr-xusr/local/www/interfaces.php2
4 files changed, 20 insertions, 16 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index bba28dd..47469d8 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -2444,6 +2444,15 @@ function is_ipaddr_configured($ipaddr, $ignore_if = "", $check_localip = false,
if (ip_in_subnet($ipaddr, $subnet . '/' . $bitmask))
return true;
}
+
+ $interface_list_vips = get_configured_vips_list(true);
+ foreach ($interface_list_vips as $id => $vip) {
+ if ($ignore_if == "vip_{$id}")
+ continue;
+ if (strcasecmp($ipaddr, $vip['ipaddr']) == 0)
+ return true;
+ }
+
} else {
$interface_list_ips = get_configured_ip_addresses();
foreach($interface_list_ips as $if => $ilips) {
@@ -2454,19 +2463,11 @@ function is_ipaddr_configured($ipaddr, $ignore_if = "", $check_localip = false,
}
}
- $interface_list_vips = get_configured_vips_list();
- foreach($interface_list_vips as $id => $vip) {
- if ($ignore_if == "vip_" . $id)
- continue;
- if (strcasecmp($ipaddr, $vip['ipaddr']) == 0)
- return true;
- }
-
if ($check_localip) {
- if (isset($config['pptpd']['localip']) && (strcasecmp($ipaddr, $config['pptpd']['localip']) == 0))
+ if (is_array($config['pptpd']) && !empty($config['pptpd']['localip']) && (strcasecmp($ipaddr, $config['pptpd']['localip']) == 0))
return true;
- if (isset($config['l2tp']['localip']) && (strcasecmp($ipaddr, $config['l2tp']['localip']) == 0))
+ if (!is_array($config['l2tp']) && !empty($config['l2tp']['localip']) && (strcasecmp($ipaddr, $config['l2tp']['localip']) == 0))
return true;
}
diff --git a/etc/inc/util.inc b/etc/inc/util.inc
index fb495f4..3c78f95 100644
--- a/etc/inc/util.inc
+++ b/etc/inc/util.inc
@@ -836,22 +836,24 @@ function get_configured_interface_with_descr($only_opt = false, $withdisabled =
*/
function get_configured_ip_addresses() {
global $config;
- require_once("interfaces.inc");
+
+ if (!function_exists('get_configured_interface_list'))
+ require_once("interfaces.inc");
$ip_array = array();
$interfaces = get_configured_interface_list();
- if(is_array($interfaces)) {
+ if (is_array($interfaces)) {
foreach($interfaces as $int) {
$ipaddr = get_interface_ip($int);
$ip_array[$int] = $ipaddr;
}
}
$interfaces = get_configured_carp_interface_list();
- if(is_array($interfaces))
+ if (is_array($interfaces))
foreach($interfaces as $int => $ipaddr)
$ip_array[$int] = $ipaddr;
/* pppoe server */
- if (is_array($config['pppoes']['pppoe'])) {
+ if (is_array($config['pppoes']) && is_array($config['pppoes']['pppoe'])) {
foreach($config['pppoes']['pppoe'] as $pppoe) {
if ($pppoe['mode'] == "server") {
if(is_ipaddr($pppoe['localip'])) {
@@ -861,6 +863,7 @@ function get_configured_ip_addresses() {
}
}
}
+
return $ip_array;
}
diff --git a/usr/local/www/firewall_virtual_ip_edit.php b/usr/local/www/firewall_virtual_ip_edit.php
index d28d55c..6cd6cb8 100755
--- a/usr/local/www/firewall_virtual_ip_edit.php
+++ b/usr/local/www/firewall_virtual_ip_edit.php
@@ -113,7 +113,7 @@ if ($_POST) {
if ($_POST['subnet']) {
if (!is_ipaddr($_POST['subnet']))
$input_errors[] = gettext("A valid IP address must be specified.");
- else if (is_ipaddr_configured($_POST['subnet'], "vip_" . $id, true))
+ else if (is_ipaddr_configured($_POST['subnet'], "vip_" . $id))
$input_errors[] = gettext("This IPv4 address is being used by another interface or VIP.");
}
diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php
index fcd7b51..5062b36 100755
--- a/usr/local/www/interfaces.php
+++ b/usr/local/www/interfaces.php
@@ -547,7 +547,7 @@ if ($_POST['apply']) {
if ($_POST['ipaddr']) {
if (!is_ipaddrv4($_POST['ipaddr']))
$input_errors[] = gettext("A valid IPv4 address must be specified.");
- else if (is_ipaddr_configured($_POST['ipaddr'], $if, true, true))
+ else if (is_ipaddr_configured($_POST['ipaddr'], $if, true))
$input_errors[] = gettext("This IPv4 address is being used by another interface or VIP.");
}
if (($_POST['ipaddrv6'] && !is_ipaddrv6($_POST['ipaddrv6'])))
OpenPOWER on IntegriCloud