diff --git a/src/www/firewall_scrub_edit.php b/src/www/firewall_scrub_edit.php index 3e0bf3b9b..c53e74b5e 100644 --- a/src/www/firewall_scrub_edit.php +++ b/src/www/firewall_scrub_edit.php @@ -29,11 +29,43 @@ require_once("guiconfig.inc"); require_once("filter.inc"); +/** + * Return array of possible TOS values + */ +function filter_tos_values() +{ + $ret = array( + '' => gettext('Do not change'), + 'lowdelay' => gettext('lowdelay'), + 'critical' => gettext('critical'), + 'inetcontrol' => gettext('inetcontrol'), + 'lowdelay' => gettext('lowdelay'), + 'netcontrol' => gettext('netcontrol'), + 'throughput' => gettext('throughput'), + 'reliability' => gettext('reliability'), + 'ef' => 'EF', + ); + + foreach (range(11, 43) as $val) { + $ret["af$val"] = "AF$val"; + } + + foreach (range(0, 7) as $val) { + $ret["cs$val"] = "CS$val"; + } + + foreach (range(0, 255) as $val) { + $ret['0x' . dechex($val)] = sprintf('0x%02X', $val); + } + + return $ret; +} /** * fetch list of selectable networks to use in form */ -function formNetworks() { +function formNetworks() +{ $networks = array(); $networks["any"] = gettext("any"); // foreach (get_configured_interface_with_descr() as $ifent => $ifdesc) { @@ -43,14 +75,12 @@ function formNetworks() { return $networks; } - if (!isset($config['filter']['scrub']['rule'])) { $config['filter']['scrub'] = array(); $config['filter']['scrub']['rule'] = array(); } $a_scrub = &$config['filter']['scrub']['rule']; - // define form fields $config_fields = array('interface', 'proto', 'srcnot', 'src', 'srcmask', 'dstnot', 'dst', 'dstmask', 'dstport', 'no-df', 'random-id', 'max-mss', 'min-ttl', 'set-tos', 'descr', 'disabled', 'direction', @@ -133,12 +163,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { $input_errors[] = gettext("Please specify a valid number for min ttl (0-255)."); } - if (count($input_errors) == 0) { + if (count($input_errors) == 0) { $scrubent = array(); foreach ($config_fields as $fieldname) { if (!empty($pconfig[$fieldname])) { if (is_array($pconfig[$fieldname])) { - $scrubent[$fieldname] = implode(",", $pconfig[$fieldname]); + $scrubent[$fieldname] = implode(',', $pconfig[$fieldname]); } else { $scrubent[$fieldname] = trim($pconfig[$fieldname]); } @@ -558,34 +588,21 @@ include("head.inc"); - + - +