Project

General

Profile

« Previous | Next » 

Revision 270a2576

Added by Seth Mos almost 14 years ago

Add address family validation, also hide gateways or gateway groups from the gateway list.
Fix Ticket #1659

View differences:

usr/local/www/firewall_rules_edit.php
352 352
			$input_errors[] = gettext("A valid destination bit count must be specified.");
353 353
		}
354 354
	}
355
	if((is_ipaddr($_POST['src']) && is_ipaddr($_POST['dst'])) {
356
		if(!validate_address_family($_POST['src'], $_POST['dst']))
357
			$input_errors[] = sprintf(gettext("The Source IP address %s Address Family differs from the destination %s."), $_POST['src'], $_POST['dst']);
358
	}
355 359

  
356 360
	if ($_POST['srcbeginport'] > $_POST['srcendport']) {
357 361
		/* swap */
......
1266 1270
					$gateways = return_gateways_array();
1267 1271
					// add statically configured gateways to list
1268 1272
					foreach($gateways as $gwname => $gw) {
1273
						if(($pconfig['ipprotocol'] == "inet6") && !is_ipaddrv6($gw['gateway']))
1274
							continue;
1275
						if(($pconfig['ipprotocol'] == "inet") && !is_ipaddrv4($gw['gateway']))
1276
							continue;
1269 1277
						if($gw == "") 
1270 1278
							continue;
1271 1279
						if($gwname == $pconfig['gateway']) {
......
1278 1286
					/* add gateway groups to the list */
1279 1287
					if (is_array($config['gateways']['gateway_group'])) {
1280 1288
						foreach($config['gateways']['gateway_group'] as $gw_group) {
1289
							if(($pconfig['ipprotocol'] == "inet6") && !is_ipaddrv6($gw_group[0]['gwip']))
1290
								continue;
1291
							if(($pconfig['ipprotocol'] == "inet") && !is_ipaddrv4($gw_group[0]['gwip']))
1292
								continue;
1281 1293
							if($gw_group['name'] == "")
1282 1294
								continue;
1283 1295
							if($pconfig['gateway'] == $gw_group['name']) {
1284
								echo "<option value=\"{$gw_group['name']}\" SELECTED>{$gw_group['name']}</option>\n";
1296
								$selected = " SELECTED";
1285 1297
							} else {
1286
								echo "<option value=\"{$gw_group['name']}\">{$gw_group['name']}</option>\n";
1298
								$selected = "";
1287 1299
							}
1300
							echo "<option value=\"{$gw_group['name']}\" $selected>{$gw_group['name']}</option>\n";
1288 1301
						}
1289 1302
					}
1290 1303
?>

Also available in: Unified diff