Skip to content

Commit e18f348

Browse files
vbnogueirakuba-moo
authored andcommitted
selftests/tc-testing: Create test cases for adding qdiscs to invalid qdisc parents
As described in a previous commit [1], Lion's patch [2] revealed an ancient bug in the qdisc API. Whenever a user tries to add a qdisc to an invalid parent (not a class, root, or ingress qdisc), the qdisc API will detect this after qdisc_create is called. Some qdiscs (like fq_codel, pie, and sfq) call functions (on their init callback) which assume the parent is valid, so qdisc_create itself may have caused a NULL pointer dereference in such cases. This commit creates 3 TDC tests that attempt to add fq_codel, pie and sfq qdiscs to invalid parents - Attempts to add an fq_codel qdisc to an hhf qdisc parent - Attempts to add a pie qdisc to a drr qdisc parent - Attempts to add an sfq qdisc to an inexistent hfsc classid (which would belong to a valid hfsc qdisc) [1] https://lore.kernel.org/all/[email protected]/ [2] https://lore.kernel.org/netdev/[email protected]/ Signed-off-by: Victor Nogueira <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 60ada4f commit e18f348

File tree

1 file changed

+66
-0
lines changed
  • tools/testing/selftests/tc-testing/tc-tests/infra

1 file changed

+66
-0
lines changed

tools/testing/selftests/tc-testing/tc-tests/infra/qdiscs.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,5 +672,71 @@
672672
"teardown": [
673673
"$TC qdisc del dev $DUMMY root handle 1: drr"
674674
]
675+
},
676+
{
677+
"id": "be28",
678+
"name": "Try to add fq_codel qdisc as a child of an hhf qdisc",
679+
"category": [
680+
"qdisc",
681+
"fq_codel",
682+
"hhf"
683+
],
684+
"plugins": {
685+
"requires": "nsPlugin"
686+
},
687+
"setup": [
688+
"$TC qdisc add dev $DUMMY root handle a: hhf"
689+
],
690+
"cmdUnderTest": "$TC qdisc add dev $DUMMY parent a: handle b: fq_codel",
691+
"expExitCode": "2",
692+
"verifyCmd": "$TC -j qdisc ls dev $DUMMY handle b:",
693+
"matchJSON": [],
694+
"teardown": [
695+
"$TC qdisc del dev $DUMMY root"
696+
]
697+
},
698+
{
699+
"id": "fcb5",
700+
"name": "Try to add pie qdisc as a child of a drr qdisc",
701+
"category": [
702+
"qdisc",
703+
"pie",
704+
"drr"
705+
],
706+
"plugins": {
707+
"requires": "nsPlugin"
708+
},
709+
"setup": [
710+
"$TC qdisc add dev $DUMMY root handle a: drr"
711+
],
712+
"cmdUnderTest": "$TC qdisc add dev $DUMMY parent a: handle b: pie",
713+
"expExitCode": "2",
714+
"verifyCmd": "$TC -j qdisc ls dev $DUMMY handle b:",
715+
"matchJSON": [],
716+
"teardown": [
717+
"$TC qdisc del dev $DUMMY root"
718+
]
719+
},
720+
{
721+
"id": "7801",
722+
"name": "Try to add fq qdisc as a child of an inexistent hfsc class",
723+
"category": [
724+
"qdisc",
725+
"sfq",
726+
"hfsc"
727+
],
728+
"plugins": {
729+
"requires": "nsPlugin"
730+
},
731+
"setup": [
732+
"$TC qdisc add dev $DUMMY root handle a: hfsc"
733+
],
734+
"cmdUnderTest": "$TC qdisc add dev $DUMMY parent a:fff2 sfq limit 4",
735+
"expExitCode": "2",
736+
"verifyCmd": "$TC -j qdisc ls dev $DUMMY handle b:",
737+
"matchJSON": [],
738+
"teardown": [
739+
"$TC qdisc del dev $DUMMY root"
740+
]
675741
}
676742
]

0 commit comments

Comments
 (0)