Project

General

Profile

Feature #13639 » 2.6.0.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'])) {
......
980 981
			unset($filterent['disabled']);
981 982
		}
982 983

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

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

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

  
1572 1584
$section->addInput(new Form_Checkbox(
1573 1585
	'allowopts',
(2-2/3)