Commit edbac06d authored by Ad Schellevis's avatar Ad Schellevis

(trafficshaper) add match tcp ACK/non-ACK selection, closes...

(trafficshaper) add match tcp ACK/non-ACK selection, closes https://github.com/opnsense/core/issues/528
parent 454e8b3c
...@@ -146,6 +146,8 @@ ...@@ -146,6 +146,8 @@
<ip6>ipv6</ip6> <ip6>ipv6</ip6>
<udp>udp</udp> <udp>udp</udp>
<tcp>tcp</tcp> <tcp>tcp</tcp>
<tcp_ack>tcp (ACK packets only)</tcp_ack>
<tcp_ack_not>tcp (non-ACK packages)</tcp_ack_not>
<icmp>icmp</icmp> <icmp>icmp</icmp>
<igmp>igmp</igmp> <igmp>igmp</igmp>
<esp>esp</esp> <esp>esp</esp>
......
...@@ -154,20 +154,25 @@ add 60000 return via any ...@@ -154,20 +154,25 @@ add 60000 return via any
{% if rule.interface2 and helpers.getNodeByTag('interfaces.'+rule.interface2) %} {% if rule.interface2 and helpers.getNodeByTag('interfaces.'+rule.interface2) %}
{# 2 interface defined, use both to match packets (2 rules) #} {# 2 interface defined, use both to match packets (2 rules) #}
add {{loop.index + 60000}} {{ helpers.getUUIDtag(rule.target) }} {{ add {{loop.index + 60000}} {{ helpers.getUUIDtag(rule.target) }} {{
helpers.getUUID(rule.target).number }} {{ rule.proto }} from {{ rule.source }} to {{rule.destination helpers.getUUID(rule.target).number }} {{ rule.proto.split('_')[0] }} from {{ rule.source }} to {{rule.destination
}} src-port {{ rule.src_port }} dst-port {{ rule.dst_port }} {{rule.direction}} recv {{ }} src-port {{ rule.src_port }} dst-port {{ rule.dst_port }} {{rule.direction}} recv {{
helpers.getNodeByTag('interfaces.'+rule.interface).if }} xmit {{helpers.getNodeByTag('interfaces.'+rule.interface2).if helpers.getNodeByTag('interfaces.'+rule.interface).if }} {%
if rule.proto.split('_')[1]|default('') == 'ack' %} {{ rule.proto.split('_')[2]|default('') }} tcpflags ack {% endif
%} xmit {{helpers.getNodeByTag('interfaces.'+rule.interface2).if
}} }}
add {{loop.index + 60000}} {{ helpers.getUUIDtag(rule.target) }} {{ add {{loop.index + 60000}} {{ helpers.getUUIDtag(rule.target) }} {{
helpers.getUUID(rule.target).number }} {{ rule.proto }} from {{ rule.source }} to {{rule.destination helpers.getUUID(rule.target).number }} {{ rule.proto.split('_')[0] }} from {{ rule.source }} to {{rule.destination
}} src-port {{ rule.src_port }} dst-port {{ rule.dst_port }} {{rule.direction}} xmit {{ }} src-port {{ rule.src_port }} dst-port {{ rule.dst_port }} {{rule.direction}} xmit {{
helpers.getNodeByTag('interfaces.'+rule.interface).if }} recv {{helpers.getNodeByTag('interfaces.'+rule.interface2).if helpers.getNodeByTag('interfaces.'+rule.interface).if }} {%
if rule.proto.split('_')[1]|default('') == 'ack' %} {{ rule.proto.split('_')[2]|default('') }} tcpflags ack {% endif
%} recv {{helpers.getNodeByTag('interfaces.'+rule.interface2).if
}} }}
{% else %} {% else %}
{# normal, single interface situation #} {# normal, single interface situation #}
add {{loop.index + 60000}} {{ helpers.getUUIDtag(rule.target) }} {{ add {{loop.index + 60000}} {{ helpers.getUUIDtag(rule.target) }} {{
helpers.getUUID(rule.target).number }} {{ rule.proto }} from {{ rule.source }} to {{rule.destination helpers.getUUID(rule.target).number }} {{ rule.proto.split('_')[0] }} from {{ rule.source }} to {{rule.destination
}} src-port {{ rule.src_port }} dst-port {{ rule.dst_port }} {{rule.direction}} via {{ }} 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 {{
helpers.getNodeByTag('interfaces.'+rule.interface).if helpers.getNodeByTag('interfaces.'+rule.interface).if
}} }}
{% endif %} {% endif %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment