1#include <linux/bpf.h>
2#include <bpf/bpf_helpers.h>
3#include <bpf/bpf_endian.h>
4
5struct {
6 __uint(type, BPF_MAP_TYPE_SOCKMAP);
7 __uint(max_entries, 20);
8 __type(key, int);
9 __type(value, int);
10} sock_map_rx SEC(".maps");
11
12struct {
13 __uint(type, BPF_MAP_TYPE_SOCKMAP);
14 __uint(max_entries, 20);
15 __type(key, int);
16 __type(value, int);
17} sock_map_tx SEC(".maps");
18
19struct {
20 __uint(type, BPF_MAP_TYPE_SOCKMAP);
21 __uint(max_entries, 20);
22 __type(key, int);
23 __type(value, int);
24} sock_map_msg SEC(".maps");
25
26SEC("sk_skb")
27int prog_skb_verdict(struct __sk_buff *skb)
28{
29 return SK_PASS;
30}
31
32char _license[] SEC("license") = "GPL";
33

source code of linux/tools/testing/selftests/bpf/progs/test_sockmap_pass_prog.c