diff --git a/src/etc/inc/filter.inc b/src/etc/inc/filter.inc index 1cb696131..4fce01a6f 100644 --- a/src/etc/inc/filter.inc +++ b/src/etc/inc/filter.inc @@ -2231,7 +2231,7 @@ function filter_generate_user_rule(&$FilterIflist, $rule) $int = ""; $aline = array(); // initialize array with empty tags - foreach (array('schedlabel','divert','icmp-type','icmp6-type','tag','tagged','route','os','reply','prot','log', 'set-prio', 'set-prio-alt', 'prio') as $tag) { + foreach (array('schedlabel','divert','icmp-type','icmp6-type','tag','tagged','route','os','reply','prot','log', 'set-prio', 'set-prio-low', 'prio') as $tag) { $aline[$tag] = ""; } @@ -2390,19 +2390,16 @@ function filter_generate_user_rule(&$FilterIflist, $rule) } if (isset($rule['set-prio']) && $rule['set-prio'] !== '') { - if (isset($rule['set-prio-alt']) && $rule['set-prio-alt'] !== '') { - $prio = '('.$rule['set-prio'].','.$rule['set-prio-alt'].')'; - } - else { - $prio = $rule['set-prio']; - } + $prio = $rule['set-prio']; + if (isset($rule['set-prio-low']) && $rule['set-prio-low'] !== '') { + $prio = '('.$rule['set-prio'].','.$rule['set-prio-low'].')'; + } + $aline['set-prio'] = ' set prio '.$prio.' '; + } - $aline['set-prio'] = ' set prio '.$prio.' '; - } - - if (isset($rule['prio']) && $rule['prio'] !== '') { - $aline['prio'] = ' prio '.$rule['prio'].' '; - } + if (isset($rule['prio']) && $rule['prio'] !== '') { + $aline['prio'] = ' prio '.$rule['prio'].' '; + } if (!empty($rule['tag'])) { $aline['tag'] = " tag " .$rule['tag']. " "; diff --git a/src/www/firewall_rules_edit.php b/src/www/firewall_rules_edit.php index 46ccee341..f86548bc3 100644 --- a/src/www/firewall_rules_edit.php +++ b/src/www/firewall_rules_edit.php @@ -56,7 +56,7 @@ function FormSetAdvancedOptions(&$item) { } } // check these fields for anything being set except a blank string - foreach (array('set-prio', 'set-prio-alt', 'prio') as $fieldname) { + foreach (array('set-prio', 'set-prio-low', 'prio') as $fieldname) { if (isset($item[$fieldname]) && $item[$fieldname] !== '') { return true; } @@ -92,12 +92,44 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { } // define form fields - $config_fields = array('interface','type','direction','ipprotocol','protocol','icmptype','os','disabled','log' - ,'descr','tcpflags_any','tcpflags1','tcpflags2','tag','tagged','quick','allowopts' - ,'disablereplyto','max','max-src-nodes','max-src-conn','max-src-states','statetype' - ,'statetimeout','nopfsync','nosync','max-src-conn-rate','max-src-conn-rates','gateway','sched' - ,'associated-rule-id','floating', 'category', 'set-prio', 'set-prio-alt', 'prio' - ); + $config_fields = array( + 'allowopts', + 'associated-rule-id', + 'category', + 'descr', + 'direction', + 'disabled', + 'disablereplyto', + 'floating', + 'gateway', + 'icmptype', + 'interface', + 'ipprotocol', + 'log', + 'max', + 'max-src-conn', + 'max-src-conn-rate', + 'max-src-conn-rates', + 'max-src-nodes', + 'max-src-states', + 'nopfsync', + 'nosync', + 'os', + 'prio', + 'protocol', + 'quick', + 'sched', + 'set-prio', + 'set-prio-low', + 'statetimeout', + 'statetype', + 'tag', + 'tagged', + 'tcpflags1', + 'tcpflags2', + 'tcpflags_any', + 'type', + ); $pconfig = array(); $pconfig['type'] = "pass"; @@ -141,7 +173,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { $pconfig[$fieldname] = null; } } - } elseif ($_SERVER['REQUEST_METHOD'] === 'POST') { $input_errors = array(); $pconfig = $_POST; @@ -358,17 +389,21 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { if (!empty($pconfig['set-prio']) && (!is_numericint($pconfig['set-prio']) || $pconfig['set-prio'] < 0 || $pconfig['set-prio'] > 7)) { $input_errors[] = gettext('Set priority must be an integer between 0 and 7.'); - - if (!empty($pconfig['set-prio-alt']) && (!is_numericint($pconfig['set-prio-alt']) || $pconfig['set-prio-alt'] < 0 || $pconfig['set-prio-alt'] > 7)) { - $input_errors[] = gettext('Set alternate priority must be an integer between 0 and 7.'); - } } - if (!empty($pconfig['prio']) && ($pconfig['prio'] < 0 || $pconfig['prio'] > 7)) { + if (!empty($pconfig['set-prio-low']) && (!is_numericint($pconfig['set-prio-low']) || $pconfig['set-prio-low'] < 0 || $pconfig['set-prio-low'] > 7)) { + $input_errors[] = gettext('Set priority for low latency and acknowledgements must be an integer between 0 and 7.'); + } + + if (empty($pconfig['set-prio']) && !empty($pconfig['set-prio-low'])) { + $input_errors[] = gettext('Set priority for low latency and acknowledgements requires a set priority for normal packets.'); + } + + if (!empty($pconfig['prio']) && (!is_numericint($pconfig['prio']) || $pconfig['prio'] < 0 || $pconfig['prio'] > 7)) { $input_errors[] = gettext('Priority match must be an integer between 0 and 7.'); } - if (count($input_errors) == 0) { + if (count($input_errors) == 0) { $filterent = array(); // 1-on-1 copy of form values $copy_fields = array('type', 'interface', 'ipprotocol', 'tag', 'tagged', 'max', 'max-src-nodes' @@ -432,15 +467,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { } if (isset($pconfig['set-prio']) && $pconfig['set-prio'] !== '') { - $filterent['set-prio'] = (int)$pconfig['set-prio']; + $filterent['set-prio'] = $pconfig['set-prio']; + } - if (isset($pconfig['set-prio-alt']) && $pconfig['set-prio-alt'] !== '') { - $filterent['set-prio-alt'] = (int)$pconfig['set-prio-alt']; - } + if (isset($pconfig['set-prio-low']) && $pconfig['set-prio-low'] !== '') { + $filterent['set-prio-low'] = $pconfig['set-prio-low']; } if (isset($pconfig['prio']) && $pconfig['prio'] !== '') { - $filterent['prio'] = (int)$pconfig['prio']; + $filterent['prio'] = $pconfig['prio']; } @@ -494,13 +529,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { header(url_safe('Location: /firewall_rules.php?if=%s', array( !empty($pconfig['floating']) ? 'FloatingRules' : $pconfig['interface'] - ))); + ))); exit; } } legacy_html_escape_form_data($pconfig); +/* select priorities, but also offer an empty first option */ +$priorities = array_merge(array('' => gettext('None')), interfaces_vlan_priorities()); + include("head.inc"); ?> @@ -1234,56 +1272,43 @@ include("head.inc"); - '', - 1 => gettext('1 - Background'), - 0 => gettext('0 - Best Effort (default)'), - 2 => gettext('2 - Excellent Effort'), - 3 => gettext('3 - Critical Applications'), - 4 => gettext('4 - Video'), - 5 => gettext('5 - Voice'), - 6 => gettext('6 - Internetwork Control'), - 7 => gettext('7 - Network Control'), -); -?> - + - - + +
Main:Alternate (optional):
- + $priority): ?> + +
- +