xref: /linux/tools/testing/selftests/bpf/progs/test_sockmap_drop_prog.c (revision 0e2b2a76278153d1ac312b0691cb65dabb9aef3e)
1 #include <linux/bpf.h>
2 #include <bpf/bpf_helpers.h>
3 #include <bpf/bpf_endian.h>
4 
5 struct {
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 
12 struct {
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 
19 struct {
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 
26 SEC("sk_skb")
27 int prog_skb_verdict(struct __sk_buff *skb)
28 {
29 	return SK_DROP;
30 }
31 
32 char _license[] SEC("license") = "GPL";
33