selftests: tc-testing: add cls_route no-routing-attribute change tests

Add a boundary pair for route4 change without a routing attribute:

- a classid-only change of a wildcard filter (handle 0xffff8000) is a
  metadata-only update and must succeed;
- the same change on a non-wildcard handle (0x10001) would rekey the
  filter to the wildcard bucket, leaving the handle userspace stored stale,
  and must be rejected with -EINVAL.

The change of a wildcard filter is the flow iproute2 uses by default
("tc filter add ... route classid X:Y" gives handle 0xffff8000).

Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Victor Nogueira <victor@mojatatu.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/QDISC-0JB3.v1.20260923100921@mojatatu.com.2
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Victor Nogueira 2026-10-01 12:32:01 -03:00 committed by Jakub Kicinski
parent b72e025ac5
commit 6fa2e7db99

View File

@ -412,5 +412,51 @@
"teardown": [
"$TC qdisc del dev $DEV1 ingress"
]
},
{
"id": "4000",
"name": "Change a wildcard route filter classid only (no routing attribute)",
"category": [
"filter",
"route"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
"$TC qdisc add dev $DEV1 ingress",
"$TC filter add dev $DEV1 parent ffff: protocol ip prio 100 route classid 1:1"
],
"cmdUnderTest": "$TC filter change dev $DEV1 parent ffff: protocol ip prio 100 route classid 1:9",
"expExitCode": "0",
"verifyCmd": "$TC filter ls dev $DEV1 parent ffff:",
"matchPattern": "fh 0xffff8000 flowid 1:9",
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DEV1 ingress"
]
},
{
"id": "907a",
"name": "Try to change a route filter with no routing attribute and a non-wildcard handle",
"category": [
"filter",
"route"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
"$TC qdisc add dev $DEV1 ingress",
"$TC filter add dev $DEV1 parent ffff: protocol ip prio 100 route from 1 to 1 classid 1:1"
],
"cmdUnderTest": "$TC filter change dev $DEV1 parent ffff: protocol ip prio 100 handle 0x10001 route classid 1:2",
"expExitCode": "2",
"verifyCmd": "$TC filter ls dev $DEV1 parent ffff:",
"matchPattern": "fh 0x00010001 flowid 1:1 to 1 from 1",
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DEV1 ingress"
]
}
]