Project

General

Profile

« Previous | Next » 

Revision 20dda766

Added by Renato Botelho over 11 years ago

Prevent network or broadcast address to be set on interface (console, GUI and wizard). It should fix #3196

View differences:

usr/local/www/wizards/setup_wizard.xml
409 409
			print_info_box_np("Invalid MAC Address. Please press back in your browser window and correct.");
410 410
			die;
411 411
		}
412
		if(!empty($_POST['ipaddress']) && ($_POST['selectedtype'] == "Static") && (!is_ipaddr($_POST['ipaddress']))) {
413
			print_info_box_np("Invalid WAN IP Address. Please press back in your browser window and correct.");
414
			die;
412
		if(!empty($_POST['ipaddress']) && ($_POST['selectedtype'] == "Static")) {
413
			if (!is_ipaddr($_POST['ipaddress'])) {
414
				print_info_box_np("Invalid WAN IP Address. Please press back in your browser window and correct.");
415
				die;
416
			}
417
			if ($_POST['subnetmask'] < 31 &&
418
			    ($_POST['ipaddress'] == gen_subnet($_POST['ipaddress'], $_POST['subnetmask']) ||
419
			     $_POST['ipaddress'] == gen_subnet_max($_POST['ipaddress'], $_POST['subnetmask']))) {
420
				print_info_box_np("Invalid WAN IP Address. Please press back in your browser window and correct.");
421
				die;
422
			}
415 423
		}
416 424
		if(!empty($_POST['dhcphostname']) && !is_hostname($_POST['dhcphostname'])) {
417 425
			print_info_box_np("Invalid DHCP Hostname. Please press back in your browser window and correct.");
......
509 517
			print_info_box_np("Invalid LAN IP Address. Please press back in your browser window and correct.");
510 518
			die;
511 519
		}
520
		if ($_POST['subnetmask'] < 31 &&
521
		    ($_POST['lanipaddress'] == gen_subnet($_POST['lanipaddress'], $_POST['subnetmask']) ||
522
		     $_POST['lanipaddress'] == gen_subnet_max($_POST['lanipaddress'], $_POST['subnetmask']))) {
523
			print_info_box_np("Invalid LAN IP Address. Please press back in your browser window and correct.");
524
			die;
525
		}
512 526
		$ft = explode(".", $_POST['lanipaddress']);
513 527
		$ft_ip = $ft[0] . "." . $ft[1] . "." . $ft[2] . ".";
514 528
		$config['dhcpd']['lan']['range']['from'] = $ft_ip . "10";

Also available in: Unified diff