summaryrefslogtreecommitdiffstats
path: root/usr/local/www
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2015-04-15 09:24:02 -0300
committerRenato Botelho <garga@FreeBSD.org>2015-04-15 09:24:02 -0300
commitfc70ad875b4c677d6db2b83b99f1ca5d3fe6a77f (patch)
treedfd87aed2c9171bc9720f625a4ab473102a4762a /usr/local/www
parent2195baef904dea932c8e36d8ef041e9b2e31e646 (diff)
parent3490b8ddaea5944d9dd4b93ab1f28398170ee181 (diff)
downloadpfsense-fc70ad875b4c677d6db2b83b99f1ca5d3fe6a77f.zip
pfsense-fc70ad875b4c677d6db2b83b99f1ca5d3fe6a77f.tar.gz
Merge pull request #1601 from phil-davis/check-overlapping-subnets
Diffstat (limited to 'usr/local/www')
-rw-r--r--usr/local/www/interfaces.php20
1 files changed, 16 insertions, 4 deletions
diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php
index 62cf658..89cff44 100644
--- a/usr/local/www/interfaces.php
+++ b/usr/local/www/interfaces.php
@@ -636,8 +636,14 @@ if ($_POST['apply']) {
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.");
+ $where_ipaddr_configured = where_is_ipaddr_configured($_POST['ipaddr'], $if, true, true, $_POST['subnet']);
+ if (count($where_ipaddr_configured)) {
+ $subnet_conflict_text = sprintf(gettext("IPv4 address %s is being used by or overlaps with:"), $_POST['ipaddr'] . "/" . $_POST['subnet']);
+ foreach ($where_ipaddr_configured as $subnet_conflict) {
+ $subnet_conflict_text .= " " . convert_friendly_interface_to_friendly_descr($subnet_conflict['if']) . " (" . $subnet_conflict['ip_or_subnet'] . ")";
+ }
+ $input_errors[] = $subnet_conflict_text;
+ }
/* Do not accept network or broadcast address, except if subnet is 31 or 32 */
if ($_POST['subnet'] < 31) {
@@ -661,8 +667,14 @@ if ($_POST['apply']) {
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.");
+ $where_ipaddr_configured = where_is_ipaddr_configured($_POST['ipaddrv6'], $if, true, true, $_POST['subnetv6']);
+ if (count($where_ipaddr_configured)) {
+ $subnet_conflict_text = sprintf(gettext("IPv6 address %s is being used by or overlaps with:"), $_POST['ipaddrv6'] . "/" . $_POST['subnetv6']);
+ foreach ($where_ipaddr_configured as $subnet_conflict) {
+ $subnet_conflict_text .= " " . convert_friendly_interface_to_friendly_descr($subnet_conflict['if']) . " (" . $subnet_conflict['ip_or_subnet'] . ")";
+ }
+ $input_errors[] = $subnet_conflict_text;
+ }
foreach ($staticroutes as $route_subnet) {
list($network, $subnet) = explode("/", $route_subnet);
OpenPOWER on IntegriCloud