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