linux/tools/testing/selftests/tc-testing/tc-tests/actions/mirred.json
Victor Nogueira d38dc56a02 selftests/tc-testing: Add mirred test cases exercising loops
Add mirred loop test cases to validate that those will be caught and other
test cases that were previously misinterpreted as loops by mirred.

This commit adds 12 test cases:

- Redirect multiport: dummy egress -> dev1 ingress -> dummy egress (Loop)
- Redirect singleport: dev1 ingress -> dev1 egress -> dev1 ingress (Loop)
- Redirect multiport: dev1 ingress -> dummy ingress -> dev1 egress (No Loop)
- Redirect multiport: dev1 ingress -> dummy ingress -> dev1 ingress (Loop)
- Redirect multiport: dev1 ingress -> dummy egress -> dev1 ingress (Loop)
- Redirect multiport: dummy egress -> dev1 ingress -> dummy egress, different prios (Loop)
- Redirect multiport: dev1 ingress -> dummy ingress -> dummy egress -> dev1 egress (No Loop)
- Redirect multiport: dev1 ingress -> dummy egress -> dev1 egress (No Loop)
- Redirect multiport: dev1 ingress -> dummy egress -> dummy ingress (No Loop)
- Redirect singleport: dev1 ingress -> dev1 ingress (Loop)
- Redirect singleport: dummy egress -> dummy ingress (No Loop)
- Redirect multiport: dev1 ingress -> dummy ingress -> dummy egress (No Loop)

Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Victor Nogueira <victor@mojatatu.com>
Link: https://patch.msgid.link/20260525122556.973584-9-jhs@mojatatu.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-05-28 12:26:36 +02:00

1764 lines
54 KiB
JSON

[
{
"id": "5124",
"name": "Add mirred mirror to egress action",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
]
],
"cmdUnderTest": "$TC actions add action mirred egress mirror index 1 dev lo",
"expExitCode": "0",
"verifyCmd": "$TC actions list action mirred",
"matchPattern": "action order [0-9]*: mirred \\(Egress Mirror to device lo\\).*index 1 ref",
"matchCount": "1",
"teardown": [
"$TC actions flush action mirred"
]
},
{
"id": "6fb4",
"name": "Add mirred redirect to egress action",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
]
],
"cmdUnderTest": "$TC actions add action mirred egress redirect index 2 dev lo action pipe",
"expExitCode": "0",
"verifyCmd": "$TC actions list action mirred",
"matchPattern": "action order [0-9]*: mirred \\(Egress Redirect to device lo\\).*index 2 ref",
"matchCount": "1",
"teardown": [
"$TC actions flush action mirred",
"$TC actions flush action gact"
]
},
{
"id": "ba38",
"name": "Get mirred actions",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
],
"$TC actions add action mirred egress mirror index 1 dev lo",
"$TC actions add action mirred egress redirect index 2 dev lo"
],
"cmdUnderTest": "$TC actions show action mirred",
"expExitCode": "0",
"verifyCmd": "$TC actions list action mirred",
"matchPattern": "[Mirror|Redirect] to device lo",
"matchCount": "2",
"teardown": [
"$TC actions flush action mirred"
]
},
{
"id": "d7c0",
"name": "Add invalid mirred direction",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
]
],
"cmdUnderTest": "$TC actions add action mirred inbound mirror index 20 dev lo",
"expExitCode": "255",
"verifyCmd": "$TC actions list action mirred",
"matchPattern": "action order [0-9]*: mirred \\(.*to device lo\\).*index 20 ref",
"matchCount": "0",
"teardown": [
"$TC actions flush action mirred"
]
},
{
"id": "e213",
"name": "Add invalid mirred action",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
]
],
"cmdUnderTest": "$TC actions add action mirred egress remirror index 20 dev lo",
"expExitCode": "255",
"verifyCmd": "$TC actions list action mirred",
"matchPattern": "action order [0-9]*: mirred \\(Egress.*to device lo\\).*index 20 ref",
"matchCount": "0",
"teardown": [
"$TC actions flush action mirred"
]
},
{
"id": "2d89",
"name": "Add mirred action with invalid device",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
]
],
"cmdUnderTest": "$TC actions add action mirred egress mirror index 20 dev eltoh",
"expExitCode": "255",
"verifyCmd": "$TC actions list action mirred",
"matchPattern": "action order [0-9]*: mirred \\(.*to device eltoh\\).*index 20 ref",
"matchCount": "0",
"teardown": [
"$TC actions flush action mirred"
]
},
{
"id": "300b",
"name": "Add mirred action with duplicate index",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
],
"$TC actions add action mirred egress redirect index 15 dev lo"
],
"cmdUnderTest": "$TC actions add action mirred egress mirror index 15 dev lo",
"expExitCode": "255",
"verifyCmd": "$TC actions list action mirred",
"matchPattern": "action order [0-9]*: mirred \\(.*to device lo\\).*index 15 ref",
"matchCount": "1",
"teardown": [
"$TC actions flush action mirred"
]
},
{
"id": "8917",
"name": "Add mirred mirror action with control pass",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
]
],
"cmdUnderTest": "$TC actions add action mirred ingress mirror dev lo pass index 1",
"expExitCode": "0",
"verifyCmd": "$TC actions get action mirred index 1",
"matchPattern": "action order [0-9]*: mirred \\(Ingress Mirror to device lo\\) pass.*index 1 ref",
"matchCount": "1",
"teardown": [
"$TC actions flush action mirred"
]
},
{
"id": "1054",
"name": "Add mirred mirror action with control pipe",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
]
],
"cmdUnderTest": "$TC actions add action mirred ingress mirror dev lo pipe index 15",
"expExitCode": "0",
"verifyCmd": "$TC actions get action mirred index 15",
"matchPattern": "action order [0-9]*: mirred \\(Ingress Mirror to device lo\\) pipe.*index 15 ref",
"matchCount": "1",
"teardown": [
"$TC actions flush action mirred"
]
},
{
"id": "9887",
"name": "Add mirred mirror action with control continue",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
]
],
"cmdUnderTest": "$TC actions add action mirred ingress mirror dev lo continue index 15",
"expExitCode": "0",
"verifyCmd": "$TC actions get action mirred index 15",
"matchPattern": "action order [0-9]*: mirred \\(Ingress Mirror to device lo\\) continue.*index 15 ref",
"matchCount": "1",
"teardown": [
"$TC actions flush action mirred"
]
},
{
"id": "e4aa",
"name": "Add mirred mirror action with control reclassify",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
]
],
"cmdUnderTest": "$TC actions add action mirred ingress mirror dev lo reclassify index 150",
"expExitCode": "0",
"verifyCmd": "$TC actions get action mirred index 150",
"matchPattern": "action order [0-9]*: mirred \\(Ingress Mirror to device lo\\) reclassify.*index 150 ref",
"matchCount": "1",
"teardown": [
"$TC actions flush action mirred"
]
},
{
"id": "ece9",
"name": "Add mirred mirror action with control drop",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
]
],
"cmdUnderTest": "$TC actions add action mirred ingress mirror dev lo drop index 99",
"expExitCode": "0",
"verifyCmd": "$TC actions get action mirred index 99",
"matchPattern": "action order [0-9]*: mirred \\(Ingress Mirror to device lo\\) drop.*index 99 ref",
"matchCount": "1",
"teardown": [
"$TC actions flush action mirred"
]
},
{
"id": "0031",
"name": "Add mirred mirror action with control jump",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
]
],
"cmdUnderTest": "$TC actions add action mirred ingress mirror dev lo jump 10 index 99",
"expExitCode": "0",
"verifyCmd": "$TC actions get action mirred index 99",
"matchPattern": "action order [0-9]*: mirred \\(Ingress Mirror to device lo\\) jump 10.*index 99 ref",
"matchCount": "1",
"teardown": [
"$TC actions flush action mirred"
]
},
{
"id": "407c",
"name": "Add mirred mirror action with cookie",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
]
],
"cmdUnderTest": "$TC actions add action mirred ingress mirror dev lo reclassify cookie aa11bb22cc33dd44ee55",
"expExitCode": "0",
"verifyCmd": "$TC actions ls action mirred",
"matchPattern": "action order [0-9]*: mirred \\(Ingress Mirror to device lo\\) reclassify.*cookie aa11bb22cc33dd44ee55",
"matchCount": "1",
"teardown": [
"$TC actions flush action mirred"
]
},
{
"id": "8b69",
"name": "Add mirred mirror action with index at 32-bit maximum",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
]
],
"cmdUnderTest": "$TC actions add action mirred ingress mirror dev lo pipe index 4294967295",
"expExitCode": "0",
"verifyCmd": "$TC actions get action mirred index 4294967295",
"matchPattern": "action order [0-9]*: mirred \\(Ingress Mirror to device lo\\) pipe.*index 4294967295",
"matchCount": "1",
"teardown": [
"$TC actions flush action mirred"
]
},
{
"id": "3f66",
"name": "Add mirred mirror action with index exceeding 32-bit maximum",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
]
],
"cmdUnderTest": "$TC actions add action mirred ingress mirror dev lo pipe index 429496729555",
"expExitCode": "255",
"verifyCmd": "$TC actions get action mirred index 429496729555",
"matchPattern": "action order [0-9]*: mirred \\(Ingress Mirror to device lo\\) pipe.*index 429496729555",
"matchCount": "0",
"teardown": []
},
{
"id": "a70e",
"name": "Delete mirred mirror action",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
],
"$TC actions add action mirred egress mirror index 5 dev lo"
],
"cmdUnderTest": "$TC actions del action mirred index 5",
"expExitCode": "0",
"verifyCmd": "$TC actions list action mirred",
"matchPattern": "action order [0-9]*: mirred \\(Egress Mirror to device lo\\).*index 5 ref",
"matchCount": "0",
"teardown": [
"$TC actions flush action mirred"
]
},
{
"id": "3fb3",
"name": "Delete mirred redirect action",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
],
"$TC actions add action mirred egress redirect index 5 dev lo"
],
"cmdUnderTest": "$TC actions del action mirred index 5",
"expExitCode": "0",
"verifyCmd": "$TC actions list action mirred",
"matchPattern": "action order [0-9]*: mirred \\(Egress Redirect to device lo\\).*index 5 ref",
"matchCount": "0",
"teardown": [
"$TC actions flush action mirred"
]
},
{
"id": "2a9a",
"name": "Replace mirred action with invalid goto chain control",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
],
"$TC actions add action mirred ingress mirror dev lo drop index 90"
],
"cmdUnderTest": "$TC actions replace action mirred ingress mirror dev lo goto chain 42 index 90 cookie c1a0c1a0",
"expExitCode": "255",
"verifyCmd": "$TC actions get action mirred index 90",
"matchPattern": "action order [0-9]*: mirred \\(Ingress Mirror to device lo\\) drop.*index 90 ref",
"matchCount": "1",
"teardown": [
"$TC actions flush action mirred"
]
},
{
"id": "4749",
"name": "Add batch of 32 mirred redirect egress actions with cookie",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
]
],
"cmdUnderTest": "bash -c \"for i in \\`seq 1 32\\`; do cmd=\\\"action mirred egress redirect dev lo index \\$i cookie aabbccddeeff112233445566778800a1 \\\"; args=\"\\$args\\$cmd\"; done && $TC actions add \\$args\"",
"expExitCode": "0",
"verifyCmd": "$TC actions list action mirred",
"matchPattern": "^[ \t]+index [0-9]+ ref",
"matchCount": "32",
"teardown": [
"$TC actions flush action mirred"
]
},
{
"id": "5c69",
"name": "Delete batch of 32 mirred redirect egress actions",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
],
"bash -c \"for i in \\`seq 1 32\\`; do cmd=\\\"action mirred egress redirect dev lo index \\$i \\\"; args=\\\"\\$args\\$cmd\\\"; done && $TC actions add \\$args\""
],
"cmdUnderTest": "bash -c \"for i in \\`seq 1 32\\`; do cmd=\\\"action mirred index \\$i \\\"; args=\"\\$args\\$cmd\"; done && $TC actions del \\$args\"",
"expExitCode": "0",
"verifyCmd": "$TC actions list action mirred",
"matchPattern": "^[ \t]+index [0-9]+ ref",
"matchCount": "0",
"teardown": []
},
{
"id": "d3c0",
"name": "Add batch of 32 mirred mirror ingress actions with cookie",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
]
],
"cmdUnderTest": "bash -c \"for i in \\`seq 1 32\\`; do cmd=\\\"action mirred ingress mirror dev lo index \\$i cookie aabbccddeeff112233445566778800a1 \\\"; args=\"\\$args\\$cmd\"; done && $TC actions add \\$args\"",
"expExitCode": "0",
"verifyCmd": "$TC actions list action mirred",
"matchPattern": "^[ \t]+index [0-9]+ ref",
"matchCount": "32",
"teardown": [
"$TC actions flush action mirred"
]
},
{
"id": "e684",
"name": "Delete batch of 32 mirred mirror ingress actions",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
],
"bash -c \"for i in \\`seq 1 32\\`; do cmd=\\\"action mirred ingress mirror dev lo index \\$i \\\"; args=\\\"\\$args\\$cmd\\\"; done && $TC actions add \\$args\""
],
"cmdUnderTest": "bash -c \"for i in \\`seq 1 32\\`; do cmd=\\\"action mirred index \\$i \\\"; args=\"\\$args\\$cmd\"; done && $TC actions del \\$args\"",
"expExitCode": "0",
"verifyCmd": "$TC actions list action mirred",
"matchPattern": "^[ \t]+index [0-9]+ ref",
"matchCount": "0",
"teardown": []
},
{
"id": "31e3",
"name": "Add mirred mirror to egress action with no_percpu flag",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
]
],
"cmdUnderTest": "$TC actions add action mirred egress mirror dev lo no_percpu",
"expExitCode": "0",
"verifyCmd": "$TC actions list action mirred",
"matchPattern": "action order [0-9]*: mirred \\(Egress Mirror to device lo\\).*no_percpu",
"matchCount": "1",
"teardown": [
"$TC actions flush action mirred"
]
},
{
"id": "456d",
"name": "Add mirred mirror to egress block action",
"category": [
"actions",
"mirred"
],
"dependsOn": "$TC actions add action mirred help 2>&1 | grep -q blockid",
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
],
[
"$TC qdisc add dev $DEV1 egress_block 21 clsact",
0
]
],
"cmdUnderTest": "$TC actions add action mirred egress mirror index 1 blockid 21",
"expExitCode": "0",
"verifyCmd": "$TC -j actions get action mirred index 1",
"matchJSON": [
{
"total acts": 0
},
{
"actions": [
{
"order": 1,
"kind": "mirred",
"mirred_action": "mirror",
"direction": "egress",
"to_blockid": 21,
"control_action": {
"type": "pipe"
},
"index": 1,
"ref": 1,
"bind": 0,
"not_in_hw": true
}
]
}
],
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DEV1 egress_block 21 clsact",
"$TC actions flush action mirred"
]
},
{
"id": "2358",
"name": "Add mirred mirror to ingress block action",
"category": [
"actions",
"mirred"
],
"dependsOn": "$TC actions add action mirred help 2>&1 | grep -q blockid",
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
],
[
"$TC qdisc add dev $DEV1 ingress_block 21 clsact",
0
]
],
"cmdUnderTest": "$TC actions add action mirred ingress mirror index 1 blockid 21",
"expExitCode": "0",
"verifyCmd": "$TC -j actions get action mirred index 1",
"matchJSON": [
{
"total acts": 0
},
{
"actions": [
{
"order": 1,
"kind": "mirred",
"mirred_action": "mirror",
"direction": "ingress",
"to_blockid": 21,
"control_action": {
"type": "pipe"
},
"index": 1,
"ref": 1,
"bind": 0,
"not_in_hw": true
}
]
}
],
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DEV1 ingress_block 21 clsact",
"$TC actions flush action mirred"
]
},
{
"id": "fdb1",
"name": "Add mirred redirect to egress block action",
"category": [
"actions",
"mirred"
],
"dependsOn": "$TC actions add action mirred help 2>&1 | grep -q blockid",
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
],
[
"$TC qdisc add dev $DEV1 ingress_block 21 clsact",
0
]
],
"cmdUnderTest": "$TC actions add action mirred egress redirect index 1 blockid 21",
"expExitCode": "0",
"verifyCmd": "$TC -j actions get action mirred index 1",
"matchJSON": [
{
"total acts": 0
},
{
"actions": [
{
"order": 1,
"kind": "mirred",
"mirred_action": "redirect",
"direction": "egress",
"to_blockid": 21,
"control_action": {
"type": "stolen"
},
"index": 1,
"ref": 1,
"bind": 0,
"not_in_hw": true
}
]
}
],
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DEV1 ingress_block 21 clsact",
"$TC actions flush action mirred"
]
},
{
"id": "20cc",
"name": "Add mirred redirect to ingress block action",
"category": [
"actions",
"mirred"
],
"dependsOn": "$TC actions add action mirred help 2>&1 | grep -q blockid",
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
],
[
"$TC qdisc add dev $DEV1 ingress_block 21 clsact",
0
]
],
"cmdUnderTest": "$TC actions add action mirred ingress redirect index 1 blockid 21",
"expExitCode": "0",
"verifyCmd": "$TC -j actions get action mirred index 1",
"matchJSON": [
{
"total acts": 0
},
{
"actions": [
{
"order": 1,
"kind": "mirred",
"mirred_action": "redirect",
"direction": "ingress",
"to_blockid": 21,
"control_action": {
"type": "stolen"
},
"index": 1,
"ref": 1,
"bind": 0,
"not_in_hw": true
}
]
}
],
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DEV1 ingress_block 21 clsact",
"$TC actions flush action mirred"
]
},
{
"id": "e739",
"name": "Try to add mirred action with both dev and block",
"category": [
"actions",
"mirred"
],
"dependsOn": "$TC actions add action mirred help 2>&1 | grep -q blockid",
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
],
[
"$TC qdisc add dev $DEV1 ingress_block 21 clsact",
0
]
],
"cmdUnderTest": "$TC actions add action mirred ingress redirect index 1 blockid 21 dev $DEV1",
"expExitCode": "255",
"verifyCmd": "$TC -j actions list action mirred",
"matchJSON": [],
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DEV1 ingress_block 21 clsact",
"$TC actions flush action mirred"
]
},
{
"id": "2f47",
"name": "Try to add mirred action without specifying neither dev nor block",
"category": [
"actions",
"mirred"
],
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
],
[
"$TC qdisc add dev $DEV1 ingress_block 21 clsact",
0
]
],
"cmdUnderTest": "$TC actions add action mirred ingress redirect index 1",
"expExitCode": "255",
"verifyCmd": "$TC -j actions list action mirred",
"matchJSON": [],
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DEV1 ingress_block 21 clsact",
"$TC actions flush action mirred"
]
},
{
"id": "3188",
"name": "Replace mirred redirect to dev action with redirect to block",
"category": [
"actions",
"mirred"
],
"dependsOn": "$TC actions add action mirred help 2>&1 | grep -q blockid",
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
],
[
"$TC qdisc add dev $DEV1 ingress_block 21 clsact",
0
],
[
"$TC actions add action mirred ingress redirect index 1 dev $DEV1",
0
]
],
"cmdUnderTest": "$TC actions replace action mirred egress redirect index 1 blockid 21",
"expExitCode": "0",
"verifyCmd": "$TC -j actions get action mirred index 1",
"matchJSON": [
{
"total acts": 0
},
{
"actions": [
{
"order": 1,
"kind": "mirred",
"mirred_action": "redirect",
"direction": "egress",
"to_blockid": 21,
"control_action": {
"type": "stolen"
},
"index": 1,
"ref": 1,
"bind": 0,
"not_in_hw": true
}
]
}
],
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DEV1 ingress_block 21 clsact",
"$TC actions flush action mirred"
]
},
{
"id": "83cc",
"name": "Replace mirred redirect to block action with mirror to dev",
"category": [
"actions",
"mirred"
],
"dependsOn": "$TC actions add action mirred help 2>&1 | grep -q blockid",
"plugins": {
"requires": "nsPlugin"
},
"setup": [
[
"$TC actions flush action mirred",
0,
1,
255
],
[
"$TC qdisc add dev $DEV1 ingress_block 21 clsact",
0
],
[
"$TC actions add action mirred egress redirect index 1 blockid 21",
0
]
],
"cmdUnderTest": "$TC actions replace action mirred ingress mirror index 1 dev lo",
"expExitCode": "0",
"verifyCmd": "$TC -j actions get action mirred index 1",
"matchJSON": [
{
"total acts": 0
},
{
"actions": [
{
"order": 1,
"kind": "mirred",
"mirred_action": "mirror",
"direction": "ingress",
"to_dev": "lo",
"control_action": {
"type": "pipe"
},
"index": 1,
"ref": 1,
"bind": 0,
"not_in_hw": true
}
]
}
],
"matchCount": "1",
"teardown": [
"$TC qdisc del dev $DEV1 ingress_block 21 clsact",
"$TC actions flush action mirred"
]
},
{
"id": "7eba",
"name": "Redirect multiport: dummy egress -> dummy egress (Loop)",
"category": [
"filter",
"mirred"
],
"plugins": {
"requires": [
"nsPlugin"
]
},
"setup": [
"$IP link set dev $DUMMY up || true",
"$IP addr add 10.10.10.10/24 dev $DUMMY || true",
"$TC qdisc add dev $DUMMY handle 1: root drr",
"$TC filter add dev $DUMMY parent 1: protocol ip prio 10 matchall action mirred egress redirect dev $DUMMY index 1"
],
"cmdUnderTest": "ping -c1 -W0.01 -I $DUMMY 10.10.10.1",
"expExitCode": "1",
"verifyCmd": "$TC -j -s actions get action mirred index 1",
"matchJSON": [
{
"total acts": 0
},
{
"actions": [
{
"order": 1,
"kind": "mirred",
"mirred_action": "redirect",
"direction": "egress",
"index": 1,
"stats": {
"packets": 1,
"overlimits": 1
},
"not_in_hw": true
}
]
}
],
"teardown": [
"$TC qdisc del dev $DUMMY root"
]
},
{
"id": "4ed9",
"name": "Try to redirect to self on egress with clsact",
"category": [
"filter",
"mirred"
],
"plugins": {
"requires": [
"nsPlugin"
]
},
"setup": [
"$IP link set dev $DUMMY up || true",
"$IP addr add 10.10.10.10/24 dev $DUMMY || true",
"$TC qdisc add dev $DUMMY clsact",
"$TC filter add dev $DUMMY egress protocol ip prio 10 matchall action mirred egress redirect dev $DUMMY index 1"
],
"cmdUnderTest": "ping -c1 -W0.01 -I $DUMMY 10.10.10.1",
"expExitCode": "1",
"verifyCmd": "$TC -j -s actions get action mirred index 1",
"matchJSON": [
{
"total acts": 0
},
{
"actions": [
{
"order": 1,
"kind": "mirred",
"mirred_action": "redirect",
"direction": "egress",
"index": 1,
"stats": {
"packets": 1,
"overlimits": 1
},
"not_in_hw": true
}
]
}
],
"teardown": [
"$TC qdisc del dev $DUMMY clsact"
]
},
{
"id": "531c",
"name": "Redirect multiport: dummy egress -> dev1 ingress -> dummy egress (Loop)",
"category": [
"filter",
"mirred"
],
"plugins": {
"requires": [
"nsPlugin"
]
},
"setup": [
"$IP link set dev $DUMMY up || true",
"$IP addr add 10.10.10.10/24 dev $DUMMY || true",
"$TC qdisc add dev $DUMMY clsact",
"$TC filter add dev $DUMMY egress protocol ip prio 10 matchall action mirred ingress redirect dev $DEV1 index 1",
"$TC qdisc add dev $DEV1 clsact",
"$TC filter add dev $DEV1 ingress protocol ip prio 10 matchall action mirred egress redirect dev $DUMMY index 2"
],
"cmdUnderTest": "ping -c1 -W0.01 -I $DUMMY 10.10.10.1",
"expExitCode": "1",
"verifyCmd": "$TC -j -s actions get action mirred index 1",
"matchJSON": [
{
"total acts": 0
},
{
"actions": [
{
"order": 1,
"kind": "mirred",
"mirred_action": "redirect",
"direction": "ingress",
"index": 1,
"stats": {
"packets": 3
},
"not_in_hw": true
}
]
}
],
"teardown": [
"$TC qdisc del dev $DUMMY clsact",
"$TC qdisc del dev $DEV1 clsact"
]
},
{
"id": "b1d7",
"name": "Redirect singleport: dev1 ingress -> dev1 egress -> dev1 ingress (Loop)",
"category": [
"filter",
"mirred"
],
"plugins": {
"requires": [
"nsPlugin",
"scapyPlugin"
]
},
"setup": [
"$TC qdisc add dev $DEV1 clsact",
"$TC filter add dev $DEV1 ingress protocol ip prio 10 matchall action mirred egress redirect dev $DEV1 index 1"
],
"cmdUnderTest": "$TC filter add dev $DEV1 egress protocol ip prio 11 matchall action mirred ingress redirect dev $DEV1 index 2",
"scapy": [
{
"iface": "$DEV0",
"count": 1,
"packet": "Ether()/IP(dst='10.10.10.1', src='10.10.10.10')/ICMP()"
}
],
"expExitCode": "0",
"verifyCmd": "$TC -j -s actions get action mirred index 1",
"matchJSON": [
{
"total acts": 0
},
{
"actions": [
{
"order": 1,
"kind": "mirred",
"mirred_action": "redirect",
"direction": "egress",
"index": 1,
"stats": {
"packets": 3
},
"not_in_hw": true
}
]
}
],
"teardown": [
"$TC qdisc del dev $DEV1 clsact"
]
},
{
"id": "c66d",
"name": "Redirect multiport: dev1 ingress -> dummy ingress -> dev1 egress (No Loop)",
"category": [
"filter",
"mirred"
],
"plugins": {
"requires": [
"nsPlugin",
"scapyPlugin"
]
},
"setup": [
"$TC qdisc add dev $DEV1 clsact",
"$TC filter add dev $DEV1 ingress protocol ip prio 10 matchall action mirred ingress redirect dev $DUMMY index 1",
"$TC qdisc add dev $DUMMY clsact"
],
"cmdUnderTest": "$TC filter add dev $DUMMY ingress protocol ip prio 11 matchall action mirred egress redirect dev $DEV1 index 2",
"scapy": [
{
"iface": "$DEV0",
"count": 1,
"packet": "Ether()/IP(dst='10.10.10.1', src='10.10.10.10')/ICMP()"
}
],
"expExitCode": "0",
"verifyCmd": "$TC -j -s actions get action mirred index 1",
"matchJSON": [
{
"total acts": 0
},
{
"actions": [
{
"order": 1,
"kind": "mirred",
"mirred_action": "redirect",
"direction": "ingress",
"index": 1,
"stats": {
"packets": 1
},
"not_in_hw": true
}
]
}
],
"teardown": [
"$TC qdisc del dev $DEV1 clsact",
"$TC qdisc del dev $DUMMY clsact"
]
},
{
"id": "aa99",
"name": "Redirect multiport: dev1 ingress -> dummy ingress -> dev1 ingress (Loop)",
"category": [
"filter",
"mirred"
],
"plugins": {
"requires": [
"nsPlugin",
"scapyPlugin"
]
},
"setup": [
"$TC qdisc add dev $DEV1 clsact",
"$TC filter add dev $DEV1 ingress protocol ip prio 10 matchall action mirred ingress redirect dev $DUMMY index 1",
"$TC qdisc add dev $DUMMY clsact"
],
"cmdUnderTest": "$TC filter add dev $DUMMY ingress protocol ip prio 11 matchall action mirred ingress redirect dev $DEV1 index 2",
"scapy": [
{
"iface": "$DEV0",
"count": 1,
"packet": "Ether()/IP(dst='10.10.10.1', src='10.10.10.10')/ICMP()"
}
],
"expExitCode": "0",
"verifyCmd": "$TC -j -s actions get action mirred index 1",
"matchJSON": [
{
"total acts": 0
},
{
"actions": [
{
"order": 1,
"kind": "mirred",
"mirred_action": "redirect",
"direction": "ingress",
"index": 1,
"stats": {
"packets": 2,
"overlimits": 1
},
"not_in_hw": true
}
]
}
],
"teardown": [
"$TC qdisc del dev $DEV1 clsact",
"$TC qdisc del dev $DUMMY clsact"
]
},
{
"id": "37d7",
"name": "Redirect multiport: dev1 ingress -> dummy egress -> dev1 ingress (Loop)",
"category": [
"filter",
"mirred"
],
"plugins": {
"requires": [
"nsPlugin",
"scapyPlugin"
]
},
"setup": [
"$TC qdisc add dev $DEV1 clsact",
"$TC filter add dev $DEV1 ingress protocol ip prio 10 matchall action mirred egress redirect dev $DUMMY index 1",
"$TC qdisc add dev $DUMMY clsact"
],
"cmdUnderTest": "$TC filter add dev $DUMMY egress protocol ip prio 11 matchall action mirred ingress redirect dev $DEV1 index 2",
"scapy": [
{
"iface": "$DEV0",
"count": 1,
"packet": "Ether()/IP(dst='10.10.10.1', src='10.10.10.10')/ICMP()"
}
],
"expExitCode": "0",
"verifyCmd": "$TC -j -s actions get action mirred index 1",
"matchJSON": [
{
"total acts": 0
},
{
"actions": [
{
"order": 1,
"kind": "mirred",
"mirred_action": "redirect",
"direction": "egress",
"index": 1,
"stats": {
"packets": 3
},
"not_in_hw": true
}
]
}
],
"teardown": [
"$TC qdisc del dev $DEV1 clsact",
"$TC qdisc del dev $DUMMY clsact"
]
},
{
"id": "6d02",
"name": "Redirect multiport: dummy egress -> dev1 ingress -> dummy egress, different prios (Loop)",
"category": [
"filter",
"mirred"
],
"plugins": {
"requires": [
"nsPlugin"
]
},
"setup": [
"$IP link set dev $DUMMY up || true",
"$IP addr add 10.10.10.10/24 dev $DUMMY || true",
"$TC qdisc add dev $DUMMY clsact",
"$TC filter add dev $DUMMY egress protocol ip prio 10 matchall action mirred ingress redirect dev $DEV1 index 1",
"$TC qdisc add dev $DEV1 clsact",
"$TC filter add dev $DEV1 ingress protocol ip prio 11 matchall action mirred egress redirect dev $DUMMY index 2"
],
"cmdUnderTest": "ping -c1 -W0.01 -I $DUMMY 10.10.10.1",
"expExitCode": "1",
"verifyCmd": "$TC -j -s actions get action mirred index 1",
"matchJSON": [
{
"total acts": 0
},
{
"actions": [
{
"order": 1,
"kind": "mirred",
"mirred_action": "redirect",
"direction": "ingress",
"index": 1,
"stats": {
"packets": 3
},
"not_in_hw": true
}
]
}
],
"teardown": [
"$TC qdisc del dev $DUMMY clsact",
"$TC qdisc del dev $DEV1 clsact"
]
},
{
"id": "8115",
"name": "Redirect multiport: dev1 ingress -> dummy ingress -> dummy egress -> dev1 egress (No Loop)",
"category": [
"filter",
"mirred"
],
"plugins": {
"requires": [
"nsPlugin",
"scapyPlugin"
]
},
"setup": [
"$TC qdisc add dev $DEV1 clsact",
"$TC filter add dev $DEV1 ingress protocol ip prio 10 matchall action mirred ingress redirect dev $DUMMY index 1",
"$TC qdisc add dev $DUMMY clsact",
"$TC filter add dev $DUMMY ingress protocol ip prio 11 matchall action mirred egress redirect dev $DUMMY index 2"
],
"cmdUnderTest": "$TC filter add dev $DUMMY egress protocol ip prio 12 matchall action mirred egress redirect dev $DEV1 index 3",
"scapy": [
{
"iface": "$DEV0",
"count": 1,
"packet": "Ether()/IP(dst='10.10.10.1', src='10.10.10.10')/ICMP()"
}
],
"expExitCode": "0",
"verifyCmd": "$TC -j -s actions get action mirred index 1",
"matchJSON": [
{
"total acts": 0
},
{
"actions": [
{
"order": 1,
"kind": "mirred",
"mirred_action": "redirect",
"direction": "ingress",
"index": 1,
"stats": {
"packets": 1
},
"not_in_hw": true
}
]
}
],
"teardown": [
"$TC qdisc del dev $DEV1 clsact",
"$TC qdisc del dev $DUMMY clsact"
]
},
{
"id": "9eb3",
"name": "Redirect multiport: dev1 ingress -> dummy egress -> dev1 egress (No Loop)",
"category": [
"filter",
"mirred"
],
"plugins": {
"requires": [
"nsPlugin",
"scapyPlugin"
]
},
"setup": [
"$TC qdisc add dev $DEV1 clsact",
"$TC filter add dev $DEV1 ingress protocol ip prio 10 matchall action mirred egress redirect dev $DUMMY index 1",
"$TC qdisc add dev $DUMMY clsact"
],
"cmdUnderTest": "$TC filter add dev $DUMMY egress protocol ip prio 11 matchall action mirred egress redirect dev $DEV1 index 2",
"scapy": [
{
"iface": "$DEV0",
"count": 1,
"packet": "Ether()/IP(dst='10.10.10.1', src='10.10.10.10')/ICMP()"
}
],
"expExitCode": "0",
"verifyCmd": "$TC -j -s actions get action mirred index 1",
"matchJSON": [
{
"total acts": 0
},
{
"actions": [
{
"order": 1,
"kind": "mirred",
"mirred_action": "redirect",
"direction": "egress",
"index": 1,
"stats": {
"packets": 1
},
"not_in_hw": true
}
]
}
],
"teardown": [
"$TC qdisc del dev $DEV1 clsact",
"$TC qdisc del dev $DUMMY clsact"
]
},
{
"id": "d837",
"name": "Redirect multiport: dev1 ingress -> dummy egress -> dummy ingress (No Loop)",
"category": [
"filter",
"mirred"
],
"plugins": {
"requires": [
"nsPlugin",
"scapyPlugin"
]
},
"setup": [
"$TC qdisc add dev $DEV1 clsact",
"$TC filter add dev $DEV1 ingress protocol ip prio 10 matchall action mirred egress redirect dev $DUMMY index 1",
"$TC qdisc add dev $DUMMY clsact"
],
"cmdUnderTest": "$TC filter add dev $DUMMY egress protocol ip prio 11 matchall action mirred ingress redirect dev $DUMMY index 2",
"scapy": [
{
"iface": "$DEV0",
"count": 1,
"packet": "Ether()/IP(dst='10.10.10.1', src='10.10.10.10')/ICMP()"
}
],
"expExitCode": "0",
"verifyCmd": "$TC -j -s actions get action mirred index 1",
"matchJSON": [
{
"total acts": 0
},
{
"actions": [
{
"order": 1,
"kind": "mirred",
"mirred_action": "redirect",
"direction": "egress",
"index": 1,
"stats": {
"packets": 1
},
"not_in_hw": true
}
]
}
],
"teardown": [
"$TC qdisc del dev $DEV1 clsact",
"$TC qdisc del dev $DUMMY clsact"
]
},
{
"id": "2071",
"name": "Redirect singleport: dev1 ingress -> dev1 ingress (Loop)",
"category": [
"filter",
"mirred"
],
"plugins": {
"requires": [
"nsPlugin",
"scapyPlugin"
]
},
"setup": [
"$TC qdisc add dev $DEV1 clsact"
],
"cmdUnderTest": "$TC filter add dev $DEV1 ingress protocol ip prio 10 matchall action mirred ingress redirect dev $DEV1 index 1",
"scapy": [
{
"iface": "$DEV0",
"count": 1,
"packet": "Ether()/IP(dst='10.10.10.1', src='10.10.10.10')/ICMP()"
}
],
"expExitCode": "0",
"verifyCmd": "$TC -j -s actions get action mirred index 1",
"matchJSON": [
{
"total acts": 0
},
{
"actions": [
{
"order": 1,
"kind": "mirred",
"mirred_action": "redirect",
"direction": "ingress",
"index": 1,
"stats": {
"packets": 1,
"overlimits": 1
},
"not_in_hw": true
}
]
}
],
"teardown": [
"$TC qdisc del dev $DEV1 clsact"
]
},
{
"id": "0101",
"name": "Redirect singleport: dummy egress -> dummy ingress (No Loop)",
"category": [
"filter",
"mirred"
],
"plugins": {
"requires": [
"nsPlugin"
]
},
"setup": [
"$IP addr add 10.10.10.10/24 dev $DUMMY || true",
"$TC qdisc add dev $DUMMY clsact",
"$TC filter add dev $DUMMY egress protocol ip prio 11 matchall action mirred ingress redirect dev $DUMMY index 1"
],
"cmdUnderTest": "ping -c1 -W0.01 -I $DUMMY 10.10.10.1",
"expExitCode": "1",
"verifyCmd": "$TC -j -s actions get action mirred index 1",
"matchJSON": [
{
"total acts": 0
},
{
"actions": [
{
"order": 1,
"kind": "mirred",
"mirred_action": "redirect",
"direction": "ingress",
"index": 1,
"stats": {
"packets": 1
},
"not_in_hw": true
}
]
}
],
"teardown": [
"$TC qdisc del dev $DUMMY clsact"
]
},
{
"id": "cf97",
"name": "Redirect multiport: dev1 ingress -> dummy ingress -> dummy egress (No Loop)",
"category": [
"filter",
"mirred"
],
"plugins": {
"requires": [
"nsPlugin",
"scapyPlugin"
]
},
"setup": [
"$TC qdisc add dev $DEV1 clsact",
"$TC filter add dev $DEV1 ingress protocol ip prio 10 matchall action mirred ingress redirect dev $DUMMY index 1",
"$TC qdisc add dev $DUMMY clsact"
],
"cmdUnderTest": "$TC filter add dev $DUMMY ingress protocol ip prio 11 matchall action mirred egress redirect dev $DUMMY index 2",
"scapy": [
{
"iface": "$DEV0",
"count": 1,
"packet": "Ether()/IP(dst='10.10.10.1', src='10.10.10.10')/ICMP()"
}
],
"expExitCode": "0",
"verifyCmd": "$TC -j -s actions get action mirred index 1",
"matchJSON": [
{
"total acts": 0
},
{
"actions": [
{
"order": 1,
"kind": "mirred",
"mirred_action": "redirect",
"direction": "ingress",
"index": 1,
"stats": {
"packets": 1
},
"not_in_hw": true
}
]
}
],
"teardown": [
"$TC qdisc del dev $DEV1 clsact",
"$TC qdisc del dev $DUMMY clsact"
]
}
]