Page MenuHomeVyOS Platform

QoS policy shaper is currently miscalculating bandwidth and ceil values for the default class
Closed, ResolvedPublicBUG

Description

The QoS policy shaper is currently miscalculating bandwidth and ceil values for the default class
It gets values from the default value if cannot detest the speed, expect to get value from bandwidth if set
To reproduce

touch /tmp/vyos.qos.debug

set qos policy shaper SHAPER bandwidth '20mbit'

set qos policy shaper SHAPER class 10 bandwidth '1%'
set qos policy shaper SHAPER class 10 burst '1mb'
set qos policy shaper SHAPER class 10 match dns ip protocol 'udp'
set qos policy shaper SHAPER class 10 match dns ip source port '53'

set qos policy shaper SHAPER default bandwidth '95%'
set qos policy shaper SHAPER default burst '15k'
set qos policy shaper SHAPER default ceiling '100%'

set qos interface eth1 egress SHAPER

commit

Expected:

20Mbit:  the full bandwidth (root)
200Kbit: for class 10
19Mbit:  for default class
20Mbit:  ceil for default class

What we get:

20Mbit:   the full bandwidth (root)
200Kbit:  for class 10
950Mbit:  for default class
1Gbit:    ceil for default class

Debug:

vyos@r4# commit
DEBUG/QoS: tc qdisc replace dev eth1 root handle 1: htb r2q 12 default b
DEBUG/QoS: tc class replace dev eth1 parent 1: classid 1:1 htb rate 20000000
DEBUG/QoS: tc class replace dev eth1 parent 1:1 classid 1:a htb rate 200000 burst 1mb quantum 1514
DEBUG/QoS: tc qdisc replace dev eth1 parent 1:a sfq

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


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

DEBUG/QoS: tc class replace dev eth1 parent 1:1 classid 1:b htb rate 950000000 burst 15k quantum 1514 prio 20 ceil 1000000000
DEBUG/QoS: tc qdisc replace dev eth1 parent 1:b sfq
{'bandwidth': '20mbit',
 'class': {'10': {'bandwidth': '1%',
                  'burst': '1mb',
                  'codel_quantum': '1514',
                  'flows': '1024',
                  'interval': '100',
                  'match': {'dns': {'ip': {'protocol': 'udp',
                                           'source': {'port': '53'}}}},
                  'queue_type': 'fq-codel',
                  'target': '5'}},
 'default': {'bandwidth': '95%',
             'burst': '15k',
             'ceiling': '100%',
             'codel_quantum': '1514',
             'flows': '1024',
             'interval': '100',
             'priority': '20',
             'queue_type': 'fq-codel',
             'target': '5'}}
DEBUG/QoS: tc qdisc replace dev eth1 parent 1:a fq_codel quantum 1514 flows 1024 interval 100 interval 100 target 5 noecn
DEBUG/QoS: tc filter add dev eth1 parent 1: protocol all prio 1 u32 match ip sport 53 0xffff match ip protocol 17 0xff flowid 1:a

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

DEBUG/QoS: tc filter add dev eth1 parent 1: protocol all prio 1 u32 match ip sport 53 0xffff match ip protocol 17 0xff flowid 1:a action police rate 10000000 burst 1mb flowid 1:a
DEBUG/QoS: tc qdisc replace dev eth1 parent 1:b fq_codel quantum 1514 flows 1024 interval 100 interval 100 target 5 noecn
[edit]
vyos@r4# 
[edit]
vyos@r4# 
[edit]
vyos@r4# tc class show dev eth1
class htb 1:1 root rate 20Mbit ceil 20Mbit burst 1600b cburst 1600b
class htb 1:a parent 1:1 leaf 8053: prio 0 rate 200Kbit ceil 200Kbit burst 1Mb cburst 1600b
class htb 1:b parent 1:1 leaf 8054: prio 7 rate 950Mbit ceil 1Gbit burst 15200b cburst 1375b
[edit]
vyos@r4#

TC:

vyos@r4# tc class show dev eth1
class htb 1:1 root rate 20Mbit ceil 20Mbit burst 1600b cburst 1600b
class htb 1:a parent 1:1 leaf 8053: prio 0 rate 200Kbit ceil 200Kbit burst 1Mb cburst 1600b
class htb 1:b parent 1:1 leaf 8054: prio 7 rate 950Mbit ceil 1Gbit burst 15200b cburst 1375b
[edit]
vyos@r4#

Details

Difficulty level
Unknown (require assessment)
Version
VyOS 1.5-rolling-202401220025
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Unspecified (please specify)