Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
39e9e523
Commit
39e9e523
authored
May 30, 2017
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall: add defined TOS and DSCP values for selection
parent
b4a971d1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
25 deletions
+42
-25
firewall_scrub_edit.php
src/www/firewall_scrub_edit.php
+42
-25
No files found.
src/www/firewall_scrub_edit.php
View file @
39e9e523
...
...
@@ -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
(
array
(
11
,
12
,
13
,
21
,
22
,
23
,
31
,
32
,
33
,
41
,
42
,
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'
,
...
...
@@ -138,7 +168,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
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");
</td>
</tr>
<tr>
<td
width=
"22%"
><
a
id=
"help_for_tos"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"TOS"
);
?>
</td>
<td
width=
"22%"
><
i
class=
"fa fa-info-circle text-muted"
></i>
<?=
gettext
(
'TOS / DSCP'
);
?>
</td>
<td
width=
"78%"
>
<select
name=
"set-tos"
class=
"selectpicker"
data-size=
"5"
data-width=
"auto"
data-live-search=
"true"
>
<option
value=
""
<?=
empty
(
$pconfig
[
'set-tos'
])
?
"selected=
\"
selected
\"
"
:
""
;
?>
>
<?=
gettext
(
"Do not change"
);
?>
</option>
<option
value=
"lowdelay"
<?=
$pconfig
[
'set-tos'
]
==
'lowdelay'
?
"selected=
\"
selected
\"
"
:
""
;
?>
>
<?=
gettext
(
"lowdelay"
);
?>
</option>
<option
value=
"throughput"
<?=
$pconfig
[
'set-tos'
]
==
'throughput'
?
"selected=
\"
selected
\"
"
:
""
;
?>
>
<?=
gettext
(
"throughput"
);
?>
</option>
<option
value=
"reliability"
<?=
$pconfig
[
'set-tos'
]
==
'reliability'
?
"selected=
\"
selected
\"
"
:
""
;
?>
>
<?=
gettext
(
"reliability"
);
?>
</option>
<?php
for
(
$i
=
0
;
$i
<
256
;
$i
++
)
:
$tos_val
=
"0x"
.
dechex
(
$i
)
?>
<option
value=
"
<?=
$tos_val
;
?>
"
<?=
$tos_val
==
$pconfig
[
'set-tos'
]
?
"selected=
\"
selected
\"
"
:
""
;
?>
>
<?=
$tos_val
;
?>
foreach
(
filter_tos_values
()
as
$tos_value
=>
$tos_label
)
:
?>
<option
value=
"
<?=
$tos_value
?>
"
<?=
$tos_value
==
$pconfig
[
'set-tos'
]
?
'selected="selected"'
:
''
?>
>
<?=
$tos_label
?>
</option>
<?php
endfor
;
?>
endfor
each
?>
</select>
</td>
</tr>
<tr>
<td
width=
"22%"
><a
id=
"help_for_minttl"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Min ttl"
);
?>
</td>
<td
width=
"22%"
><a
id=
"help_for_minttl"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
'Minimum TTL'
)
?>
</td>
<td
width=
"78%"
>
<input
name=
"min-ttl"
type=
"text"
value=
"
<?=
$pconfig
[
'min-ttl'
];
?>
"
/>
<div
class=
"hidden"
for=
"help_for_minttl"
>
...
...
@@ -603,7 +620,7 @@ include("head.inc");
</td>
</tr>
<tr>
<td
width=
"22%"
><a
id=
"help_for_randomid"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Random-id"
);
?>
</td>
<td
width=
"22%"
><a
id=
"help_for_randomid"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
'Random ID'
)
?>
</td>
<td
width=
"78%"
>
<input
name=
"random-id"
type=
"checkbox"
value=
"1"
<?=
!
empty
(
$pconfig
[
'random-id'
])
?
"checked=
\"
checked
\"
"
:
""
;
?>
/>
<div
class=
"hidden"
for=
"help_for_randomid"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment