summaryrefslogtreecommitdiffstats
path: root/etc/rc.initial.setlanip
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:18 -0200
commit20dda766516f943339799abc31f7c3640fff3195 (patch)
tree865cc0b19432fed27b693d21cab1088c4500b2a6 /etc/rc.initial.setlanip
parentf51fa0d411483ac3b645c1c4cd21d54256b20ad3 (diff)
downloadpfsense-20dda766516f943339799abc31f7c3640fff3195.zip
pfsense-20dda766516f943339799abc31f7c3640fff3195.tar.gz
Prevent network or broadcast address to be set on interface (console, GUI and wizard). It should fix #3196
Diffstat (limited to 'etc/rc.initial.setlanip')
-rwxr-xr-xetc/rc.initial.setlanip13
1 files changed, 12 insertions, 1 deletions
diff --git a/etc/rc.initial.setlanip b/etc/rc.initial.setlanip
index 14213b5..8273073 100755
--- a/etc/rc.initial.setlanip
+++ b/etc/rc.initial.setlanip
@@ -283,8 +283,19 @@ function console_configure_ip_address($version) {
echo "\n" . sprintf(gettext("Enter the new %s %s subnet bit count:"),
$upperifname, $label_IPvX) . "\n> ";
$intbits = chop(fgets($fp));
+ $intbits_ok = is_numeric($intbits) && (($intbits >= 1) || ($intbits <= $maxbits));
$restart_dhcpd = true;
- } while (!is_numeric($intbits) || ($intbits < 1) || ($intbits > $maxbits));
+
+ if ($version === 4 && $intbits < $maxbits) {
+ if ($intip == gen_subnet($intip, $intbits)) {
+ echo gettext("You cannot set network address to an interface");
+ $intbits_ok = false;
+ } else if ($intip == gen_subnet_max($intip, $intbits)) {
+ echo gettext("You cannot set broadcast address to an interface");
+ $intbits_ok = false;
+ }
+ }
+ } while (!$intbits_ok);
if ($version === 6) {
$subnet = gen_subnetv6($intip, $intbits);
OpenPOWER on IntegriCloud