0001
0002
0003 #include <linux/bpf.h>
0004 #include <bpf/bpf_helpers.h>
0005 #include <bpf/bpf_tracing.h>
0006
0007 struct sk_buff {
0008 unsigned int len;
0009 };
0010
0011 __u64 test_result = 0;
0012
0013 SEC("fexit/test_pkt_md_access")
0014 int BPF_PROG(test_main2, struct sk_buff *skb, int ret)
0015 {
0016 int len;
0017
0018 __builtin_preserve_access_index(({
0019 len = skb->len;
0020 }));
0021 if (len != 74 || ret != 0)
0022 return 0;
0023
0024 test_result = 1;
0025 return 0;
0026 }
0027 char _license[] SEC("license") = "GPL";