summaryrefslogtreecommitdiffstats
path: root/usr/local/www/interfaces.php
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-12-04 18:20:58 -0200
committerRenato Botelho <garga@FreeBSD.org>2013-12-04 18:21:30 -0200
commit21d74c8e79948cd05c11f0ab79a463aea4bff2ce (patch)
tree69de2ba5388c0bd1b3d8aa8eaa264561e9853a9b /usr/local/www/interfaces.php
parentf70a140fe18cb80012e53f82c268788fbcae5436 (diff)
downloadpfsense-21d74c8e79948cd05c11f0ab79a463aea4bff2ce.zip
pfsense-21d74c8e79948cd05c11f0ab79a463aea4bff2ce.tar.gz
Prevent network or broadcast address to be set on interface (console, GUI and wizard). It should fix #3196
Diffstat (limited to 'usr/local/www/interfaces.php')
-rwxr-xr-xusr/local/www/interfaces.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php
index e0ab071..4b74997 100755
--- a/usr/local/www/interfaces.php
+++ b/usr/local/www/interfaces.php
@@ -557,6 +557,14 @@ if ($_POST['apply']) {
if (is_ipaddr_configured($_POST['ipaddr'], $if, true))
$input_errors[] = gettext("This IPv4 address is being used by another interface or VIP.");
+ /* Do not accept network or broadcast address, except if subnet is 31 or 32 */
+ if ($_POST['subnet'] < 31) {
+ if ($_POST['ipaddr'] == gen_subnet($_POST['ipaddr'], $_POST['subnet']))
+ $input_errors[] = gettext("This IPv4 address is the network address and cannot be used");
+ else if ($_POST['ipaddr'] == gen_subnet_max($_POST['ipaddr'], $_POST['subnet']))
+ $input_errors[] = gettext("This IPv4 address is the broadcast address and cannot be used");
+ }
+
foreach ($staticroutes as $route_subnet) {
list($network, $subnet) = explode("/", $route_subnet);
if ($_POST['subnet'] == $subnet && $network == gen_subnet($_POST['ipaddr'], $_POST['subnet'])) {
OpenPOWER on IntegriCloud