1*93f3f2eaSZhengchao Shao[
2*93f3f2eaSZhengchao Shao    {
3*93f3f2eaSZhengchao Shao        "id": "23c3",
4*93f3f2eaSZhengchao Shao        "name": "Add cBPF filter with valid bytecode",
5*93f3f2eaSZhengchao Shao        "category": [
6*93f3f2eaSZhengchao Shao            "filter",
7*93f3f2eaSZhengchao Shao            "bpf-filter"
8*93f3f2eaSZhengchao Shao        ],
9*93f3f2eaSZhengchao Shao        "plugins": {
10*93f3f2eaSZhengchao Shao            "requires": "nsPlugin"
11*93f3f2eaSZhengchao Shao        },
12*93f3f2eaSZhengchao Shao        "setup": [
13*93f3f2eaSZhengchao Shao            "$TC qdisc add dev $DEV1 ingress"
14*93f3f2eaSZhengchao Shao        ],
15*93f3f2eaSZhengchao Shao        "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0'",
16*93f3f2eaSZhengchao Shao        "expExitCode": "0",
17*93f3f2eaSZhengchao Shao        "verifyCmd": "$TC filter get dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf",
18*93f3f2eaSZhengchao Shao        "matchPattern": "filter parent ffff: protocol ip pref 100 bpf chain [0-9]+ handle 0x1.*bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0'",
19*93f3f2eaSZhengchao Shao        "matchCount": "1",
20*93f3f2eaSZhengchao Shao        "teardown": [
21*93f3f2eaSZhengchao Shao            "$TC qdisc del dev $DEV1 ingress"
22*93f3f2eaSZhengchao Shao        ]
23*93f3f2eaSZhengchao Shao    },
24*93f3f2eaSZhengchao Shao    {
25*93f3f2eaSZhengchao Shao        "id": "1563",
26*93f3f2eaSZhengchao Shao        "name": "Add cBPF filter with invalid bytecode",
27*93f3f2eaSZhengchao Shao        "category": [
28*93f3f2eaSZhengchao Shao            "filter",
29*93f3f2eaSZhengchao Shao            "bpf-filter"
30*93f3f2eaSZhengchao Shao        ],
31*93f3f2eaSZhengchao Shao        "plugins": {
32*93f3f2eaSZhengchao Shao            "requires": "nsPlugin"
33*93f3f2eaSZhengchao Shao        },
34*93f3f2eaSZhengchao Shao        "setup": [
35*93f3f2eaSZhengchao Shao            "$TC qdisc add dev $DEV1 ingress"
36*93f3f2eaSZhengchao Shao        ],
37*93f3f2eaSZhengchao Shao        "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf bytecode '4,40 0 0 12,31 0 1 2048,6 0 0 262144,6 0 0 0'",
38*93f3f2eaSZhengchao Shao        "expExitCode": "2",
39*93f3f2eaSZhengchao Shao        "verifyCmd": "$TC filter get dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf",
40*93f3f2eaSZhengchao Shao        "matchPattern": "filter parent ffff: protocol ip pref 100 bpf chain [0-9]+ handle 0x1.*bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0'",
41*93f3f2eaSZhengchao Shao        "matchCount": "0",
42*93f3f2eaSZhengchao Shao        "teardown": [
43*93f3f2eaSZhengchao Shao            "$TC qdisc del dev $DEV1 ingress"
44*93f3f2eaSZhengchao Shao        ]
45*93f3f2eaSZhengchao Shao    },
46*93f3f2eaSZhengchao Shao    {
47*93f3f2eaSZhengchao Shao        "id": "2334",
48*93f3f2eaSZhengchao Shao        "name": "Add eBPF filter with valid object-file",
49*93f3f2eaSZhengchao Shao        "category": [
50*93f3f2eaSZhengchao Shao            "filter",
51*93f3f2eaSZhengchao Shao            "bpf-filter"
52*93f3f2eaSZhengchao Shao        ],
53*93f3f2eaSZhengchao Shao        "plugins": {
54*93f3f2eaSZhengchao Shao            "requires": "buildebpfPlugin"
55*93f3f2eaSZhengchao Shao        },
56*93f3f2eaSZhengchao Shao        "setup": [
57*93f3f2eaSZhengchao Shao            "$TC qdisc add dev $DEV1 ingress"
58*93f3f2eaSZhengchao Shao        ],
59*93f3f2eaSZhengchao Shao        "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf object-file $EBPFDIR/action.o section action-ok",
60*93f3f2eaSZhengchao Shao        "expExitCode": "0",
61*93f3f2eaSZhengchao Shao        "verifyCmd": "$TC filter get dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf",
62*93f3f2eaSZhengchao Shao        "matchPattern": "filter parent ffff: protocol ip pref 100 bpf chain [0-9]+ handle 0x1 action.o:\\[action-ok\\].*tag [0-9a-f]{16}( jited)?",
63*93f3f2eaSZhengchao Shao        "matchCount": "1",
64*93f3f2eaSZhengchao Shao        "teardown": [
65*93f3f2eaSZhengchao Shao            "$TC qdisc del dev $DEV1 ingress"
66*93f3f2eaSZhengchao Shao        ]
67*93f3f2eaSZhengchao Shao    },
68*93f3f2eaSZhengchao Shao    {
69*93f3f2eaSZhengchao Shao        "id": "2373",
70*93f3f2eaSZhengchao Shao        "name": "Add eBPF filter with invalid object-file",
71*93f3f2eaSZhengchao Shao        "category": [
72*93f3f2eaSZhengchao Shao            "filter",
73*93f3f2eaSZhengchao Shao            "bpf-filter"
74*93f3f2eaSZhengchao Shao        ],
75*93f3f2eaSZhengchao Shao        "plugins": {
76*93f3f2eaSZhengchao Shao            "requires": "buildebpfPlugin"
77*93f3f2eaSZhengchao Shao        },
78*93f3f2eaSZhengchao Shao        "setup": [
79*93f3f2eaSZhengchao Shao            "$TC qdisc add dev $DEV1 ingress"
80*93f3f2eaSZhengchao Shao        ],
81*93f3f2eaSZhengchao Shao        "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf object-file $EBPFDIR/action.o section action-ko",
82*93f3f2eaSZhengchao Shao        "expExitCode": "1",
83*93f3f2eaSZhengchao Shao        "verifyCmd": "$TC filter get dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf",
84*93f3f2eaSZhengchao Shao        "matchPattern": "filter parent ffff: protocol ip pref 100 bpf chain [0-9]+ handle 0x1 action.o:\\[action-ko\\].*tag [0-9a-f]{16}( jited)?",
85*93f3f2eaSZhengchao Shao        "matchCount": "0",
86*93f3f2eaSZhengchao Shao        "teardown": [
87*93f3f2eaSZhengchao Shao            "$TC qdisc del dev $DEV1 ingress"
88*93f3f2eaSZhengchao Shao        ]
89*93f3f2eaSZhengchao Shao    },
90*93f3f2eaSZhengchao Shao    {
91*93f3f2eaSZhengchao Shao        "id": "4423",
92*93f3f2eaSZhengchao Shao        "name": "Replace cBPF bytecode",
93*93f3f2eaSZhengchao Shao        "category": [
94*93f3f2eaSZhengchao Shao            "filter",
95*93f3f2eaSZhengchao Shao            "bpf-filter"
96*93f3f2eaSZhengchao Shao        ],
97*93f3f2eaSZhengchao Shao        "plugins": {
98*93f3f2eaSZhengchao Shao            "requires": "nsPlugin"
99*93f3f2eaSZhengchao Shao        },
100*93f3f2eaSZhengchao Shao        "setup": [
101*93f3f2eaSZhengchao Shao            "$TC qdisc add dev $DEV1 ingress",
102*93f3f2eaSZhengchao Shao            [
103*93f3f2eaSZhengchao Shao                "$TC filter add dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0'",
104*93f3f2eaSZhengchao Shao                0,
105*93f3f2eaSZhengchao Shao                1,
106*93f3f2eaSZhengchao Shao                255
107*93f3f2eaSZhengchao Shao            ]
108*93f3f2eaSZhengchao Shao        ],
109*93f3f2eaSZhengchao Shao        "cmdUnderTest": "$TC filter replace dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0'",
110*93f3f2eaSZhengchao Shao        "expExitCode": "0",
111*93f3f2eaSZhengchao Shao        "verifyCmd": "$TC filter get dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf",
112*93f3f2eaSZhengchao Shao        "matchPattern": "filter parent ffff: protocol ip pref 100 bpf chain [0-9]+ handle 0x1.*bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0'",
113*93f3f2eaSZhengchao Shao        "matchCount": "1",
114*93f3f2eaSZhengchao Shao        "teardown": [
115*93f3f2eaSZhengchao Shao            "$TC qdisc del dev $DEV1 ingress"
116*93f3f2eaSZhengchao Shao        ]
117*93f3f2eaSZhengchao Shao    },
118*93f3f2eaSZhengchao Shao    {
119*93f3f2eaSZhengchao Shao        "id": "5122",
120*93f3f2eaSZhengchao Shao        "name": "Delete cBPF filter",
121*93f3f2eaSZhengchao Shao        "category": [
122*93f3f2eaSZhengchao Shao            "filter",
123*93f3f2eaSZhengchao Shao            "bpf-filter"
124*93f3f2eaSZhengchao Shao        ],
125*93f3f2eaSZhengchao Shao        "plugins": {
126*93f3f2eaSZhengchao Shao            "requires": "nsPlugin"
127*93f3f2eaSZhengchao Shao        },
128*93f3f2eaSZhengchao Shao        "setup": [
129*93f3f2eaSZhengchao Shao            "$TC qdisc add dev $DEV1 ingress",
130*93f3f2eaSZhengchao Shao            [
131*93f3f2eaSZhengchao Shao                "$TC filter add dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0'",
132*93f3f2eaSZhengchao Shao                0,
133*93f3f2eaSZhengchao Shao                1,
134*93f3f2eaSZhengchao Shao                255
135*93f3f2eaSZhengchao Shao            ]
136*93f3f2eaSZhengchao Shao        ],
137*93f3f2eaSZhengchao Shao        "cmdUnderTest": "$TC filter del dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf",
138*93f3f2eaSZhengchao Shao        "expExitCode": "0",
139*93f3f2eaSZhengchao Shao        "verifyCmd": "$TC filter get dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf",
140*93f3f2eaSZhengchao Shao        "matchPattern": "filter parent ffff: protocol ip pref 100 bpf chain [0-9]+ handle 0x1.*bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0'",
141*93f3f2eaSZhengchao Shao        "matchCount": "0",
142*93f3f2eaSZhengchao Shao        "teardown": [
143*93f3f2eaSZhengchao Shao            "$TC qdisc del dev $DEV1 ingress"
144*93f3f2eaSZhengchao Shao        ]
145*93f3f2eaSZhengchao Shao    },
146*93f3f2eaSZhengchao Shao    {
147*93f3f2eaSZhengchao Shao        "id": "e0a9",
148*93f3f2eaSZhengchao Shao        "name": "List cBPF filters",
149*93f3f2eaSZhengchao Shao        "category": [
150*93f3f2eaSZhengchao Shao            "filter",
151*93f3f2eaSZhengchao Shao            "bpf-filter"
152*93f3f2eaSZhengchao Shao        ],
153*93f3f2eaSZhengchao Shao        "plugins": {
154*93f3f2eaSZhengchao Shao            "requires": "nsPlugin"
155*93f3f2eaSZhengchao Shao        },
156*93f3f2eaSZhengchao Shao        "setup": [
157*93f3f2eaSZhengchao Shao            "$TC qdisc add dev $DEV1 ingress",
158*93f3f2eaSZhengchao Shao            "$TC filter add dev $DEV1 parent ffff: handle 1 protocol ip prio 100 bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0'",
159*93f3f2eaSZhengchao Shao            "$TC filter add dev $DEV1 parent ffff: handle 2 protocol ip prio 100 bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0'",
160*93f3f2eaSZhengchao Shao            "$TC filter add dev $DEV1 parent ffff: handle 100 protocol ip prio 100 bpf bytecode '4,40 0 0 12,21 0 1 33024,6 0 0 262144,6 0 0 0'"
161*93f3f2eaSZhengchao Shao        ],
162*93f3f2eaSZhengchao Shao        "cmdUnderTest": "$TC filter show dev $DEV1 parent ffff:",
163*93f3f2eaSZhengchao Shao        "expExitCode": "0",
164*93f3f2eaSZhengchao Shao        "verifyCmd": "$TC filter show dev $DEV1 parent ffff:",
165*93f3f2eaSZhengchao Shao        "matchPattern": "filter protocol ip pref 100 bpf chain [0-9]+ handle",
166*93f3f2eaSZhengchao Shao        "matchCount": "3",
167*93f3f2eaSZhengchao Shao        "teardown": [
168*93f3f2eaSZhengchao Shao            "$TC qdisc del dev $DEV1 ingress"
169*93f3f2eaSZhengchao Shao        ]
170*93f3f2eaSZhengchao Shao    }
171*93f3f2eaSZhengchao Shao]
172