Project

General

Profile

« Previous | Next » 

Revision 2972b3e7

Added by Seth Mos about 13 years ago

Now that we actually have a IP protocol tag in the config.xml we can make this check a lot simpler and do less guessing.
Redmine ticket #2503

View differences:

usr/local/www/system_gateways_edit.php
150 150
	if (($_POST['monitor'] <> "") && !is_ipaddr($_POST['monitor']) && $_POST['monitor'] != "dynamic") {
151 151
		$input_errors[] = gettext("A valid monitor IP address must be specified.");
152 152
	}
153
	/* only allow correct IPv4 and IPv6 gateway addresses */
154
	if (($_POST['gateway'] <> "") && is_ipaddr($_POST['gateway']) && $_POST['gateway'] != "dynamic") {
155
		if(is_ipaddrv6($_POST['gateway']) && ($_POST['ipprotocol'] == "inet")) {
156
			$input_errors[] = gettext("The IPv6 gateway address '{$_POST['gateway']}' can not be used as a IPv4 gateway'.");
157
		}
158
		if(is_ipaddrv4($_POST['gateway']) && ($_POST['ipprotocol'] == "inet6")) {
159
			$input_errors[] = gettext("The IPv4 gateway address '{$_POST['gateway']}' can not be used as a IPv6 gateway'.");
160
		}
161
	}
162
	/* only allow correct IPv4 and IPv6 monitor addresses */
153 163
	if (($_POST['monitor'] <> "") && is_ipaddr($_POST['monitor']) && $_POST['monitor'] != "dynamic") {
154
		/* check if we can figure out the address family */
155
		if(is_ipaddrv6($_POST['monitor']) && (interface_has_gatewayv6($_POST['interface'])) && $_POST['gateway'] != "dynamic") {
156
			$input_errors[] = gettext("The IPv6 monitor address '{$_POST['monitor']}' can not be used with a IPv4 gateway'.");
164
		if(is_ipaddrv6($_POST['monitor']) && ($_POST['ipprotocol'] == "inet")) {
165
			$input_errors[] = gettext("The IPv6 monitor address '{$_POST['monitor']}' can not be used on a IPv4 gateway'.");
157 166
		}
158
		if(is_ipaddrv4($_POST['monitor']) && (interface_has_gateway($_POST['interface'])) && $_POST['gateway'] != "dynamic") {
159
			$input_errors[] = gettext("The IPv6 monitor address '{$_POST['monitor']}' can not be used with a IPv4 gateway'.");
167
		if(is_ipaddrv4($_POST['monitor']) && ($_POST['ipprotocol'] == "inet6")) {
168
			$input_errors[] = gettext("The IPv4 monitor address '{$_POST['monitor']}' can not be used on a IPv6 gateway'.");
160 169
		}
161 170
	}
162 171

  

Also available in: Unified diff