Page MenuHomeVyOS Platform

Traffic policy not set in live configuration
Closed, ResolvedPublicBUG

Description

Reproduce the problem:

$ configure
# set interfaces ethernet eth2 traffic-policy in 1G 
# commit
# save
# exit
$ sudo tc filter show dev eth2 parent ffff

I am getting empty output, limiter does not work.

After reboot vyos:

$ sudo tc filter show dev eth2 parent ffff:
filter protocol all pref 255 basic chain 0 
filter protocol all pref 255 basic chain 0 handle 0x1 flowid ffff:1 
	action order 1:  police 0x1 rate 1Gbit burst 192375b mtu 2Kb action drop overhead 0b 
	ref 1 bind 1

Details

Difficulty level
Unknown (require assessment)
Version
1.4-rolling-202112060318
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

@daniil Can you share an example of traffic-policy 1G?

# show traffic-policy 
 limiter 1G {
     default {
         bandwidth 1gbit
         burst 188kb
     }
}

@daniil can you edit one file?

sudo nano -c +1308 /usr/lib/python3/dist-packages/vyos/ifconfig/interface.py

And replace string:

if not 'redirect' in self._config:

To string:

if not 'redirect' in self._config and not 'traffic_policy' in self._config:

save and reboot the router or just restart vyos-configd

sudo systemctl restart vyos-configd

PR https://github.com/vyos/vyos-1x/pull/1117

set interfaces ethernet eth2 traffic-policy in '1G'
set traffic-policy limiter 1G default bandwidth '1gbit'
set traffic-policy limiter 1G default burst '188kb'

tc:

vyos@r11-roll# sudo tc filter show dev eth2 parent ffff:
filter protocol all pref 255 basic chain 0 
filter protocol all pref 255 basic chain 0 handle 0x1 flowid ffff:1 
	action order 1:  police 0x1 rate 1Gbit burst 192375b mtu 2Kb action drop overhead 0b 
	ref 1 bind 1

[edit]
vyos@r11-roll#
Viacheslav claimed this task.
Viacheslav moved this task from Need Triage to Finished on the VyOS 1.4 Sagitta board.

Similar problem in the latest rolling releases (vyos-1.4-rolling-202207111030). Traffic policy (limiter) not set in live configuration.

I propose a patch to fix this issue:

python/vyos/ifconfig/interface.py

@@ -1319,8 +1319,9 @@
 
         # clear existing ingess - ignore errors (e.g. "Error: Cannot find specified
         # qdisc on specified device") - we simply cleanup all stuff here
-        self._popen(f'tc qdisc del dev {source_if} parent ffff: 2>/dev/null');
-        self._popen(f'tc qdisc del dev {source_if} parent 1: 2>/dev/null');
+        if not 'traffic_policy' in self._config:
+            self._popen(f'tc qdisc del dev {source_if} parent ffff: 2>/dev/null');
+            self._popen(f'tc qdisc del dev {source_if} parent 1: 2>/dev/null');