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
8ab33da1
Commit
8ab33da1
authored
Nov 07, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(traffic shaper) add support for address lists, and invert src/dst... merge from master
parent
8769d7b4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
3 deletions
+32
-3
dialogRule.xml
...p/controllers/OPNsense/TrafficShaper/forms/dialogRule.xml
+12
-0
TrafficShaper.xml
...e/mvc/app/models/OPNsense/TrafficShaper/TrafficShaper.xml
+11
-0
ipfw.conf
src/opnsense/service/templates/OPNsense/IPFW/ipfw.conf
+9
-3
No files found.
src/opnsense/mvc/app/controllers/OPNsense/TrafficShaper/forms/dialogRule.xml
View file @
8ab33da1
...
...
@@ -28,6 +28,12 @@
<type>
text
</type>
<help>
source ip or network, examples 10.0.0.0/24, 10.0.0.1
</help>
</field>
<field>
<id>
rule.source_not
</id>
<label>
invert source
</label>
<type>
checkbox
</type>
<help>
invert source (not)
</help>
</field>
<field>
<id>
rule.src_port
</id>
<label>
src-port
</label>
...
...
@@ -40,6 +46,12 @@
<type>
text
</type>
<help>
destination ip or network, examples 10.0.0.0/24, 10.0.0.1
</help>
</field>
<field>
<id>
rule.destination_not
</id>
<label>
invert destination
</label>
<type>
checkbox
</type>
<help>
invert destination (not)
</help>
</field>
<field>
<id>
rule.dst_port
</id>
<label>
dst-port
</label>
...
...
src/opnsense/mvc/app/models/OPNsense/TrafficShaper/TrafficShaper.xml
View file @
8ab33da1
<model>
<mount>
//OPNsense/TrafficShaper
</mount>
<version>
1.0.1
</version>
<description>
OPNsense traffic shaper
</description>
...
...
@@ -215,16 +216,26 @@
</proto>
<source
type=
"NetworkField"
>
<Required>
Y
</Required>
<FieldSeparator>
,
</FieldSeparator>
<default>
any
</default>
</source>
<source_not
type=
"BooleanField"
>
<default>
0
</default>
<Required>
Y
</Required>
</source_not>
<src_port
type=
"PortField"
>
<Required>
Y
</Required>
<default>
any
</default>
</src_port>
<destination
type=
"NetworkField"
>
<Required>
Y
</Required>
<FieldSeparator>
,
</FieldSeparator>
<default>
any
</default>
</destination>
<destination_not
type=
"BooleanField"
>
<default>
0
</default>
<Required>
Y
</Required>
</destination_not>
<dst_port
type=
"PortField"
>
<Required>
Y
</Required>
<default>
any
</default>
...
...
src/opnsense/service/templates/OPNsense/IPFW/ipfw.conf
View file @
8ab33da1
...
...
@@ -175,7 +175,9 @@ add 60000 return via any
{
# 2 interface defined, use both to match packets (2 rules) #}
{%
if
rule
.
direction
==
'in'
or
not
rule
.
direction
%}
add
{{
loop
.
index
+
60000
}} {{
helpers
.
getUUIDtag
(
rule
.
target
) }} {{
helpers
.
getUUID
(
rule
.
target
).
number
}} {{
rule
.
proto
.
split
(
'_'
)[
0
] }}
from
{{
rule
.
source
}}
to
{{
rule
.
destination
helpers
.
getUUID
(
rule
.
target
).
number
}} {{
rule
.
proto
.
split
(
'_'
)[
0
] }}
from
{%
if
rule
.
source_not
|
default
(
'0'
) ==
'1'
%}
not
{%
endif
%}{{
rule
.
source
}}
to
{%
if
rule
.
destination_not
|
default
(
'0'
) ==
'1'
%}
not
{%
endif
%}{{
rule
.
destination
}}
src
-
port
{{
rule
.
src_port
}}
dst
-
port
{{
rule
.
dst_port
}}
recv
{{
physical_interface
(
rule
.
interface
) }} {%
if
rule
.
proto
.
split
(
'_'
)[
1
]|
default
(
''
) ==
'ack'
%} {{
rule
.
proto
.
split
(
'_'
)[
2
]|
default
(
''
) }}
tcpflags
ack
{%
endif
...
...
@@ -184,7 +186,9 @@ add {{loop.index + 60000}} {{ helpers.getUUIDtag(rule.target) }} {{
{%
endif
%}
{%
if
rule
.
direction
==
'out'
or
not
rule
.
direction
%}
add
{{
loop
.
index
+
60000
}} {{
helpers
.
getUUIDtag
(
rule
.
target
) }} {{
helpers
.
getUUID
(
rule
.
target
).
number
}} {{
rule
.
proto
.
split
(
'_'
)[
0
] }}
from
{{
rule
.
source
}}
to
{{
rule
.
destination
helpers
.
getUUID
(
rule
.
target
).
number
}} {{
rule
.
proto
.
split
(
'_'
)[
0
] }}
from
{%
if
rule
.
source_not
|
default
(
'0'
) ==
'1'
%}
not
{%
endif
%}{{
rule
.
source
}}
to
{%
if
rule
.
destination_not
|
default
(
'0'
) ==
'1'
%}
not
{%
endif
%}{{
rule
.
destination
}}
src
-
port
{{
rule
.
src_port
}}
dst
-
port
{{
rule
.
dst_port
}}
xmit
{{
physical_interface
(
rule
.
interface
) }} {%
if
rule
.
proto
.
split
(
'_'
)[
1
]|
default
(
''
) ==
'ack'
%} {{
rule
.
proto
.
split
(
'_'
)[
2
]|
default
(
''
) }}
tcpflags
ack
{%
endif
...
...
@@ -194,7 +198,9 @@ add {{loop.index + 60000}} {{ helpers.getUUIDtag(rule.target) }} {{
{%
else
%}
{
# normal, single interface situation #}
add
{{
loop
.
index
+
60000
}} {{
helpers
.
getUUIDtag
(
rule
.
target
) }} {{
helpers
.
getUUID
(
rule
.
target
).
number
}} {{
rule
.
proto
.
split
(
'_'
)[
0
] }}
from
{{
rule
.
source
}}
to
{{
rule
.
destination
helpers
.
getUUID
(
rule
.
target
).
number
}} {{
rule
.
proto
.
split
(
'_'
)[
0
] }}
from
{%
if
rule
.
source_not
|
default
(
'0'
) ==
'1'
%}
not
{%
endif
%}{{
rule
.
source
}}
to
{%
if
rule
.
destination_not
|
default
(
'0'
) ==
'1'
%}
not
{%
endif
%}{{
rule
.
destination
}}
src
-
port
{{
rule
.
src_port
}}
dst
-
port
{{
rule
.
dst_port
}} {{
rule
.
direction
}} {%
if
rule
.
proto
.
split
(
'_'
)[
1
]|
default
(
''
) ==
'ack'
%}{{
rule
.
proto
.
split
(
'_'
)[
2
]|
default
(
''
) }}
tcpflags
ack
{%
endif
%}
via
{{
physical_interface
(
rule
.
interface
)
...
...
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