DSCPCLASSIFY in Main repo?

thanks for sharing do you has test

tcpdump host 192.168.1.128 -i wan -v -n

tcpdump host 192.168.1.128 -i ifb-wan -v -n

tcpdump host 192.168.1.128 -i br-lan -v -n

:wink: can you show a tc -s qdisc

config rule
	option name 'ICMP'
	option proto 'icmp'
	option class 'cs5' ??? not cs0 ??
	option enabled '0'

config set
	option name 'xcloud'  ### i'm on ps5 
	option family 'ipv4'
	option interval '1'
	list element '13.104.0.0/14' # Western Europe

config rule
	option name 'DNS'
	list proto 'tcp'
	list proto 'udp'
	list dest_port '53'
	list dest_port '853'
	list dest_port '5353'
	option class 'cs2'


config rule
	option name 'Cod1'
	option proto 'udp'
	option dest_port '3074'
	option class 'cs4'
	option dest_ip '192.168.2.160'

config rule
	option name 'Cod2'
	option proto 'udp'
	option src_port '3074'
	option src_ip '192.168.2.160'	## my ps5
	option class 'cs4'

config rule
	option name 'ICMP'
	option proto 'icmp'
	option class 'cs0'
	option enabled '1'


config rule 
	option name 'unmarked tcp src'
	option proto 'tcp'
	option src_port '!80 !443 !1935-1936'
	option src_ip '192.168.2.160'	
	option class 'cs4'

config rule 
	option name 'unmarked tcp dst'
	option proto 'tcp'
	option dst_port '!80 !443 !1935-1936'
	option dst_ip '192.168.2.160'	
	option class 'cs4'

config rule 
	option name 'unmarked udp src'
	option proto 'udp'
	option src_port '!80 !443'
	option src_ip '192.168.2.160'	
	option class 'cs4'

config rule 
	option name 'unmarked tcp dst'
	option proto 'udp'
	option dst_port '!80 !443'
	option dst_ip '192.168.2.160'	
	option class 'cs4'

config rule 
	option name 'unmarked tcp src'
	option proto 'udp'
	option src_port '!80 !443'
	option src_ip '192.168.2.160'	
	option class 'cs4'

config rule 
	option name 'streamsrc'
	option proto 'tcp'
	option src_port '1935-1936, 2396, 2935'
	option src_ip '192.168.2.160'	
	option class 'cs3'

config rule 
	option name 'streamdst'
	option proto 'dst'
	option dst_port '1935-1936, 2396, 2935'
	option dst_ip '192.168.2.160'	
	option class 'cs3'

is just a suggestion what do you think ?

FWIW that is available on the master branch and I've been running 2.87 on 22.03 using patches from the staging repo of @ldir for months.

I'm not sure what the technical reasons are that are blocking it from being merged into 22.03 but the developer said he doesn't have the time in this PR.

2 Likes

This is the output of tcpdump. One capture from lan (eth0) and one from wan (eth1):

tcpdump udp port 3074 -i eth0 -v -n
16:33:22.002851 IP (tos 0x0, ttl 128, id 54163, offset 0, flags [none], proto UDP (17), length 113)
    192.168.1.208.3074 > 5.200.29.138.39280: UDP, length 85
16:33:22.009151 IP (tos 0x80, ttl 54, id 21501, offset 0, flags [DF], proto UDP (17), length 410)
    5.200.29.138.39280 > 192.168.1.208.3074: UDP, length 382


tcpdump udp port 3074 -i eth1 -v -n
16:40:28.398588 IP (tos 0x80, ttl 127, id 51325, offset 0, flags [none], proto UDP (17), length 113)
    x.x.x.x.3074 > 95.179.217.195.30010: UDP, length 85
16:40:28.399563 IP (tos 0x0, ttl 49, id 53869, offset 0, flags [DF], proto UDP (17), length 550)
    95.179.217.195.30010 > x.x.x.x.3074: UDP, length 522

So it seems to be working…

This is the output of tc -s qdisc:

tc -s qdisc
qdisc noqueue 0: dev lo root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc mq 0: dev eth0 root
 Sent 11705171284 bytes 11168275 pkt (dropped 0, overlimits 0 requeues 1784)
 backlog 0b 0p requeues 1784
qdisc fq_codel 0: dev eth0 parent :2 limit 10240p flows 1024 quantum 1514 target 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64
 Sent 5020555951 bytes 4833737 pkt (dropped 0, overlimits 0 requeues 806)
 backlog 0b 0p requeues 806
  maxpacket 66616 drop_overlimit 0 new_flow_count 509 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth0 parent :1 limit 10240p flows 1024 quantum 1514 target 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64
 Sent 6684615333 bytes 6334538 pkt (dropped 0, overlimits 0 requeues 978)
 backlog 0b 0p requeues 978
  maxpacket 66616 drop_overlimit 0 new_flow_count 50878 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc cake 8028: dev eth1 root refcnt 9 bandwidth 45Mbit diffserv4 dual-srchost nat nowash ack-filter split-gso rtt 100ms noatm overhead 38 mpu 84
 Sent 495579848 bytes 2287805 pkt (dropped 7617, overlimits 1172159 requeues 1082)
 backlog 0b 0p requeues 1082
 memory used: 246648b of 4Mb
 capacity estimate: 45Mbit
 min/max network layer size:           28 /    1500
 min/max overhead-adjusted size:       84 /    1538
 average network hdr offset:           14

                   Bulk  Best Effort        Video        Voice
  thresh       2812Kbit       45Mbit    22500Kbit    11250Kbit
  target         6.46ms          5ms          5ms          5ms
  interval        101ms        100ms        100ms        100ms
  pk_delay         19us        202us         24us        101us
  av_delay          7us         15us          6us         10us
  sp_delay          2us          2us          3us          1us
  backlog            0b           0b           0b           0b
  pkts             2706      2224923          166        67627
  bytes          428090    490462756        12780      5264586
  way_inds            0       268659            0         2353
  way_miss           37        54989          160         5258
  way_cols            0            0            0            0
  drops               0           47            0            0
  marks               0            2            0            0
  ack_drop            0         7570            0            0
  sp_flows            1            3            1            1
  bk_flows            0            1            0            0
  un_flows            0            0            0            0
  max_len          1326        52990           90         1382
  quantum           300         1373          686          343

qdisc ingress ffff: dev eth1 parent ffff:fff1 ----------------
 Sent 6423467586 bytes 9063907 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev eth0.10 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev eth0.15 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev eth0.33 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev eth0.50 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev lxcbr0 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev eth0.44 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev phy0-ap0 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc fq_codel 0: dev tun1 root refcnt 2 limit 10240p flows 1024 quantum 1500 target 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64
 Sent 10776 bytes 71 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc noqueue 0: dev docker0 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev br-303c81f631c5 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev br-dd0139594ff6 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev vethd5d15a1 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc cake 8029: dev ifb4eth1 root refcnt 2 bandwidth 90Mbit diffserv4 dual-dsthost nat nowash ingress no-ack-filter split-gso rtt 100ms noatm overhead 38 mpu 84
 Sent 6586528610 bytes 9062896 pkt (dropped 1011, overlimits 8569202 requeues 0)
 backlog 0b 0p requeues 0
 memory used: 1251072b of 4500000b
 capacity estimate: 90Mbit
 min/max network layer size:           46 /    1500
 min/max overhead-adjusted size:       84 /    1538
 average network hdr offset:           14

                   Bulk  Best Effort        Video        Voice
  thresh       5625Kbit       90Mbit       45Mbit    22500Kbit
  target            5ms          5ms          5ms          5ms
  interval        100ms        100ms        100ms        100ms
  pk_delay        131us         94us         34us         51us
  av_delay         11us         13us          2us         17us
  sp_delay          3us          3us          2us          0us
  backlog            0b           0b           0b           0b
  pkts             4720      5792888          103      3266196
  bytes         1999081   6383595859         9270    202291970
  way_inds            0       329148            0            0
  way_miss           37        69476          103          295
  way_cols            0            0            0            0
  drops               0         1011            0            0
  marks               0            3            0            0
  ack_drop            0            0            0            0
  sp_flows            1            3            2            1
  bk_flows            0            0            0            0
  un_flows            0            0            0            0
  max_len          1330        39364           90         1382
  quantum           300         1514         1373          686

qdisc fq_codel 0: dev tun0 root refcnt 2 limit 10240p flows 1024 quantum 1500 target 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64
 Sent 6463 bytes 27 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
  maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
  new_flows_len 0 old_flows_len 0

I think you don't need as many rules. My approach is just prioritizing what’s really needed and let cake do the rest of the magic. Just my opinion.

1 Like
root@OpenWrt:~# tcpdump udp port 3074 -i br-lan -v -n
tcpdump: listening on br-lan, link-type EN10MB (Ethernet), capture size 262144 bytes
    192.168.2.160.3074 > 72.26.219.145.44150: UDP, length 125
16:32:58.179672 IP (tos 0x80, ttl 50, id 62948, offset 0, flags [DF], proto UDP (17), length 303)
    


root@OpenWrt:~# tcpdump udp port 3074 -i wan -v -n
tcpdump: listening on wan, link-type EN10MB (Ethernet), capture size 262144 bytes
16:33:04.728524 IP (tos 0x80, ttl 63, id 11822, offset 0, flags [none], proto UDP (17), length 153)
    192.168.XXXXXX.3074 > 72.26.219.145.44150: UDP, length 125
16:33:04.736867 IP (tos 0x80, ttl 63, id 31734, offset 0, flags [none], proto UDP (17), length 153)
    192..XXXXXX.3074 > 72.26.219.145.44150: UDP, length 125

yes thanks for all hudra

he seems worked like a charmed :slight_smile:

1 Like

Do you think you could create a separete thread introducing cake-qos-simple so that we can discuss it without distracting this thread?

I could create a new thread myself, but I figured it would be better if you "owned it", since you are the creator of this solution.

1 Like

Sure - see here:

1 Like

Please, note I sent a PR request in @ldir's GitHub to extend the syntax a little bit to allow for the negation of ports, support for an option counter and use of auto-merge option.

3 Likes

I saw your PR but it looks like there hasn’t been much activity on the project lately. I should have looked a bit closer because today I also added an issue on @yelreve‘s github to add a counter option.

3 Likes

Hi, @Hudra,

@ldir just merged it into his repo. Thanks heaps, @ldir!

3 Likes

Thanks man. Already did a custom build a few hours ago and it’s now up and running.

2 Likes

very good news thanks for all work

i try to make twitch cs3 but dones't work any

 meta nfproto ipv4 tcp sport 1935 counter packets 0 bytes 0 goto ct_set_cs3 comment "twitch1"

config rule
	option name 'twitch1'
	option proto 'tcp'
	list src_port '1935'
	option class 'cs3'
	list dst_ip '192.168.2.160'

he appair cs4

142.250.75.236	192.168.2.160	TCP	CS4	1935	54183	1935 → 54183 [ACK] Seq=1 Ack=30202 Win=1723 Len=0 TSval=1053809678 TSecr=1325450932

@Hudra

for my consoles i has just add like this ...

config global 'global'
	option class_bulk 'le'
	option class_high_throughput 'af13'
	option client_hints '1'
	option threaded_client_min_bytes '10000'
	option threaded_service_min_bytes '1000000'
	option wmm '1'

config rule
        option name 'Consoles ps5'
        option proto 'udp'
        list src_ip '192.168.2.160'
	list dest_port '!80'
	list dest_port '!443'
	option class 'cs4'
        option family 'ipv4'
	option counter '1'

Turn off wmm and then restart the service and try again…

2 Likes

thanks so much he work very well i will play tonight a little bit and keep informed to my game :stuck_out_tongue:

i love OpenWrt for this

1 Like

@amteza
I’m trying the counter option of your pull request now and it seems like the counters don’t increase. It seems like only the first few packets of a flow count:
image
Is this because of ctinfo or do you have a clue why this happens?? I played 3 matches of cod. Packets land in the right tin (voice) and also are marked right when I do a packet capture (cs5).

Mon Jan  2 19:43:00 2023 daemon.notice procd: /etc/rc.d/S20dscpclassify: define wan = {  }
Mon Jan  2 19:43:00 2023 daemon.notice procd: /etc/rc.d/S20dscpclassify:              ^^^^
Mon Jan  2 19:43:00 2023 daemon.notice procd: /etc/rc.d/S20dscpclassify: In file included from /etc/dscpclassify.d/main.nft:4:1-44:
Mon Jan  2 19:43:00 2023 daemon.notice procd: /etc/rc.d/S20dscpclassify: /tmp/etc/dscpclassify-pre.include:2:14-17: Error: Set is empty
Mon Jan  2 19:43:00 2023 daemon.notice procd: /etc/rc.d/S20dscpclassify: define wan = {  }
Mon Jan  2 19:43:00 2023 daemon.notice procd: /etc/rc.d/S20dscpclassify:              ^^^^
Mon Jan  2 19:43:00 2023 daemon.notice procd: /etc/rc.d/S20dscpclassify: In file included from /etc/dscpclassify.d/main.nft:4:1-44:
Mon Jan  2 19:43:00 2023 daemon.notice procd: /etc/rc.d/S20dscpclassify: /tmp/etc/dscpclassify-pre.include:1:14-17: Error: Set is empty
Mon Jan  2 19:43:00 2023 daemon.notice procd: /etc/rc.d/S20dscpclassify: define lan = {  }
Mon Jan  2 19:43:00 2023 daemon.notice procd: /etc/rc.d/S20dscpclassify:              ^^^^

do you has this erro too ?

i'm not sûre of my error, maybe a systèm log of past

after two hours

my game was amazing i had two three errors but the game has bugs sometimes

the hitmarkers is good :slight_smile:


just a last question

bridge empty
I have this part checked is it important or not to check it? thanks or it has no impact

I see that someone shared my config with you. :wink:

1 Like

Yes, that's correct, only counts flows. You won't see the counter increasing for every packet. You'll see packets to create the conntrack flow. Then, of course, individual packets will land on the right cake tins.

1 Like

This is incorrect, mate, and I reckon if you are writing here a local IP and you have a list src_port clause, it means you should be using list scr_ip too.

BTW, the syntax is list dest_ip, so even that is incorrect. And, check your static rules with nft list chain inet dscpclassify static_classify, and see if they are being created, it looks like your log errors are due to a syntax error.

1 Like

hi everybody, ok thanks amteza i will change et keep informés

Tue Jan 3 11:05:56 2023 daemon.notice dscpclassify: service stopped
Tue Jan 3 11:05:56 2023 daemon.notice dscpclassify: service started
Tue Jan 3 11:06:22 2023 user.notice SQM: SQM stopped on wan
Tue Jan 3 11:06:22 2023 user.notice SQM: Started SQM script: layer_cake_ct.qos on wan, in: 400000 Kbps, out: 200000 Kbps
Tue Jan 3 11:06:23 2023 user.notice SQM : layer_cake_ct.qos has been successfully run on wan

are you sure I'm wrong @amteza for the ip destination

I think the error was that I had a vlan for the ps5 and also that I had separated in sqm the wan and the lan

I realized that it was necessary to put in the download the wan for ifb ...

edit i came veirfied just now

root@OpenWrt1er-router:~# nft list chain inet dscpclassify static_classify
table inet dscpclassify {
        chain static_classify {
                ip saddr 192.168.2.160 udp dport != { 80, 443 } counter packets 6 bytes 423 goto ct_set_cs4 comment "Consoles ps5"
                ip saddr 192.168.2.160 tcp dport 1935 counter packets 0 bytes 0 goto ct_set_cs3 comment "twitch1"
                ip dscp != { cs0, cs6, cs7 } iifname != { "wan" } (@nh,8,8 & 0xfc) >> 2 vmap @dscp_ct
                ip6 dscp != { cs0, cs6, cs7 } iifname != { "wan" } (@nh,0,16 & 0xfc0) >> 6 vmap @dscp_ct
                meta l4proto != { tcp, udp } goto ct_set_cs0
                ct mark set ct mark & 0xffffff80 | 0x00000080
        }
}
root@OpenWrt1er-router:~#

its seems like its working fine right now, i run a torrent dl and a twitch stream and i was playing csgo at the same time and the ping was stable even with this slow adsl line that i have...

root@OpenWrt:~# tc -s qdisc
qdisc noqueue 0: dev lo root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc fq_codel 0: dev eth0 root refcnt 2 limit 10240p flows 1024 quantum 1514 target 5ms interval 100ms memory_limit 4Mb ecn drop_batch 64
 Sent 9947925017 bytes 12004930 pkt (dropped 0, overlimits 0 requeues 7756)
 backlog 0b 0p requeues 7756
  maxpacket 1514 drop_overlimit 0 new_flow_count 6395 ecn_mark 0
  new_flows_len 0 old_flows_len 0
qdisc noqueue 0: dev br-lan root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev eth0.1 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc cake 801d: dev eth0.2 root refcnt 2 bandwidth 700Kbit diffserv8 dual-srchost nat nowash ack-filter split-gso rtt 100ms atm overhead 32
 Sent 18287841 bytes 142719 pkt (dropped 61535, overlimits 305127 requeues 0)
 backlog 8238b 81p requeues 0
 memory used: 980Kb of 4Mb
 capacity estimate: 700Kbit
 min/max network layer size:           28 /    1492
 min/max overhead-adjusted size:      106 /    1696
 average network hdr offset:           14

                  Tin 0        Tin 1        Tin 2        Tin 3        Tin 4        Tin 5        Tin 6        Tin 7
  thresh        700Kbit    612496bit    535928bit    468936bit    410312bit    359016bit    314136bit    274864bit
  target           26ms       29.7ms         34ms       38.8ms       44.4ms       50.7ms         58ms       66.3ms
  interval        121ms        125ms        129ms        134ms        139ms        146ms        153ms        161ms
  pk_delay        274ms          0us       25.6ms          0us          0us          0us       9.43ms       2.93ms
  av_delay         83ms          0us       3.79ms          0us          0us          0us       1.91ms         94us
  sp_delay       14.3ms          0us        502us          0us          0us          0us        350us         90us
  backlog         8096b           0b          88b           0b           0b           0b           0b           0b
  pkts            12139            0       145016            0            0            0        47158           22
  bytes         1269328            0     13113877            0            0            0      9238861          924
  way_inds          486            0          124            0            0            0            0            0
  way_miss          127            0         1357            0            0            0          117            1
  way_cols            0            0            0            0            0            0            0            0
  drops            5497            0          950            0            0            0            0            0
  marks               0            0           13            0            0            0            0            0
  ack_drop            0            0        55088            0            0            0            0            0
  sp_flows           16            0           13            0            0            0            2            1
  bk_flows           12            0            0            0            0            0            0            0
  un_flows            0            0            0            0            0            0            0            0
  max_len          1506            0         7788            0            0            0          586           42
  quantum           300          300          300          300          300          300          300          300

qdisc ingress ffff: dev eth0.2 parent ffff:fff1 ----------------
 Sent 276072510 bytes 240548 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc noqueue 0: dev wlan0 root refcnt 2
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 backlog 0b 0p requeues 0
qdisc cake 801e: dev ifb4eth0.2 root refcnt 2 bandwidth 12Mbit diffserv8 dual-dsthost nat nowash ingress no-ack-filter split-gso rtt 100ms atm overhead 32
 Sent 264388063 bytes 230380 pkt (dropped 10134, overlimits 387333 requeues 0)
 backlog 46606b 34p requeues 0
 memory used: 378560b of 4Mb
 capacity estimate: 12Mbit
 min/max network layer size:           46 /    1500
 min/max overhead-adjusted size:      106 /    1696
 average network hdr offset:           14

                  Tin 0        Tin 1        Tin 2        Tin 3        Tin 4        Tin 5        Tin 6        Tin 7
  thresh         12Mbit    10500Kbit     9187Kbit     8039Kbit     7034Kbit     6154Kbit     5385Kbit     4712Kbit
  target            5ms          5ms          5ms          5ms          5ms          5ms          5ms          5ms
  interval        100ms        100ms        100ms        100ms        100ms        100ms        100ms        100ms
  pk_delay        101ms        4.8ms         27ms          0us          0us          0us       1.21ms       1.33ms
  av_delay       27.8ms        234us       5.07ms          0us          0us          0us        497us        127us
  sp_delay       5.36ms        108us        1.1ms          0us          0us          0us         80us         83us
  backlog        22728b           0b       23878b           0b           0b           0b           0b           0b
  pkts            12562           57       174340            0            0            0        53490           99
  bytes         8903321         5634    254770473            0            0            0     15758228        14046
  way_inds           11            0            6            0            0            0            0            0
  way_miss          170           16          796            0            0            0          116            7
  way_cols            0            0            0            0            0            0            0            0
  drops             446            0         9688            0            0            0            0            0
  marks               0            0            1            0            0            0            0            0
  ack_drop            0            0            0            0            0            0            0            0
  sp_flows            6            1            4            0            0            0            1            1
  bk_flows            7            0            5            0            0            0            0            0
  un_flows            0            0            0            0            0            0            0            0
  max_len          1514          185         3016            0            0            0         1242          174
  quantum           366          320          300          300          300          300          300          300

root@OpenWrt:~#

1 Like