Project

General

Profile

Feature #13639 » 22.05.patch

Marcos M, 11/10/2022 01:47 PM

View differences:

src/usr/local/www/firewall_rules_edit.php
819 819
		}
820 820
	}
821 821

  
822
	if ($_POST['dscp'] && !in_array($_POST['dscp'], $firewall_rules_dscp_types)) {
822
	if ($_POST['dscp'] && !in_array($_POST['dscp'], $firewall_rules_dscp_types) &&
823
	    !preg_match('/^[0-9a-z]{1,16}$/i', $_POST['dscp'])) {
823 824
		$input_errors[] = gettext("Invalid DSCP value.");
824 825
	}
825 826
	if ($_POST['tag'] && !is_validaliasname($_POST['tag'])) {
......
981 982
			unset($filterent['disabled']);
982 983
		}
983 984

  
984
		if ($_POST['dscp']) {
985
		if ($_POST['dscp-custom'] && preg_match('/^[0-9a-z]{1,16}$/i', $_POST['dscp-custom'])) {
986
			$filterent['dscp'] = $_POST['dscp-custom'];
987
		} elseif ($_POST['dscp']) {
985 988
			$filterent['dscp'] = $_POST['dscp'];
986 989
		}
987 990

  
......
1563 1566
	['' => gettext('Any')] + array_combine($ostypes, $ostypes)
1564 1567
))->setHelp('Note: this only works for TCP rules. General OS choice matches all subtypes.');
1565 1568

  
1566
$section->addInput(new Form_Select(
1569
$group = new Form_Group('Diffserv Code Point');
1570
$group->add(new Form_Select(
1567 1571
	'dscp',
1568
	'Diffserv Code Point',
1572
	null,
1569 1573
	$pconfig['dscp'],
1570 1574
	["" => ''] + array_combine($firewall_rules_dscp_types, $firewall_rules_dscp_types)
1571 1575
));
1576
$group->add(new Form_Input(
1577
	'dscp-custom',
1578
	'Enter a valid DSCP value',
1579
	'text',
1580
	$pconfig['dscp'],
1581
	array('title' => 'Override selection with a custom DSCP')
1582
));
1583
$section->add($group);
1572 1584

  
1573 1585
$section->addInput(new Form_Checkbox(
1574 1586
	'allowopts',
(1-1/3)