How do you assign these downloads to the bulk tin in your rules?
On new connections going to a particular destination port, I set the connection mark to 1 (lephb). The tc filter then converts this to DSCP on each packet.
What mark is shown in /proc/net/nf_conntrack for all these connections?
In both cases mark=1 on each connection. In the fastpath case I can also confirm fastpath is working because I also see [OFFLOAD] on each connection.
This is getting interesting. The filter statistics show that the packets are flowing through the filter in both cases. In the fastpath off case, all packets are getting the DSCP set by the ctinfo dscp action. However, in the fastpath on case, none of the packets are getting the DSCP set. The statistics in that case show that there are no errors setting the the DSCP: DSCP set 6443637 error 0.
Looking at the code in the kernel, the only way this can happen is if the ct mark is not set. In that case dscp == newdscp because they are both 0. However, I previously verified in conntrack -L that the connections show that the ct mark is set to 1. Is this a bug in the kernel where the ct mark is somehow not properly getting passed through the netfilter code when fastpath is used?
Raw statistics follow:
No fastpath:
root@router:~# tc -s filter show dev wan
filter parent 1: protocol all pref 49152 matchall chain 0
filter parent 1: protocol all pref 49152 matchall chain 0 handle 0x1
not_in_hw (rule hit 10121643)
action order 1: ctinfo zone 0 continue
index 1 ref 1 bind 1 dscp 0x0000003f 0000000000 installed 83188 sec used 0 sec firstused 83183 sec DSCP set 5535376 error 0 CPMARK set 0
Action statistics:
Sent 3730824707 bytes 10505636 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
root@router:~# tc -s filter show dev wan
filter parent 1: protocol all pref 49152 matchall chain 0
filter parent 1: protocol all pref 49152 matchall chain 0 handle 0x1
not_in_hw (rule hit 11027232)
action order 1: ctinfo zone 0 continue
index 1 ref 1 bind 1 dscp 0x0000003f 0000000000 installed 83236 sec used 0 sec firstused 83231 sec DSCP set 6439820 error 0 CPMARK set 0
Action statistics:
Sent 3793514959 bytes 11411232 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
Fastpath:
root@router:~# tc -s filter show dev wan
filter parent 1: protocol all pref 49152 matchall chain 0
filter parent 1: protocol all pref 49152 matchall chain 0 handle 0x1
not_in_hw (rule hit 11033409)
action order 1: ctinfo zone 0 continue
index 1 ref 1 bind 1 dscp 0x0000003f 0000000000 installed 83354 sec used 0 sec firstused 83349 sec DSCP set 6440026 error 0 CPMARK set 0
Action statistics:
Sent 3794717853 bytes 11417431 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
root@router:~# tc -s filter show dev wan
filter parent 1: protocol all pref 49152 matchall chain 0
filter parent 1: protocol all pref 49152 matchall chain 0 handle 0x1
not_in_hw (rule hit 11913138)
action order 1: ctinfo zone 0 continue
index 1 ref 1 bind 1 dscp 0x0000003f 0000000000 installed 83411 sec used 0 sec firstused 83406 sec DSCP set 6443637 error 0 CPMARK set 0
Action statistics:
Sent 3855562855 bytes 12297162 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
I found an issue involving port forwarding. I have a fw4 rule on the router like:
config redirect
option target 'DNAT'
option name 'Redacted'
option src 'wan'
option dest_ip '192.168.1.5'
option dest 'lan'
list proto 'tcp'
list proto 'udp'
option dest_port '55550'
option src_dport '55550'
On my Linux server I have an nft rule like:
table inet filter {
chain output {
type filter hook output priority filter; policy accept;
meta skuid 1111 ip dscp set cs1
}
}
With the port forwarding rule disabled all download and upload traffic from the user is marked CS1 but I have to add ‘established’ or remove ‘ct state’ entirely to get it to work with the port forwarding rule enabled.
# Does not work with my setup and port forwarding
oifname wan ct state new,untracked goto classify-and-store-dscp
# Both of these commands work
oifname wan ct state new,untracked,established goto classify-and-store-dscp
oifname wan goto classify-and-store-dscp