xref: /linux/tools/testing/selftests/tc-testing/tc-tests/actions/ct.json (revision 0ea5c948cb64bab5bc7a5516774eb8536f05aa0d)
1[
2    {
3        "id": "696a",
4        "name": "Add simple ct action",
5        "category": [
6            "actions",
7            "ct"
8        ],
9        "plugins": {
10           "requires": "nsPlugin"
11        },
12        "setup": [
13            [
14                "$TC actions flush action ct",
15                0,
16                1,
17                255
18            ]
19        ],
20        "cmdUnderTest": "$TC actions add action ct index 42",
21        "expExitCode": "0",
22        "verifyCmd": "$TC actions list action ct",
23        "matchPattern": "action order [0-9]*: ct zone 0 pipe.*index 42 ref",
24        "matchCount": "1",
25        "teardown": [
26            "$TC actions flush action ct"
27        ]
28    },
29    {
30        "id": "e38c",
31        "name": "Add simple ct action with cookie",
32        "category": [
33            "actions",
34            "ct"
35        ],
36        "plugins": {
37           "requires": "nsPlugin"
38        },
39        "setup": [
40            [
41                "$TC actions flush action ct",
42                0,
43                1,
44                255
45            ]
46        ],
47        "cmdUnderTest": "$TC actions add action ct index 42 cookie deadbeef",
48        "expExitCode": "0",
49        "verifyCmd": "$TC actions list action ct",
50        "matchPattern": "action order [0-9]*: ct zone 0 pipe.*index 42 ref.*cookie deadbeef",
51        "matchCount": "1",
52        "teardown": [
53            "$TC actions flush action ct"
54        ]
55    },
56    {
57        "id": "9f20",
58        "name": "Add ct clear action",
59        "category": [
60            "actions",
61            "ct"
62        ],
63        "plugins": {
64           "requires": "nsPlugin"
65        },
66        "setup": [
67            [
68                "$TC actions flush action ct",
69                0,
70                1,
71                255
72            ]
73        ],
74        "cmdUnderTest": "$TC actions add action ct clear index 42",
75        "expExitCode": "0",
76        "verifyCmd": "$TC actions list action ct",
77        "matchPattern": "action order [0-9]*: ct clear pipe.*index 42 ref",
78        "matchCount": "1",
79        "teardown": [
80            "$TC actions flush action ct"
81        ]
82    },
83    {
84        "id": "0bc1",
85        "name": "Add ct clear action with cookie of max length",
86        "category": [
87            "actions",
88            "ct"
89        ],
90        "plugins": {
91           "requires": "nsPlugin"
92        },
93        "setup": [
94            [
95                "$TC actions flush action ct",
96                0,
97                1,
98                255
99            ]
100        ],
101        "cmdUnderTest": "$TC actions add action ct clear index 42 cookie aa11bb22cc33dd44ee55ff66aa11b1b2",
102        "expExitCode": "0",
103        "verifyCmd": "$TC actions list action ct",
104        "matchPattern": "action order [0-9]*: ct clear pipe.*index 42 ref.*cookie aa11bb22cc33dd44ee55ff66aa11b1b2",
105        "matchCount": "1",
106        "teardown": [
107            "$TC actions flush action ct"
108        ]
109    },
110    {
111        "id": "5bea",
112        "name": "Try ct with zone",
113        "category": [
114            "actions",
115            "ct"
116        ],
117        "plugins": {
118           "requires": "nsPlugin"
119        },
120        "setup": [
121            [
122                "$TC actions flush action ct",
123                0,
124                1,
125                255
126            ]
127        ],
128        "cmdUnderTest": "$TC actions add action ct zone 404 index 42",
129        "expExitCode": "0",
130        "verifyCmd": "$TC actions list action ct",
131        "matchPattern": "action order [0-9]*: ct zone 404 pipe.*index 42 ref",
132        "matchCount": "1",
133        "teardown": [
134            "$TC actions flush action ct"
135        ]
136    },
137    {
138        "id": "d5d6",
139        "name": "Try ct with zone, commit",
140        "category": [
141            "actions",
142            "ct"
143        ],
144        "plugins": {
145           "requires": "nsPlugin"
146        },
147        "setup": [
148            [
149                "$TC actions flush action ct",
150                0,
151                1,
152                255
153            ]
154        ],
155        "cmdUnderTest": "$TC actions add action ct zone 404 commit index 42",
156        "expExitCode": "0",
157        "verifyCmd": "$TC actions list action ct",
158        "matchPattern": "action order [0-9]*: ct commit zone 404 pipe.*index 42 ref",
159        "matchCount": "1",
160        "teardown": [
161            "$TC actions flush action ct"
162        ]
163    },
164    {
165        "id": "029f",
166        "name": "Try ct with zone, commit, mark",
167        "category": [
168            "actions",
169            "ct"
170        ],
171        "plugins": {
172           "requires": "nsPlugin"
173        },
174        "setup": [
175            [
176                "$TC actions flush action ct",
177                0,
178                1,
179                255
180            ]
181        ],
182        "cmdUnderTest": "$TC actions add action ct zone 404 commit mark 0x42 index 42",
183        "expExitCode": "0",
184        "verifyCmd": "$TC actions list action ct",
185        "matchPattern": "action order [0-9]*: ct commit mark 66 zone 404 pipe.*index 42 ref",
186        "matchCount": "1",
187        "teardown": [
188            "$TC actions flush action ct"
189        ]
190    },
191    {
192        "id": "a58d",
193        "name": "Try ct with zone, commit, mark, nat",
194        "category": [
195            "actions",
196            "ct"
197        ],
198        "plugins": {
199           "requires": "nsPlugin"
200        },
201        "setup": [
202            [
203                "$TC actions flush action ct",
204                0,
205                1,
206                255
207            ]
208        ],
209        "cmdUnderTest": "$TC actions add action ct zone 404 commit mark 0x42 nat src addr 5.5.5.7 index 42",
210        "expExitCode": "0",
211        "verifyCmd": "$TC actions list action ct",
212        "matchPattern": "action order [0-9]*: ct commit mark 66 zone 404 nat src addr 5.5.5.7 pipe.*index 42 ref",
213        "matchCount": "1",
214        "teardown": [
215            "$TC actions flush action ct"
216        ]
217    },
218    {
219        "id": "901b",
220        "name": "Try ct with full nat ipv4 range syntax",
221        "category": [
222            "actions",
223            "ct"
224        ],
225        "plugins": {
226           "requires": "nsPlugin"
227        },
228        "setup": [
229            [
230                "$TC actions flush action ct",
231                0,
232                1,
233                255
234            ]
235        ],
236        "cmdUnderTest": "$TC actions add action ct commit nat src addr 5.5.5.7-5.5.6.0 port 1000-2000 index 44",
237        "expExitCode": "0",
238        "verifyCmd": "$TC actions list action ct",
239        "matchPattern": "action order [0-9]*: ct commit zone 0 nat src addr 5.5.5.7-5.5.6.0 port 1000-2000 pipe.*index 44 ref",
240        "matchCount": "1",
241        "teardown": [
242            "$TC actions flush action ct"
243        ]
244    },
245    {
246        "id": "072b",
247        "name": "Try ct with full nat ipv6 syntax",
248        "category": [
249            "actions",
250            "ct"
251        ],
252        "plugins": {
253           "requires": "nsPlugin"
254        },
255        "setup": [
256            [
257                "$TC actions flush action ct",
258                0,
259                1,
260                255
261            ]
262        ],
263        "cmdUnderTest": "$TC actions add action ct commit nat src addr 2001::1 port 1000-2000 index 44",
264        "expExitCode": "0",
265        "verifyCmd": "$TC actions list action ct",
266        "matchPattern": "action order [0-9]*: ct commit zone 0 nat src addr 2001::1 port 1000-2000 pipe.*index 44 ref",
267        "matchCount": "1",
268        "teardown": [
269            "$TC actions flush action ct"
270        ]
271    },
272    {
273        "id": "3420",
274        "name": "Try ct with full nat ipv6 range syntax",
275        "category": [
276            "actions",
277            "ct"
278        ],
279        "plugins": {
280           "requires": "nsPlugin"
281        },
282        "setup": [
283            [
284                "$TC actions flush action ct",
285                0,
286                1,
287                255
288            ]
289        ],
290        "cmdUnderTest": "$TC actions add action ct commit nat src addr 2001::1-2001::10 port 1000-2000 index 44",
291        "expExitCode": "0",
292        "verifyCmd": "$TC actions list action ct",
293        "matchPattern": "action order [0-9]*: ct commit zone 0 nat src addr 2001::1-2001::10 port 1000-2000 pipe.*index 44 ref",
294        "matchCount": "1",
295        "teardown": [
296            "$TC actions flush action ct"
297        ]
298    },
299    {
300        "id": "4470",
301        "name": "Try ct with full nat ipv6 range syntax + force",
302        "category": [
303            "actions",
304            "ct"
305        ],
306        "plugins": {
307           "requires": "nsPlugin"
308        },
309        "setup": [
310            [
311                "$TC actions flush action ct",
312                0,
313                1,
314                255
315            ]
316        ],
317        "cmdUnderTest": "$TC actions add action ct commit force nat src addr 2001::1-2001::10 port 1000-2000 index 44",
318        "expExitCode": "0",
319        "verifyCmd": "$TC actions list action ct",
320        "matchPattern": "action order [0-9]*: ct commit force zone 0 nat src addr 2001::1-2001::10 port 1000-2000 pipe.*index 44 ref",
321        "matchCount": "1",
322        "teardown": [
323            "$TC actions flush action ct"
324        ]
325    },
326    {
327        "id": "5d88",
328        "name": "Try ct with label",
329        "category": [
330            "actions",
331            "ct"
332        ],
333        "plugins": {
334           "requires": "nsPlugin"
335        },
336        "setup": [
337            [
338                "$TC actions flush action ct",
339                0,
340                1,
341                255
342            ]
343        ],
344        "cmdUnderTest": "$TC actions add action ct label 123123 index 44",
345        "expExitCode": "0",
346        "verifyCmd": "$TC actions list action ct",
347        "matchPattern": "action order [0-9]*: ct zone 0 label 12312300000000000000000000000000 pipe.*index 44 ref",
348        "matchCount": "1",
349        "teardown": [
350            "$TC actions flush action ct"
351        ]
352    },
353    {
354        "id": "04d4",
355        "name": "Try ct with label with mask",
356        "category": [
357            "actions",
358            "ct"
359        ],
360        "plugins": {
361           "requires": "nsPlugin"
362        },
363        "setup": [
364            [
365                "$TC actions flush action ct",
366                0,
367                1,
368                255
369            ]
370        ],
371        "cmdUnderTest": "$TC actions add action ct label 12312300000000000000000000000001/ffffffff000000000000000000000001 index 44",
372        "expExitCode": "0",
373        "verifyCmd": "$TC actions list action ct",
374        "matchPattern": "action order [0-9]*: ct zone 0 label 12312300000000000000000000000001/ffffffff000000000000000000000001 pipe.*index 44 ref",
375        "matchCount": "1",
376        "teardown": [
377            "$TC actions flush action ct"
378        ]
379    },
380    {
381        "id": "9751",
382        "name": "Try ct with mark + mask",
383        "category": [
384            "actions",
385            "ct"
386        ],
387        "plugins": {
388           "requires": "nsPlugin"
389        },
390        "setup": [
391            [
392                "$TC actions flush action ct",
393                0,
394                1,
395                255
396            ]
397        ],
398        "cmdUnderTest": "$TC actions add action ct mark 0x42/0xf0 index 42",
399        "expExitCode": "0",
400        "verifyCmd": "$TC actions list action ct",
401        "matchPattern": "action order [0-9]*: ct mark 66/0xf0 zone 0 pipe.*index 42 ref",
402        "matchCount": "1",
403        "teardown": [
404            "$TC actions flush action ct"
405        ]
406    },
407    {
408        "id": "2faa",
409        "name": "Try ct with mark + mask and cookie",
410        "category": [
411            "actions",
412            "ct"
413        ],
414        "plugins": {
415           "requires": "nsPlugin"
416        },
417        "setup": [
418            [
419                "$TC actions flush action ct",
420                0,
421                1,
422                255
423            ]
424        ],
425        "cmdUnderTest": "$TC actions add action ct mark 0x42/0xf0 index 42 cookie aa11bb22cc33dd44ee55ff66aa11b1b2",
426        "expExitCode": "0",
427        "verifyCmd": "$TC actions list action ct",
428        "matchPattern": "action order [0-9]*: ct mark 66/0xf0 zone 0 pipe.*index 42 ref.*cookie aa11bb22cc33dd44ee55ff66aa11b1b2",
429        "matchCount": "1",
430        "teardown": [
431            "$TC actions flush action ct"
432        ]
433    },
434    {
435        "id": "3991",
436        "name": "Add simple ct action with no_percpu flag",
437        "category": [
438            "actions",
439            "ct"
440        ],
441        "plugins": {
442           "requires": "nsPlugin"
443        },
444        "setup": [
445            [
446                "$TC actions flush action ct",
447                0,
448                1,
449                255
450            ]
451        ],
452        "cmdUnderTest": "$TC actions add action ct no_percpu",
453        "expExitCode": "0",
454        "verifyCmd": "$TC actions list action ct",
455        "matchPattern": "action order [0-9]*: ct zone 0 pipe.*no_percpu",
456        "matchCount": "1",
457        "teardown": [
458            "$TC actions flush action ct"
459        ]
460    },
461    {
462        "id": "3992",
463        "name": "Add ct action triggering DNAT tuple conflict",
464        "category": [
465            "actions",
466            "ct",
467	    "scapy"
468        ],
469        "plugins": {
470           "requires": "nsPlugin"
471        },
472	"plugins": {
473		"requires": [
474			"nsPlugin",
475			"scapyPlugin"
476		]
477	},
478        "setup": [
479            [
480                "$TC qdisc del dev $DEV1 ingress",
481                0,
482                1,
483		2,
484                255
485            ],
486	    "$TC qdisc add dev $DEV1 ingress"
487        ],
488        "cmdUnderTest": "$TC filter add dev $DEV1 ingress protocol ip prio 1 flower ct_state -trk action ct commit nat dst addr 20.0.0.1 port 10 pipe action drop",
489	"scapy": [
490	    {
491		"iface": "$DEV0",
492		"count": 1,
493		"packet": "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.10')/TCP(sport=5000,dport=10)"
494	    },
495	    {
496		"iface": "$DEV0",
497		"count": 1,
498		"packet": "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.20')/TCP(sport=5000,dport=10)"
499	    }
500	],
501        "expExitCode": "0",
502        "verifyCmd": "cat /proc/net/nf_conntrack",
503        "matchPattern": "dst=10.0.0.20",
504        "matchCount": "1",
505        "teardown": [
506            "$TC qdisc del dev $DEV1 ingress"
507        ]
508    }
509]
510