Skip to content

Commit ca34ace

Browse files
ferrieuxPaolo Abeni
authored andcommitted
net: sched: u32: Add test case for systematic hnode IDR leaks
Add a tdc test case to exercise the just-fixed systematic leak of IDR entries in u32 hnode disposal. Given the IDR in question is confined to the range [1..0x7FF], it is sufficient to create/delete the same filter 2048 times to fill it up and get a nonzero exit status from "tc filter add". Signed-off-by: Alexandre Ferrieux <[email protected]> Acked-by: Jamal Hadi Salim <[email protected]> Reviewed-by: Victor Nogueira <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent f8d670b commit ca34ace

File tree

1 file changed

+24
-0
lines changed
  • tools/testing/selftests/tc-testing/tc-tests/filters

1 file changed

+24
-0
lines changed

tools/testing/selftests/tc-testing/tc-tests/filters/u32.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,5 +329,29 @@
329329
"teardown": [
330330
"$TC qdisc del dev $DEV1 parent root drr"
331331
]
332+
},
333+
{
334+
"id": "1234",
335+
"name": "Exercise IDR leaks by creating/deleting a filter many (2048) times",
336+
"category": [
337+
"filter",
338+
"u32"
339+
],
340+
"plugins": {
341+
"requires": "nsPlugin"
342+
},
343+
"setup": [
344+
"$TC qdisc add dev $DEV1 parent root handle 10: drr",
345+
"$TC filter add dev $DEV1 parent 10:0 protocol ip prio 2 u32 match ip src 0.0.0.2/32 action drop",
346+
"$TC filter add dev $DEV1 parent 10:0 protocol ip prio 3 u32 match ip src 0.0.0.3/32 action drop"
347+
],
348+
"cmdUnderTest": "bash -c 'for i in {1..2048} ;do echo filter delete dev $DEV1 pref 3;echo filter add dev $DEV1 parent 10:0 protocol ip prio 3 u32 match ip src 0.0.0.3/32 action drop;done | $TC -b -'",
349+
"expExitCode": "0",
350+
"verifyCmd": "$TC filter show dev $DEV1",
351+
"matchPattern": "protocol ip pref 3 u32",
352+
"matchCount": "3",
353+
"teardown": [
354+
"$TC qdisc del dev $DEV1 parent root drr"
355+
]
332356
}
333357
]

0 commit comments

Comments
 (0)