Project

General

Profile

« Previous | Next » 

Revision e7d3b8f4

Added by Seth Mos over 15 years ago

Add input validation to check if the gateway IP is in the local subnet for that interface.
Needs testing, no idea if this works for ppp or pppoe interfaces.

View differences:

usr/local/www/system_gateways_edit.php
93 93
	if ($_POST['gateway'] && (!is_ipaddr($_POST['gateway'])) && ($pconfig['attribute'] != "system")) {
94 94
		$input_errors[] = "A valid gateway IP address must be specified.";
95 95
	}
96
	if ($_POST['gateway'] && (is_ipaddr($_POST['gateway'])) && ($pconfig['attribute'] != "system")) {
97
		if(! ip_in_subnet($_POST['gateway']), get_interface_subnet($interface)) {
98
			$input_errors[] = "The Address {$_POST['gateway']} does not lie in the interface subnet";                
99
		}
100
	}
96 101
	if ((($_POST['monitor'] <> "") && !is_ipaddr($_POST['monitor']))) {
97 102
		$input_errors[] = "A valid monitor IP address must be specified.";
98 103
	}

Also available in: Unified diff