1 | // SPDX-License-Identifier: GPL-2.0 |
2 | /* Copyright (c) 2019 Facebook */ |
3 | #include <linux/bpf.h> |
4 | #include <bpf/bpf_helpers.h> |
5 | #include <bpf/bpf_tracing.h> |
6 | |
7 | struct sk_buff { |
8 | unsigned int len; |
9 | }; |
10 | |
11 | __u64 test_result = 0; |
12 | |
13 | SEC("fexit/test_pkt_md_access" ) |
14 | int BPF_PROG(test_main2, struct sk_buff *skb, int ret) |
15 | { |
16 | int len; |
17 | |
18 | __builtin_preserve_access_index(({ |
19 | len = skb->len; |
20 | })); |
21 | if (len != 74 || ret != 0) |
22 | return 0; |
23 | |
24 | test_result = 1; |
25 | return 0; |
26 | } |
27 | char _license[] SEC("license" ) = "GPL" ; |
28 | |