Revision 42fa2c01
Added by Renato Botelho over 12 years ago
usr/local/www/interfaces.php | ||
---|---|---|
543 | 543 |
|
544 | 544 |
|
545 | 545 |
/* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */ |
546 |
$staticroutes = get_staticroutes(true); |
|
546 | 547 |
$_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac'])); |
547 | 548 |
if ($_POST['ipaddr']) { |
548 | 549 |
if (!is_ipaddrv4($_POST['ipaddr'])) |
549 | 550 |
$input_errors[] = gettext("A valid IPv4 address must be specified."); |
550 |
else if (is_ipaddr_configured($_POST['ipaddr'], $if, true)) |
|
551 |
$input_errors[] = gettext("This IPv4 address is being used by another interface or VIP."); |
|
551 |
else { |
|
552 |
if (is_ipaddr_configured($_POST['ipaddr'], $if, true)) |
|
553 |
$input_errors[] = gettext("This IPv4 address is being used by another interface or VIP."); |
|
554 |
|
|
555 |
foreach ($staticroutes as $route_subnet) { |
|
556 |
if (ip_in_subnet($_POST['ipaddr'], $route_subnet)) { |
|
557 |
$input_errors[] = gettext("This IPv4 address conflicts with a Static Route."); |
|
558 |
break; |
|
559 |
} |
|
560 |
} |
|
561 |
} |
|
552 | 562 |
} |
553 | 563 |
if ($_POST['ipaddrv6']) { |
554 | 564 |
if (!is_ipaddrv6($_POST['ipaddrv6'])) |
555 | 565 |
$input_errors[] = gettext("A valid IPv6 address must be specified."); |
556 |
else if (is_ipaddr_configured($_POST['ipaddrv6'], $if, true)) |
|
557 |
$input_errors[] = gettext("This IPv6 address is being used by another interface or VIP."); |
|
566 |
else { |
|
567 |
if (is_ipaddr_configured($_POST['ipaddrv6'], $if, true)) |
|
568 |
$input_errors[] = gettext("This IPv6 address is being used by another interface or VIP."); |
|
569 |
|
|
570 |
foreach ($staticroutes as $route_subnet) { |
|
571 |
if (ip_in_subnet($_POST['ipaddrv6'], $route_subnet)) { |
|
572 |
$input_errors[] = gettext("This IPv6 address conflicts with a Static Route."); |
|
573 |
break; |
|
574 |
} |
|
575 |
} |
|
576 |
} |
|
558 | 577 |
} |
559 | 578 |
if (($_POST['subnet'] && !is_numeric($_POST['subnet']))) |
560 | 579 |
$input_errors[] = gettext("A valid subnet bit count must be specified."); |
Also available in: Unified diff
Avoid conflicting interface IP address with static routes. Fixes #2039