summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-02-21 11:05:02 -0300
committerRenato Botelho <garga@FreeBSD.org>2013-02-21 11:05:02 -0300
commit42fa2c01422e57fddea07352029530ace34363c4 (patch)
treea71ac7691c4c65481bcdf1df47b2d068ab7f12a1
parentacc68ffad2fcc5f270964a51f9af84e969fa2d4f (diff)
downloadpfsense-42fa2c01422e57fddea07352029530ace34363c4.zip
pfsense-42fa2c01422e57fddea07352029530ace34363c4.tar.gz
Avoid conflicting interface IP address with static routes. Fixes #2039
-rwxr-xr-xusr/local/www/interfaces.php27
1 files changed, 23 insertions, 4 deletions
diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php
index 3552f33..dde7956 100755
--- a/usr/local/www/interfaces.php
+++ b/usr/local/www/interfaces.php
@@ -543,18 +543,37 @@ if ($_POST['apply']) {
/* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */
+ $staticroutes = get_staticroutes(true);
$_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac']));
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))
- $input_errors[] = gettext("This IPv4 address is being used by another interface or VIP.");
+ else {
+ if (is_ipaddr_configured($_POST['ipaddr'], $if, true))
+ $input_errors[] = gettext("This IPv4 address is being used by another interface or VIP.");
+
+ foreach ($staticroutes as $route_subnet) {
+ if (ip_in_subnet($_POST['ipaddr'], $route_subnet)) {
+ $input_errors[] = gettext("This IPv4 address conflicts with a Static Route.");
+ break;
+ }
+ }
+ }
}
if ($_POST['ipaddrv6']) {
if (!is_ipaddrv6($_POST['ipaddrv6']))
$input_errors[] = gettext("A valid IPv6 address must be specified.");
- else if (is_ipaddr_configured($_POST['ipaddrv6'], $if, true))
- $input_errors[] = gettext("This IPv6 address is being used by another interface or VIP.");
+ else {
+ if (is_ipaddr_configured($_POST['ipaddrv6'], $if, true))
+ $input_errors[] = gettext("This IPv6 address is being used by another interface or VIP.");
+
+ foreach ($staticroutes as $route_subnet) {
+ if (ip_in_subnet($_POST['ipaddrv6'], $route_subnet)) {
+ $input_errors[] = gettext("This IPv6 address conflicts with a Static Route.");
+ break;
+ }
+ }
+ }
}
if (($_POST['subnet'] && !is_numeric($_POST['subnet'])))
$input_errors[] = gettext("A valid subnet bit count must be specified.");
OpenPOWER on IntegriCloud