summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Nogueira <victor@mojatatu.com>2026-06-10 21:37:44 +0300
committerJakub Kicinski <kuba@kernel.org>2026-06-14 03:34:39 +0300
commita4004aa0debf6ba953a023c30e775668eaee4047 (patch)
tree132b56a12e2cce0122edc3dbafe202f9a709da9c
parent9406f6012b7343661efb516a11c62d4db2b62f75 (diff)
downloadlinux-a4004aa0debf6ba953a023c30e775668eaee4047.tar.xz
selftests/tc-testing: Verify IFE can handle truncated inner Ethernet header
Add a tdc test that exercises the act_ife decode path with a malformed IFE packet whose encapsulated inner Ethernet header is truncated. The injected frame has a valid outer Ethernet header (ethertype 0xED3E) and a minimal IFE header (metalen 2, i.e. no metadata TLVs), but the payload that should hold the original frame is a single byte instead of a full Ethernet header. Once ife_decode() strips the outer header and the IFE metadata, fewer than ETH_HLEN bytes are left, which previously let eth_type_trans() read past the end of the linear data. Signed-off-by: Victor Nogueira <victor@mojatatu.com> Link: https://patch.msgid.link/20260610183814.1648888-3-n05ec@lzu.edu.cn Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--tools/testing/selftests/tc-testing/tc-tests/actions/ife.json55
1 files changed, 55 insertions, 0 deletions
diff --git a/tools/testing/selftests/tc-testing/tc-tests/actions/ife.json b/tools/testing/selftests/tc-testing/tc-tests/actions/ife.json
index 808aef4afe22..ece7ec41bf99 100644
--- a/tools/testing/selftests/tc-testing/tc-tests/actions/ife.json
+++ b/tools/testing/selftests/tc-testing/tc-tests/actions/ife.json
@@ -1378,5 +1378,60 @@
"teardown": [
"$TC actions flush action ife"
]
+ },
+ {
+ "id": "4e6b",
+ "name": "Decode IFE packet with truncated inner Ethernet header",
+ "category": [
+ "actions",
+ "ife"
+ ],
+ "plugins": {
+ "requires": [
+ "nsPlugin",
+ "scapyPlugin"
+ ]
+ },
+ "setup": [
+ [
+ "$TC actions flush action ife",
+ 0,
+ 1,
+ 255
+ ],
+ "$TC qdisc add dev $DEV1 clsact"
+ ],
+ "scapy": [
+ {
+ "iface": "$DEV0",
+ "count": 1,
+ "packet": "Ether(type=0xED3E) / Raw(b'\\x00\\x02\\xaa')"
+ }
+ ],
+ "cmdUnderTest": "$TC filter add dev $DEV1 ingress protocol all matchall action ife decode pipe index 10",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -s -j actions get action ife index 10",
+ "matchJSON": [
+ {
+ "total acts": 0
+ },
+ {
+ "actions": [
+ {
+ "kind": "ife",
+ "mode": "decode",
+ "index": 10,
+ "stats": {
+ "bytes": 3,
+ "packets": 1,
+ "drops": 1
+ }
+ }
+ ]
+ }
+ ],
+ "teardown": [
+ "$TC qdisc del dev $DEV1 clsact"
+ ]
}
]