Page MenuHomeVyOS Platform

VLAN ingress-qos and egress-qos accept values that fail at commit
Open, NormalPublicBUG

Description

set interfaces ethernet <ifname> vif <id> ingress-qos <value> and egress-qos check the value with the regular expression [:0-7 ]+ (interface-definitions/include/interface/vif.xml.i). It allows every mix of the digits 0 to 7, colons and spaces, so values that are not a list of from:to pairs pass set: 2:, :2, :, 1:2:3, 1 2, 1:2 3.

Reproduce (rolling 2026.11.22, VLAN with a valid mapping first):

set interfaces ethernet eth0 vif 77 address 192.0.2.1/24
set interfaces ethernet eth0 vif 77 ingress-qos '1:2'
commit
set interfaces ethernet eth0 vif 77 ingress-qos '2:'
commit

The second set is accepted. The commit fails:

OSError: [Errno 255] failed to run command: ip link add link eth0 name eth0.77 type vlan id 77 ingress-qos-map 2:
[[interfaces ethernet eth0]] failed
Commit failed

The update deletes the VLAN before it creates it again, so eth0.77 is gone from the kernel while the configuration still has it (show interfaces ethernet eth0 vif 77 lists the address and ingress-qos 1:2). If the VLAN had no mapping before, the value is accepted and silently has no effect.

Expected: the value is rejected at set with the message of the node. The message says "with numbers 0-9", the expression allows 0 to 7.

Proposed fix: [0-7]+:[0-7]+( +[0-7]+:[0-7]+)* for both nodes, message "with numbers 0-7", and a smoketest that rejects the six values above for both nodes (it fails with the old expression: 12 subtests).

Details

Version
rolling
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

Fix and test are ready, the pull request cannot be opened yet because the repository's open pull request limit for my account is reached.

Branch: https://github.com/ruben-herold/vyos-1x/tree/T9688-vlan-qos-regex (one commit, based on current `rolling`, `vlan: T9688: reject malformed ingress-qos and egress-qos`).

Change: the expression of both nodes in `interface-definitions/include/interface/vif.xml.i` is `[0-7]+:[0-7]+( +[0-7]+:[0-7]+)*` (pairs of numbers, one or more spaces between them), and the message says 0-7 instead of 0-9. New smoketest `test_vif_8021q_qos_invalid` in `base_interfaces_test.py`: `2:`, `:2`, `:`, `1:2:3`, `1 2`, `1:2 3`, `8:1`  
and `a:b` are rejected at `set` for both options, two spaces between pairs stay valid.

Tested on rolling 2026.11.22 in a VM with a `node.def` built from the branch: both QoS tests pass. With the unchanged `node.def` the new test fails (`ConfigSessionError not raised`, 12 subtests, the six values the old expression allows, for both options).

Found while working on https://github.com/vyos/vyos-1x/pull/5595 and kept out of it on purpose. The pull request will be opened as soon as there is room for it.
Viacheslav triaged this task as Normal priority.Tue, Nov 24, 9:36 AM