Project

General

Profile

« Previous | Next » 

Revision 7617e245

Added by Seth Mos over 14 years ago

Verify that we validate against a ipv6 subnet properly. This should help for static route gateways

View differences:

usr/local/www/system_gateways_edit.php
118 118
		} else {		
119 119
			$parent_ip = get_interface_ip($_POST['interface']);
120 120
		}
121
		if (is_ipaddr($parent_ip)) {
121
		if (is_ipaddrv4($parent_ip)) {
122 122
			$parent_sn = get_interface_subnet($_POST['interface']);
123 123
			if(!ip_in_subnet($_POST['gateway'], gen_subnet($parent_ip, $parent_sn) . "/" . $parent_sn)) {
124 124
				$input_errors[] = sprintf(gettext("The gateway address %s does not lie within the chosen interface's subnet."), $_POST['gateway']);
125 125
			}
126 126
		}
127
		if (is_ipaddrv6($parent_ip)) {
128
			$parent_sn = get_interface_subnetv6($_POST['interface']);
129
			if(!ip_in_subnet($_POST['gateway'], gen_subnetv6($parent_ip, $parent_sn) . "/" . $parent_sn)) {
130
				$input_errors[] = sprintf(gettext("The gateway address %s does not lie within the chosen interface's subnet."), $_POST['gateway']);
131
			}
132
		}
127 133
	}
128 134
	if (($_POST['monitor'] <> "") && !is_ipaddr($_POST['monitor']) && $_POST['monitor'] != "dynamic") {
129 135
		$input_errors[] = gettext("A valid monitor IP address must be specified.");

Also available in: Unified diff