diff options
author | Renato Botelho <garga@FreeBSD.org> | 2013-12-04 18:20:58 -0200 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2013-12-04 18:21:18 -0200 |
commit | 20dda766516f943339799abc31f7c3640fff3195 (patch) | |
tree | 865cc0b19432fed27b693d21cab1088c4500b2a6 /usr/local/www/wizards | |
parent | f51fa0d411483ac3b645c1c4cd21d54256b20ad3 (diff) | |
download | pfsense-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 'usr/local/www/wizards')
-rw-r--r-- | usr/local/www/wizards/setup_wizard.xml | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/usr/local/www/wizards/setup_wizard.xml b/usr/local/www/wizards/setup_wizard.xml index db9f05d..daf32dd 100644 --- a/usr/local/www/wizards/setup_wizard.xml +++ b/usr/local/www/wizards/setup_wizard.xml @@ -409,9 +409,17 @@ print_info_box_np("Invalid MAC Address. Please press back in your browser window and correct."); die; } - if(!empty($_POST['ipaddress']) && ($_POST['selectedtype'] == "Static") && (!is_ipaddr($_POST['ipaddress']))) { - print_info_box_np("Invalid WAN IP Address. Please press back in your browser window and correct."); - die; + if(!empty($_POST['ipaddress']) && ($_POST['selectedtype'] == "Static")) { + if (!is_ipaddr($_POST['ipaddress'])) { + print_info_box_np("Invalid WAN IP Address. Please press back in your browser window and correct."); + die; + } + if ($_POST['subnetmask'] < 31 && + ($_POST['ipaddress'] == gen_subnet($_POST['ipaddress'], $_POST['subnetmask']) || + $_POST['ipaddress'] == gen_subnet_max($_POST['ipaddress'], $_POST['subnetmask']))) { + print_info_box_np("Invalid WAN IP Address. Please press back in your browser window and correct."); + die; + } } if(!empty($_POST['dhcphostname']) && !is_hostname($_POST['dhcphostname'])) { print_info_box_np("Invalid DHCP Hostname. Please press back in your browser window and correct."); @@ -509,6 +517,12 @@ print_info_box_np("Invalid LAN IP Address. Please press back in your browser window and correct."); die; } + if ($_POST['subnetmask'] < 31 && + ($_POST['lanipaddress'] == gen_subnet($_POST['lanipaddress'], $_POST['subnetmask']) || + $_POST['lanipaddress'] == gen_subnet_max($_POST['lanipaddress'], $_POST['subnetmask']))) { + print_info_box_np("Invalid LAN IP Address. Please press back in your browser window and correct."); + die; + } $ft = explode(".", $_POST['lanipaddress']); $ft_ip = $ft[0] . "." . $ft[1] . "." . $ft[2] . "."; $config['dhcpd']['lan']['range']['from'] = $ft_ip . "10"; |