Page MenuHomeVyOS Platform

QOS-Rewrite: DSCP match missing
Closed, ResolvedPublicBUG

Description

As a result of the ongoing efforts in T4284 the DSCP matching for V4 and V6 has gone missing.
When applying a rule with any dscp match set, it fails to commit due to invalid TC commands being generated.

I hacked it in like this but I'm not sure if it actually works.

tmp = dict_search(f'{af}.dscp', match_config)
if tmp:
    if af == 'ip':
        filter_cmd += f' match {tc_af} dsfield {tmp} 0xfc'
    elif af == 'ipv6':
        filter_cmd += f' match {tc_af} priority {tmp} 0xfc'

Details

Difficulty level
Unknown (require assessment)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

MartB created this object in space S1 VyOS Public.
Viacheslav changed the subtype of this task from "Task" to "Bug".Mar 9 2023, 3:56 AM

Not sure about ipv6, requires more tests, but ip should work
PR https://github.com/vyos/vyos-1x/pull/2048

Viacheslav changed the task status from Open to Needs testing.Jun 18 2023, 6:57 PM

@MartB Could you test it? Should be fixed in vyos-1.4-rolling-202306190317-amd64.iso

I've tested it, but it works partially... if you have more than a match (for example, the same class id if necessary to match more than one DSCP),it brakes the configuration again :

set qos policy shaper VyOS-HTB bandwidth '100mbit'
set qos policy shaper VyOS-HTB class 10 bandwidth '40%'
set qos policy shaper VyOS-HTB class 10 description 'dscp_EF_ipprec_5_GETS'
set qos policy shaper VyOS-HTB class 10 match AF11 ip dscp 'AF11'
set qos policy shaper VyOS-HTB class 10 priority '1'
set qos policy shaper VyOS-HTB class 10 queue-type 'fair-queue'
set qos policy shaper VyOS-HTB class 20 bandwidth '30%'
set qos policy shaper VyOS-HTB class 20 description 'dscp_AF4x_ipprec_4'
set qos policy shaper VyOS-HTB class 20 match ef ip dscp 'EF'
set qos policy shaper VyOS-HTB class 20 priority '2'
set qos policy shaper VyOS-HTB class 20 queue-type 'fair-queue'
set qos policy shaper VyOS-HTB default bandwidth '20%'
set qos policy shaper VyOS-HTB default queue-type 'fq-codel'

if I add a new line in the class-id 20 to match another DSCP : set qos policy shaper VyOS-HTB class 20 match AF11 ip dscp 'AF11'

returned (err):
Error: Cannot delete qdisc with handle of zero.
cmd 'tc filter replace dev eth0 parent 1: prio 2 protocol all u32 match ip dsfield 40 0xff u32 match ip dsfield 184 0xff flowid 1:14'
returned (out):

this configuration should be possible using TC filter :

#tc command 

tc filter add dev eth0 parent 1: prio 2 protocol all u32 match ip dsfield 40 0xff flowid 1:14

# filter matching : 

vyos@vyos:~$  sudo tc filter  show dev eth0
filter parent 1: protocol all pref 1 u32 chain 0
filter parent 1: protocol all pref 1 u32 chain 0 fh 800: ht divisor 1
filter parent 1: protocol all pref 1 u32 chain 0 fh 800::800 order 2048 key ht 800 bkt 0 *flowid 1:a not_in_hw
  match 00280000/00ff0000 at 0
filter parent 1: protocol all pref 2 u32 chain 0
filter parent 1: protocol all pref 2 u32 chain 0 fh 801: ht divisor 1
filter parent 1: protocol all pref 2 u32 chain 0 fh 801::800 order 2048 key ht 801 bkt 0 *flowid 1:14 not_in_hw
  match 00b80000/00ff0000 at 0
filter parent 1: protocol all pref 2 u32 chain 0 fh 801::801 order 2049 key ht 801 bkt 0 *flowid 1:14 not_in_hw
  match 00280000/00ff0000 at 0
Viacheslav claimed this task.
Viacheslav moved this task from Need Triage to Finished on the VyOS 1.4 Sagitta board.

Fixed

set qos interface eth1 egress 'VyOS-HTB'
set qos policy shaper VyOS-HTB bandwidth '100mbit'
set qos policy shaper VyOS-HTB class 10 bandwidth '40%'
set qos policy shaper VyOS-HTB class 10 description 'dscp_EF_ipprec_5_GETS'
set qos policy shaper VyOS-HTB class 10 match AF11 ip dscp 'AF11'
set qos policy shaper VyOS-HTB class 10 priority '1'
set qos policy shaper VyOS-HTB class 10 queue-type 'fair-queue'
set qos policy shaper VyOS-HTB class 20 bandwidth '30%'
set qos policy shaper VyOS-HTB class 20 description 'dscp_AF4x_ipprec_4'
set qos policy shaper VyOS-HTB class 20 match ef ip dscp 'EF'
set qos policy shaper VyOS-HTB class 20 priority '2'
set qos policy shaper VyOS-HTB class 20 queue-type 'fair-queue'
set qos policy shaper VyOS-HTB default bandwidth '20%'
set qos policy shaper VyOS-HTB default queue-type 'fq-codel'

Commit:

vyos@r14# commit
[ qos ]
DEBUG/QoS: tc qdisc replace dev eth1 root handle 1: htb r2q 62 default 15
DEBUG/QoS: tc class replace dev eth1 parent 1: classid 1:1 htb rate 100000000
DEBUG/QoS: tc class replace dev eth1 parent 1:1 classid 1:a htb rate 40000000 burst 15k quantum 1514 prio 1
DEBUG/QoS: tc qdisc replace dev eth1 parent 1:a sfq
DEBUG/QoS: tc class replace dev eth1 parent 1:1 classid 1:14 htb rate 30000000 burst 15k quantum 1514 prio 2
DEBUG/QoS: tc qdisc replace dev eth1 parent 1:14 sfq

WARNING: Interface speed cannot be determined (assuming 10 Mbit/s)

DEBUG/QoS: tc class replace dev eth1 parent 1:1 classid 1:15 htb rate -1000000 burst 15k quantum 1514 prio 20
DEBUG/QoS: tc qdisc replace dev eth1 parent 1:15 sfq
DEBUG/QoS: tc qdisc replace dev eth1 parent 1:a sfq
DEBUG/QoS: tc filter add dev eth1 parent 1: prio 1 protocol all u32 match ip dsfield 40 0xff flowid 1:a
DEBUG/QoS: tc qdisc replace dev eth1 parent 1:14 sfq
DEBUG/QoS: tc filter add dev eth1 parent 1: prio 2 protocol all u32 match ip dsfield 184 0xff flowid 1:14
DEBUG/QoS: tc qdisc replace dev eth1 parent 1:15 fq_codel quantum 1514 flows 1024 interval 100 interval 100 target 5 noecn

[edit]
vyos@r14#

Show tc:

vyos@r14# sudo tc filter show dev eth1
filter parent 1: protocol all pref 1 u32 chain 0 
filter parent 1: protocol all pref 1 u32 chain 0 fh 800: ht divisor 1 
filter parent 1: protocol all pref 1 u32 chain 0 fh 800::800 order 2048 key ht 800 bkt 0 *flowid 1:a not_in_hw 
  match 00280000/00ff0000 at 0
filter parent 1: protocol all pref 2 u32 chain 0 
filter parent 1: protocol all pref 2 u32 chain 0 fh 801: ht divisor 1 
filter parent 1: protocol all pref 2 u32 chain 0 fh 801::800 order 2048 key ht 801 bkt 0 *flowid 1:14 not_in_hw 
  match 00b80000/00ff0000 at 0
[edit]
vyos@r14#

Reopen if it doesn't work as expected, or create a new one.