1 | // SPDX-License-Identifier: GPL-2.0 |
---|---|
2 | |
3 | #include <linux/bpf.h> |
4 | #include <bpf/bpf_helpers.h> |
5 | |
6 | #include "bpf_compiler.h" |
7 | |
8 | char _license[] SEC("license") = "GPL"; |
9 | |
10 | SEC("tc") |
11 | int process(struct __sk_buff *skb) |
12 | { |
13 | __pragma_loop_unroll_full |
14 | for (int i = 0; i < 5; i++) { |
15 | if (skb->cb[i] != i + 1) |
16 | return 1; |
17 | skb->cb[i]++; |
18 | } |
19 | skb->priority++; |
20 | skb->tstamp++; |
21 | skb->mark++; |
22 | |
23 | if (skb->wire_len != 100) |
24 | return 1; |
25 | if (skb->gso_segs != 8) |
26 | return 1; |
27 | if (skb->gso_size != 10) |
28 | return 1; |
29 | if (skb->ingress_ifindex != 11) |
30 | return 1; |
31 | if (skb->ifindex != 1) |
32 | return 1; |
33 | if (skb->hwtstamp != 11) |
34 | return 1; |
35 | |
36 | return 0; |
37 | } |
38 |