xref: /linux/tools/testing/selftests/bpf/progs/skb_load_bytes.c (revision 24bce201d79807b668bf9d9e0aca801c5c0d5f78)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include <linux/bpf.h>
4 #include <bpf/bpf_helpers.h>
5 
6 char _license[] SEC("license") = "GPL";
7 
8 __u32 load_offset = 0;
9 int test_result = 0;
10 
11 SEC("tc")
12 int skb_process(struct __sk_buff *skb)
13 {
14 	char buf[16];
15 
16 	test_result = bpf_skb_load_bytes(skb, load_offset, buf, 10);
17 
18 	return 0;
19 }
20