Project

General

Profile

« Previous | Next » 

Revision 74889b22

Added by Renato Botelho over 12 years ago

When adding a new static route, check if network address conflicts with interfaces. It will complement ticket #2852

View differences:

usr/local/www/system_routes_edit.php
158 158
		$input_errors[] = gettext("A route to these destination networks already exists") . ": " . implode(", ", $overlaps);
159 159
	}
160 160

  
161
	if (is_array($config['interfaces'])) {
162
		foreach ($config['interfaces'] as $if) {
163
			if (is_ipaddrv4($_POST['network'])
164
				&& isset($if['ipaddr']) && isset($if['subnet'])
165
				&& is_ipaddrv4($if['ipaddr']) && is_numeric($if['subnet'])
166
				&& ($_POST['network_subnet'] == $if['subnet'])
167
				&& (gen_subnet($_POST['network'], $_POST['network_subnet']) == gen_subnet($if['ipaddr'], $if['subnet'])))
168
					$input_errors[] = sprintf(gettext("This network conflicts with address configured on interface %s."), $if['descr']);
169

  
170
			else if (is_ipaddrv6($_POST['network'])
171
				&& isset($if['ipaddrv6']) && isset($if['subnetv6'])
172
				&& is_ipaddrv6($if['ipaddrv6']) && is_numeric($if['subnetv6'])
173
				&& ($_POST['network_subnet'] == $if['subnetv6'])
174
				&& (gen_subnetv6($_POST['network'], $_POST['network_subnet']) == gen_subnetv6($if['ipaddrv6'], $if['subnetv6'])))
175
					$input_errors[] = sprintf(gettext("This network conflicts with address configured on interface %s."), $if['descr']);
176
		}
177
	}
178

  
161 179
	if (!$input_errors) {
162 180
		$route = array();
163 181
		$route['network'] = $osn;

Also available in: Unified diff