summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2024-01-19 20:36:40 +0000
committerGitHub <noreply@github.com>2024-01-19 20:36:40 +0000
commitd52f8040afc0f1e5ea967a330cce2ff3dcf31ae1 (patch)
tree44d9e9866854b52247f7dfe3313c78160ac85476
parent7e6aa37725e60936a2ae9f4369e19bec1a7fc9b6 (diff)
parenta7fe02e989cf7034609cb833c86143660eb609d5 (diff)
downloadvyos-1x-d52f8040afc0f1e5ea967a330cce2ff3dcf31ae1.tar.gz
vyos-1x-d52f8040afc0f1e5ea967a330cce2ff3dcf31ae1.zip
Merge pull request #2855 from sever-sever/T5963
T5963: Fix QoS shaper rate calculations and set default 1Gbit
-rw-r--r--python/vyos/qos/base.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/python/vyos/qos/base.py b/python/vyos/qos/base.py
index d8bbfe970..27045043e 100644
--- a/python/vyos/qos/base.py
+++ b/python/vyos/qos/base.py
@@ -1,4 +1,4 @@
-# Copyright 2022-2023 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2022-2024 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -166,14 +166,17 @@ class QoSBase:
}
if rate == 'auto' or rate.endswith('%'):
- speed = 10
+ speed = 1000
+ default_speed = speed
# Not all interfaces have valid entries in the speed file. PPPoE
# interfaces have the appropriate speed file, but you can not read it:
# cat: /sys/class/net/pppoe7/speed: Invalid argument
try:
speed = read_file(f'/sys/class/net/{self._interface}/speed')
if not speed.isnumeric():
- Warning('Interface speed cannot be determined (assuming 10 Mbit/s)')
+ Warning('Interface speed cannot be determined (assuming 1000 Mbit/s)')
+ if int(speed) < 1:
+ speed = default_speed
if rate.endswith('%'):
percent = rate.rstrip('%')
speed = int(speed) * int(percent) // 100