linux/tools/testing/selftests/tc-testing/tc-tests/filters/matchall.json

[
    {
        "id": "f62b",
        "name": "Add ingress matchall filter for protocol ipv4 and action PASS",
        "category": [
            "filter",
            "matchall"
        ],
	"plugins": {
		"requires": "nsPlugin"
	},
        "setup": [
            "$TC qdisc add dev $DUMMY ingress"
        ],
        "cmdUnderTest": "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ip matchall action ok",
        "expExitCode": "0",
        "verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 1 prio 1 protocol ip matchall",
        "matchPattern": "^filter parent ffff: protocol ip pref 1 matchall.*handle 0x1.*gact action pass.*ref 1 bind 1",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DUMMY ingress"
        ]
    },
    {
        "id": "7f09",
        "name": "Add egress matchall filter for protocol ipv4 and action PASS",
        "category": [
            "filter",
            "matchall"
        ],
	"plugins": {
		"requires": "nsPlugin"
	},
        "setup": [
            "$TC qdisc add dev $DUMMY root handle 1: prio"
        ],
        "cmdUnderTest": "$TC filter add dev $DUMMY parent 1: handle 0x1 prio 1 protocol ip matchall action ok",
        "expExitCode": "0",
        "verifyCmd": "$TC filter get dev $DUMMY parent 1: handle 1 prio 1 protocol ip matchall",
        "matchPattern": "^filter parent 1: protocol ip pref 1 matchall.*handle 0x1.*gact action pass.*ref 1 bind 1",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DUMMY root handle 1: prio"
        ]
    },
    {
        "id": "0596",
        "name": "Add ingress matchall filter for protocol ipv6 and action DROP",
        "category": [
            "filter",
            "matchall"
        ],
	"plugins": {
		"requires": "nsPlugin"
	},
        "setup": [
            "$TC qdisc add dev $DUMMY ingress"
        ],
        "cmdUnderTest": "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv6 matchall action drop",
        "expExitCode": "0",
        "verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 1 prio 1 protocol ipv6 matchall",
        "matchPattern": "^filter parent ffff: protocol ipv6 pref 1 matchall.*handle 0x1.*gact action drop.*ref 1 bind 1",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DUMMY ingress"
        ]
    },
    {
        "id": "41df",
        "name": "Add egress matchall filter for protocol ipv6 and action DROP",
        "category": [
            "filter",
            "matchall"
        ],
	"plugins": {
		"requires": "nsPlugin"
	},
        "setup": [
            "$TC qdisc add dev $DUMMY root handle 1: prio"
        ],
        "cmdUnderTest": "$TC filter add dev $DUMMY parent 1: handle 0x1 prio 1 protocol ipv6 matchall action drop",
        "expExitCode": "0",
        "verifyCmd": "$TC filter get dev $DUMMY parent 1: handle 1 prio 1 protocol ipv6 matchall",
        "matchPattern": "^filter parent 1: protocol ipv6 pref 1 matchall.*handle 0x1.*gact action drop.*ref 1 bind 1",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DUMMY root handle 1: prio"
        ]
    },
    {
        "id": "e1da",
        "name": "Add ingress matchall filter for protocol ipv4 and action PASS with priority at 16-bit maximum",
        "category": [
            "filter",
            "matchall"
        ],
	"plugins": {
		"requires": "nsPlugin"
	},
        "setup": [
            "$TC qdisc add dev $DUMMY ingress"
        ],
        "cmdUnderTest": "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 65535 protocol ipv4 matchall action pass",
        "expExitCode": "0",
        "verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 1 prio 65535 protocol ipv4 matchall",
        "matchPattern": "^filter parent ffff: protocol ip pref 65535 matchall.*handle 0x1.*gact action pass.*ref 1 bind 1",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DUMMY ingress"
        ]
    },
    {
        "id": "3de5",
        "name": "Add egress matchall filter for protocol ipv4 and action PASS with priority at 16-bit maximum",
        "category": [
            "filter",
            "matchall"
        ],
	"plugins": {
		"requires": "nsPlugin"
	},
        "setup": [
            "$TC qdisc add dev $DUMMY root handle 1: prio"
        ],
        "cmdUnderTest": "$TC filter add dev $DUMMY parent 1: handle 0x1 prio 65535 protocol ipv4 matchall action pass",
        "expExitCode": "0",
        "verifyCmd": "$TC filter get dev $DUMMY parent 1: handle 1 prio 65535 protocol ipv4 matchall",
        "matchPattern": "^filter parent 1: protocol ip pref 65535 matchall.*handle 0x1.*gact action pass.*ref 1 bind 1",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DUMMY root handle 1: prio"
        ]
    },
    {
        "id": "72d7",
        "name": "Add ingress matchall filter for protocol ipv4 and action PASS with priority exceeding 16-bit maximum",
        "category": [
            "filter",
            "matchall"
        ],
	"plugins": {
		"requires": "nsPlugin"
	},
        "setup": [
            "$TC qdisc add dev $DUMMY ingress"
        ],
        "cmdUnderTest": "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 655355 protocol ipv4 matchall action pass",
        "expExitCode": "255",
        "verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 1 prio 655355 protocol ipv4 matchall",
        "matchPattern": "^filter parent ffff: protocol ip pref 655355 matchall.*handle 0x1.*gact action pass.*ref 1 bind 1",
        "matchCount": "0",
        "teardown": [
            "$TC qdisc del dev $DUMMY ingress"
        ]
    },
    {
        "id": "41d3",
        "name": "Add egress matchall filter for protocol ipv4 and action PASS with priority exceeding 16-bit maximum",
        "category": [
            "filter",
            "matchall"
        ],
	"plugins": {
		"requires": "nsPlugin"
	},
        "setup": [
            "$TC qdisc add dev $DUMMY root handle 1: prio"
        ],
        "cmdUnderTest": "$TC filter add dev $DUMMY parent 1: handle 0x1 prio 655355 protocol ipv4 matchall action pass",
        "expExitCode": "255",
        "verifyCmd": "$TC filter get dev $DUMMY parent 1: handle 1 prio 655355 protocol ipv4 matchall",
        "matchPattern": "^filter parent 1: protocol ip pref 655355 matchall.*handle 0x1.*gact action pass.*ref 1 bind 1",
        "matchCount": "0",
        "teardown": [
            "$TC qdisc del dev $DUMMY root handle 1: prio"
        ]
    },
    {
        "id": "f755",
        "name": "Add ingress matchall filter for all protocols and action CONTINUE with handle at 32-bit maximum",
        "category": [
            "filter",
            "matchall"
        ],
	"plugins": {
		"requires": "nsPlugin"
	},
        "setup": [
            "$TC qdisc add dev $DUMMY ingress"
        ],
        "cmdUnderTest": "$TC filter add dev $DUMMY parent ffff: handle 0xffffffff prio 1 protocol all matchall action continue",
        "expExitCode": "0",
        "verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 0xffffffff prio 1 protocol all matchall",
        "matchPattern": "^filter parent ffff: protocol all pref 1 matchall.*handle 0xffffffff.*gact action continue.*ref 1 bind 1",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DUMMY ingress"
        ]
    },
    {
        "id": "2c33",
        "name": "Add egress matchall filter for all protocols and action CONTINUE with handle at 32-bit maximum",
        "category": [
            "filter",
            "matchall"
        ],
	"plugins": {
		"requires": "nsPlugin"
	},
        "setup": [
            "$TC qdisc add dev $DUMMY root handle 1: prio"
        ],
        "cmdUnderTest": "$TC filter add dev $DUMMY parent 1: handle 0xffffffff prio 1 protocol all matchall action continue",
        "expExitCode": "0",
        "verifyCmd": "$TC filter get dev $DUMMY parent 1: handle 0xffffffff prio 1 protocol all matchall",
        "matchPattern": "^filter parent 1: protocol all pref 1 matchall.*handle 0xffffffff.*gact action continue.*ref 1 bind 1",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DUMMY root handle 1: prio"
        ]
    },
    {
        "id": "0e4a",
        "name": "Add ingress matchall filter for all protocols and action RECLASSIFY with skip_hw flag",
        "category": [
            "filter",
            "matchall"
        ],
	"plugins": {
		"requires": "nsPlugin"
	},
        "setup": [
            "$TC qdisc add dev $DUMMY ingress"
        ],
        "cmdUnderTest": "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol all matchall skip_hw action reclassify",
        "expExitCode": "0",
        "verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 0x1 prio 1 protocol all matchall",
        "matchPattern": "^filter parent ffff: protocol all pref 1 matchall.*handle 0x1.*skip_hw.*not_in_hw.*gact action reclassify.*ref 1 bind 1",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DUMMY ingress"
        ]
    },
    {
        "id": "7f60",
        "name": "Add egress matchall filter for all protocols and action RECLASSIFY with skip_hw flag",
        "category": [
            "filter",
            "matchall"
        ],
	"plugins": {
		"requires": "nsPlugin"
	},
        "setup": [
            "$TC qdisc add dev $DUMMY root handle 1: prio"
        ],
        "cmdUnderTest": "$TC filter add dev $DUMMY parent 1: handle 0x1 prio 1 protocol all matchall skip_hw action reclassify",
        "expExitCode": "0",
        "verifyCmd": "$TC filter get dev $DUMMY parent 1: handle 0x1 prio 1 protocol all matchall",
        "matchPattern": "^filter parent 1: protocol all pref 1 matchall.*handle 0x1.*skip_hw.*not_in_hw.*gact action reclassify.*ref 1 bind 1",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DUMMY root handle 1: prio"
        ]
    },
    {
        "id": "8bd2",
        "name": "Add ingress matchall filter for protocol ipv6 and action PASS with classid",
        "category": [
            "filter",
            "matchall"
        ],
	"plugins": {
		"requires": "nsPlugin"
	},
        "setup": [
            "$TC qdisc add dev $DUMMY ingress"
        ],
        "cmdUnderTest": "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv6 matchall classid 1:1 action pass",
        "expExitCode": "0",
        "verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv6 matchall",
        "matchPattern": "^filter parent ffff: protocol ipv6 pref 1 matchall.*handle 0x1.*flowid 1:1.*gact action pass.*ref 1 bind 1",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DUMMY ingress"
        ]
    },
    {
        "id": "2a4a",
        "name": "Add ingress matchall filter for protocol ipv6 and action PASS with invalid classid",
        "category": [
            "filter",
            "matchall"
        ],
	"plugins": {
		"requires": "nsPlugin"
	},
        "setup": [
            "$TC qdisc add dev $DUMMY ingress"
        ],
        "cmdUnderTest": "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv6 matchall classid 6789defg action pass",
        "expExitCode": "1",
        "verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv6 matchall",
        "matchPattern": "^filter protocol ipv6 pref 1 matchall.*handle 0x1.*flowid 6789defg.*gact action pass.*ref 1 bind 1",
        "matchCount": "0",
        "teardown": [
            "$TC qdisc del dev $DUMMY ingress"
        ]
    },
    {
        "id": "eaf8",
        "name": "Delete single ingress matchall filter",
        "category": [
            "filter",
            "matchall"
        ],
	"plugins": {
		"requires": "nsPlugin"
	},
        "setup": [
            "$TC qdisc add dev $DUMMY ingress",
            "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv6 matchall classid 1:2 action pass"
        ],
        "cmdUnderTest": "$TC filter del dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv6 matchall",
        "expExitCode": "0",
        "verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv6 matchall",
        "matchPattern": "^filter protocol ipv6 pref 1 matchall.*handle 0x1.*flowid 1:2.*gact action pass.*ref 1 bind 1",
        "matchCount": "0",
        "teardown": [
            "$TC qdisc del dev $DUMMY ingress"
        ]
    },
    {
        "id": "76ad",
        "name": "Delete all ingress matchall filters",
        "category": [
            "filter",
            "matchall"
        ],
	"plugins": {
		"requires": "nsPlugin"
	},
        "setup": [
            "$TC qdisc add dev $DUMMY ingress",
            "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol all matchall classid 1:2 action pass",
            "$TC filter add dev $DUMMY parent ffff: handle 0x2 prio 2 protocol all matchall classid 1:3 action pass",
            "$TC filter add dev $DUMMY parent ffff: handle 0x3 prio 3 protocol all matchall classid 1:4 action pass",
            "$TC filter add dev $DUMMY parent ffff: handle 0x4 prio 4 protocol all matchall classid 1:5 action pass"
        ],
        "cmdUnderTest": "$TC filter del dev $DUMMY parent ffff:",
        "expExitCode": "0",
        "verifyCmd": "$TC filter show dev $DUMMY parent ffff:",
        "matchPattern": "^filter protocol all pref.*matchall.*handle.*flowid.*gact action pass",
        "matchCount": "0",
        "teardown": [
            "$TC qdisc del dev $DUMMY ingress"
        ]
    },
    {
        "id": "1eb9",
        "name": "Delete single ingress matchall filter out of multiple",
        "category": [
            "filter",
            "matchall"
        ],
	"plugins": {
		"requires": "nsPlugin"
	},
        "setup": [
            "$TC qdisc add dev $DUMMY ingress",
            "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol all matchall classid 1:2 action pass",
            "$TC filter add dev $DUMMY parent ffff: handle 0x2 prio 2 protocol all matchall classid 1:3 action pass",
            "$TC filter add dev $DUMMY parent ffff: handle 0x3 prio 3 protocol all matchall classid 1:4 action pass",
            "$TC filter add dev $DUMMY parent ffff: handle 0x4 prio 4 protocol all matchall classid 1:5 action pass"
        ],
        "cmdUnderTest": "$TC filter del dev $DUMMY parent ffff: protocol all handle 0x2 prio 2 matchall",
        "expExitCode": "0",
        "verifyCmd": "$TC filter show dev $DUMMY parent ffff:",
        "matchPattern": "^filter protocol all pref 2 matchall.*handle 0x2 flowid 1:2.*gact action pass",
        "matchCount": "0",
        "teardown": [
            "$TC qdisc del dev $DUMMY ingress"
        ]
    },
    {
        "id": "6d63",
        "name": "Delete ingress matchall filter by chain ID",
        "category": [
            "filter",
            "matchall"
        ],
	"plugins": {
		"requires": "nsPlugin"
	},
        "setup": [
            "$TC qdisc add dev $DUMMY ingress",
            "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol all chain 1 matchall classid 1:1 action pass",
            "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv4 chain 2 matchall classid 1:3 action continue"
        ],
        "cmdUnderTest": "$TC filter del dev $DUMMY parent ffff: chain 2",
        "expExitCode": "0",
        "verifyCmd": "$TC filter show dev $DUMMY parent ffff:",
        "matchPattern": "^filter protocol all pref 1 matchall chain 1 handle 0x1 flowid 1:1.*gact action pass",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DUMMY ingress"
        ]
    },
    {
        "id": "3329",
        "name": "Validate flags of the matchall filter with skip_sw and police action with skip_hw",
        "category": [
            "filter",
            "matchall"
        ],
	"plugins": {
		"requires": "nsPlugin"
	},
        "setup": [
            "$TC qdisc add dev $DUMMY ingress",
            "$TC actions flush action police",
            "$TC actions add action police rate 1mbit burst 100k index 199 skip_hw"
        ],
        "cmdUnderTest": "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv4 matchall skip_sw action police index 199",
        "expExitCode": "2",
        "verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 1 prio 1 protocol ipv4 matchall",
        "matchPattern": "^filter parent ffff: protocol ip pref 1 matchall.*handle 0x1.*",
        "matchCount": "0",
        "teardown": [
            "$TC qdisc del dev $DUMMY ingress",
            "$TC actions del action police index 199"
        ]
    },
    {
        "id": "0eeb",
        "name": "Validate flags of the matchall filter with skip_hw and police action",
        "category": [
            "filter",
            "matchall"
        ],
	"plugins": {
		"requires": "nsPlugin"
	},
        "setup": [
            "$TC qdisc add dev $DUMMY ingress",
            "$TC actions flush action police",
            "$TC actions add action police rate 1mbit burst 100k index 199"
        ],
        "cmdUnderTest": "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv4 matchall skip_hw action police index 199",
        "expExitCode": "2",
        "verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 1 prio 1 protocol ipv4 matchall",
        "matchPattern": "^filter parent ffff: protocol ip pref 1 matchall.*handle 0x1.*",
        "matchCount": "0",
        "teardown": [
            "$TC qdisc del dev $DUMMY ingress",
            "$TC actions del action police index 199"
        ]
    },
    {
        "id": "eee4",
        "name": "Validate flags of the matchall filter with skip_sw and police action",
        "category": [
            "filter",
            "matchall"
        ],
	"plugins": {
		"requires": "nsPlugin"
	},
        "setup": [
            "$TC qdisc add dev $DUMMY ingress",
            "$TC actions flush action police",
            "$TC actions add action police rate 1mbit burst 100k index 199"
        ],
        "cmdUnderTest": "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv4 matchall skip_sw action police index 199",
        "expExitCode": "2",
        "verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 1 prio 1 protocol ipv4 matchall",
        "matchPattern": "^filter parent ffff: protocol ip pref 1 matchall.*handle 0x1.*",
        "matchCount": "0",
        "teardown": [
            "$TC qdisc del dev $DUMMY ingress",
            "$TC actions del action police index 199"
        ]
    },
    {
        "id": "2638",
        "name": "Add matchall and try to get it",
        "category": [
            "filter",
            "matchall"
        ],
        "plugins": {
                "requires": "nsPlugin"
        },
        "setup": [
            "$TC qdisc add dev $DEV1 clsact",
            "$TC filter add dev $DEV1 protocol all pref 1 ingress handle 0x1234 matchall action ok"
        ],
        "cmdUnderTest": "$TC filter get dev $DEV1 protocol all pref 1 ingress handle 0x1234 matchall",
        "expExitCode": "0",
        "verifyCmd": "$TC filter show dev $DEV1 ingress",
        "matchPattern": "filter protocol all pref 1 matchall chain 0 handle 0x1234",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DEV1 clsact"
        ]
    }
]