|
| 1 | +[ |
| 2 | + { |
| 3 | + "id": "d959", |
| 4 | + "name": "Add cBPF action with valid bytecode", |
| 5 | + "category": [ |
| 6 | + "actions", |
| 7 | + "bpf" |
| 8 | + ], |
| 9 | + "setup": [ |
| 10 | + [ |
| 11 | + "$TC action flush action bpf", |
| 12 | + 0, |
| 13 | + 1, |
| 14 | + 255 |
| 15 | + ] |
| 16 | + ], |
| 17 | + "cmdUnderTest": "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' index 100", |
| 18 | + "expExitCode": "0", |
| 19 | + "verifyCmd": "$TC action get action bpf index 100", |
| 20 | + "matchPattern": "action order [0-9]*: bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' default-action pipe.*index 100 ref", |
| 21 | + "matchCount": "1", |
| 22 | + "teardown": [ |
| 23 | + "$TC action flush action bpf" |
| 24 | + ] |
| 25 | + }, |
| 26 | + { |
| 27 | + "id": "f84a", |
| 28 | + "name": "Add cBPF action with invalid bytecode", |
| 29 | + "category": [ |
| 30 | + "actions", |
| 31 | + "bpf" |
| 32 | + ], |
| 33 | + "setup": [ |
| 34 | + [ |
| 35 | + "$TC actions flush action bpf", |
| 36 | + 0, |
| 37 | + 1, |
| 38 | + 255 |
| 39 | + ] |
| 40 | + ], |
| 41 | + "cmdUnderTest": "$TC action add action bpf bytecode '4,40 0 0 12,31 0 1 2048,6 0 0 262144,6 0 0 0' index 100", |
| 42 | + "expExitCode": "255", |
| 43 | + "verifyCmd": "$TC action get action bpf index 100", |
| 44 | + "matchPattern": "action order [0-9]*: bpf bytecode '4,40 0 0 12,31 0 1 2048,6 0 0 262144,6 0 0 0' default-action pipe.*index 100 ref", |
| 45 | + "matchCount": "0", |
| 46 | + "teardown": [ |
| 47 | + "$TC actions flush action bpf" |
| 48 | + ] |
| 49 | + }, |
| 50 | + { |
| 51 | + "id": "e939", |
| 52 | + "name": "Add eBPF action with valid object-file", |
| 53 | + "category": [ |
| 54 | + "actions", |
| 55 | + "bpf" |
| 56 | + ], |
| 57 | + "setup": [ |
| 58 | + "printf '#include <linux/bpf.h>\nchar l[] __attribute__((section(\"license\"),used))=\"GPL\"; __attribute__((section(\"action\"),used)) int m(struct __sk_buff *s) { return 2; }' | clang -O2 -x c -c - -target bpf -o _b.o", |
| 59 | + [ |
| 60 | + "$TC action flush action bpf", |
| 61 | + 0, |
| 62 | + 1, |
| 63 | + 255 |
| 64 | + ] |
| 65 | + ], |
| 66 | + "cmdUnderTest": "$TC action add action bpf object-file _b.o index 667", |
| 67 | + "expExitCode": "0", |
| 68 | + "verifyCmd": "$TC action get action bpf index 667", |
| 69 | + "matchPattern": "action order [0-9]*: bpf _b.o:\\[action\\] id [0-9]* tag 3b185187f1855c4c default-action pipe.*index 667 ref", |
| 70 | + "matchCount": "1", |
| 71 | + "teardown": [ |
| 72 | + "$TC action flush action bpf", |
| 73 | + "rm -f _b.o" |
| 74 | + ] |
| 75 | + }, |
| 76 | + { |
| 77 | + "id": "282d", |
| 78 | + "name": "Add eBPF action with invalid object-file", |
| 79 | + "category": [ |
| 80 | + "actions", |
| 81 | + "bpf" |
| 82 | + ], |
| 83 | + "setup": [ |
| 84 | + "printf '#include <linux/bpf.h>\nchar l[] __attribute__((section(\"license\"),used))=\"GPL\"; __attribute__((section(\"action\"),used)) int m(struct __sk_buff *s) { s->data = 0x0; return 2; }' | clang -O2 -x c -c - -target bpf -o _c.o", |
| 85 | + [ |
| 86 | + "$TC action flush action bpf", |
| 87 | + 0, |
| 88 | + 1, |
| 89 | + 255 |
| 90 | + ] |
| 91 | + ], |
| 92 | + "cmdUnderTest": "$TC action add action bpf object-file _c.o index 667", |
| 93 | + "expExitCode": "255", |
| 94 | + "verifyCmd": "$TC action get action bpf index 667", |
| 95 | + "matchPattern": "action order [0-9]*: bpf _b.o:\\[action\\] id [0-9].*index 667 ref", |
| 96 | + "matchCount": "0", |
| 97 | + "teardown": [ |
| 98 | + "$TC action flush action bpf", |
| 99 | + "rm -f _c.o" |
| 100 | + ] |
| 101 | + }, |
| 102 | + { |
| 103 | + "id": "d819", |
| 104 | + "name": "Replace cBPF bytecode and action control", |
| 105 | + "category": [ |
| 106 | + "actions", |
| 107 | + "bpf" |
| 108 | + ], |
| 109 | + "setup": [ |
| 110 | + [ |
| 111 | + "$TC actions flush action bpf", |
| 112 | + 0, |
| 113 | + 1, |
| 114 | + 255 |
| 115 | + ], |
| 116 | + [ |
| 117 | + "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' index 555", |
| 118 | + 0, |
| 119 | + 1, |
| 120 | + 255 |
| 121 | + ] |
| 122 | + ], |
| 123 | + "cmdUnderTest": "$TC action replace action bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0' drop index 555", |
| 124 | + "expExitCode": "0", |
| 125 | + "verifyCmd": "$TC action get action bpf index 555", |
| 126 | + "matchPattern": "action order [0-9]*: bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0' default-action drop.*index 555 ref", |
| 127 | + "matchCount": "1", |
| 128 | + "teardown": [ |
| 129 | + "$TC action flush action bpf" |
| 130 | + ] |
| 131 | + }, |
| 132 | + { |
| 133 | + "id": "6ae3", |
| 134 | + "name": "Delete cBPF action ", |
| 135 | + "category": [ |
| 136 | + "actions", |
| 137 | + "bpf" |
| 138 | + ], |
| 139 | + "setup": [ |
| 140 | + [ |
| 141 | + "$TC actions flush action bpf", |
| 142 | + 0, |
| 143 | + 1, |
| 144 | + 255 |
| 145 | + ], |
| 146 | + [ |
| 147 | + "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' index 444", |
| 148 | + 0, |
| 149 | + 1, |
| 150 | + 255 |
| 151 | + ] |
| 152 | + ], |
| 153 | + "cmdUnderTest": "$TC action delete action bpf index 444", |
| 154 | + "expExitCode": "0", |
| 155 | + "verifyCmd": "$TC action get action bpf index 444", |
| 156 | + "matchPattern": "action order [0-9]*: bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' default-action pipe.*index 444 ref", |
| 157 | + "matchCount": "0", |
| 158 | + "teardown": [ |
| 159 | + "$TC action flush action bpf" |
| 160 | + ] |
| 161 | + }, |
| 162 | + { |
| 163 | + "id": "3e0d", |
| 164 | + "name": "List cBPF actions", |
| 165 | + "category": [ |
| 166 | + "actions", |
| 167 | + "bpf" |
| 168 | + ], |
| 169 | + "setup": [ |
| 170 | + [ |
| 171 | + "$TC action flush action bpf", |
| 172 | + 0, |
| 173 | + 1, |
| 174 | + 255 |
| 175 | + ], |
| 176 | + "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' ok index 101", |
| 177 | + "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0' drop index 102", |
| 178 | + "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 33024,6 0 0 262144,6 0 0 0' continue index 103" |
| 179 | + ], |
| 180 | + "cmdUnderTest": "$TC action list action bpf", |
| 181 | + "expExitCode": "0", |
| 182 | + "verifyCmd": "$TC action list action bpf", |
| 183 | + "matchPattern": "action order [0-9]*: bpf bytecode", |
| 184 | + "matchCount": "3", |
| 185 | + "teardown": [ |
| 186 | + "$TC actions flush action bpf" |
| 187 | + ] |
| 188 | + }, |
| 189 | + { |
| 190 | + "id": "55ce", |
| 191 | + "name": "Flush BPF actions", |
| 192 | + "category": [ |
| 193 | + "actions", |
| 194 | + "bpf" |
| 195 | + ], |
| 196 | + "setup": [ |
| 197 | + [ |
| 198 | + "$TC actions flush action bpf", |
| 199 | + 0, |
| 200 | + 1, |
| 201 | + 255 |
| 202 | + ], |
| 203 | + "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' ok index 101", |
| 204 | + "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0' drop index 102", |
| 205 | + "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 33024,6 0 0 262144,6 0 0 0' continue index 103" |
| 206 | + ], |
| 207 | + "cmdUnderTest": "$TC action flush action bpf", |
| 208 | + "expExitCode": "0", |
| 209 | + "verifyCmd": "$TC action list action bpf", |
| 210 | + "matchPattern": "action order [0-9]*: bpf bytecode", |
| 211 | + "matchCount": "0", |
| 212 | + "teardown": [ |
| 213 | + "$TC actions flush action bpf" |
| 214 | + ] |
| 215 | + }, |
| 216 | + { |
| 217 | + "id": "ccc3", |
| 218 | + "name": "Add cBPF action with duplicate index", |
| 219 | + "category": [ |
| 220 | + "actions", |
| 221 | + "bpf" |
| 222 | + ], |
| 223 | + "setup": [ |
| 224 | + [ |
| 225 | + "$TC actions flush action bpf", |
| 226 | + 0, |
| 227 | + 1, |
| 228 | + 255 |
| 229 | + ], |
| 230 | + "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' index 4294967295" |
| 231 | + ], |
| 232 | + "cmdUnderTest": "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0' index 4294967295", |
| 233 | + "expExitCode": "255", |
| 234 | + "verifyCmd": "$TC action get action bpf index 4294967295", |
| 235 | + "matchPattern": "action order [0-9]*: bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' default-action pipe.*index 4294967295", |
| 236 | + "matchCount": "1", |
| 237 | + "teardown": [ |
| 238 | + "$TC action flush action bpf" |
| 239 | + ] |
| 240 | + }, |
| 241 | + { |
| 242 | + "id": "89c7", |
| 243 | + "name": "Add cBPF action with invalid index", |
| 244 | + "category": [ |
| 245 | + "actions", |
| 246 | + "bpf" |
| 247 | + ], |
| 248 | + "setup": [ |
| 249 | + [ |
| 250 | + "$TC actions flush action bpf", |
| 251 | + 0, |
| 252 | + 1, |
| 253 | + 255 |
| 254 | + ] |
| 255 | + ], |
| 256 | + "cmdUnderTest": "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0' index 4294967296 cookie 12345", |
| 257 | + "expExitCode": "255", |
| 258 | + "verifyCmd": "$TC action ls action bpf", |
| 259 | + "matchPattern": "action order [0-9]*: bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' default-action pipe.*cookie 12345", |
| 260 | + "matchCount": "0", |
| 261 | + "teardown": [ |
| 262 | + "$TC action flush action bpf" |
| 263 | + ] |
| 264 | + }, |
| 265 | + { |
| 266 | + "id": "7ab9", |
| 267 | + "name": "Add cBPF action with cookie", |
| 268 | + "category": [ |
| 269 | + "actions", |
| 270 | + "bpf" |
| 271 | + ], |
| 272 | + "setup": [ |
| 273 | + [ |
| 274 | + "$TC actions flush action bpf", |
| 275 | + 0, |
| 276 | + 1, |
| 277 | + 255 |
| 278 | + ] |
| 279 | + ], |
| 280 | + "cmdUnderTest": "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0' cookie d0d0d0d0d0d0d0d0", |
| 281 | + "expExitCode": "0", |
| 282 | + "verifyCmd": "$TC action list action bpf", |
| 283 | + "matchPattern": "action order [0-9]*: bpf.*cookie d0d0d0d0d0d0d0", |
| 284 | + "matchCount": "1", |
| 285 | + "teardown": [ |
| 286 | + "$TC action flush action bpf" |
| 287 | + ] |
| 288 | + } |
| 289 | +] |
0 commit comments