Project

General

Profile

« Previous | Next » 

Revision c82dcc1d

Added by Renato Botelho about 12 years ago

Permit to use aliases containing hostnames on static routes

View differences:

usr/local/www/firewall_aliases_edit.php
254 254
		}
255 255
	} else {
256 256
		/* item is a normal alias type */
257
		$used_for_routes = 0;
258
		if (isset($config['staticroutes']['route']) && is_array($config['staticroutes']['route'])) {
259
			foreach($config['staticroutes']['route'] as $route) {
260
				if ($route['network'] == $_POST['origname']) {
261
					$used_for_routes = 1;
262
					break;
263
				}
264
			}
265
		}
266 257
		$wrongaliases = "";
267 258
		for($x=0; $x<4999; $x++) {
268 259
			if($_POST["address{$x}"] <> "") {
......
281 272
					 && !is_hostname($_POST["address{$x}"])
282 273
					 && !is_iprange($_POST["address{$x}"]))
283 274
						$input_errors[] = sprintf(gettext('%1$s is not a valid %2$s alias.'), $_POST["address{$x}"], $_POST['type']);
284
					if (($used_for_routes === 1)
285
					 && !is_ipaddr($_POST["address{$x}"])
286
					 && !is_iprange($_POST["address{$x}"])
287
					 && is_hostname($_POST["address{$x}"]))
288
						$input_errors[] = gettext('This alias is used on a static route and cannot contain FQDNs.');
289 275
				}
290 276
				if (is_iprange($_POST["address{$x}"])) {
291 277
					list($startip, $endip) = explode('-', $_POST["address{$x}"]);
usr/local/www/system_routes_edit.php
127 127
		}
128 128
	} elseif (is_alias($_POST['network'])) {
129 129
		$osn = $_POST['network'];
130
		$fqdn_found = 0;
131 130
		foreach (preg_split('/\s+/', $aliastable[$osn]) as $tgt) {
132
			if (!is_ipaddr($tgt)) {
133
				if ($fqdn_found === 0) {
134
					$input_errors[] = sprintf(gettext("The alias (%s) has one or more FQDNs configured and cannot be used to configure a static route."), $_POST['network']);
135
					$fqdn_found = 1;
136
				}
137
				continue;
138
			}
139 131
			if (is_ipaddrv4($tgt))
140 132
				$tgt .= "/32";
141 133
			if (is_ipaddrv6($tgt))

Also available in: Unified diff