selftests/bpf: Add a test case for loading BPF_SK_SKB_VERDICT
[linux-2.6-microblaze.git] / tools / testing / selftests / bpf / progs / test_sockmap_skb_verdict_attach.c
1 // SPDX-License-Identifier: GPL-2.0
2 #include "vmlinux.h"
3 #include <bpf/bpf_helpers.h>
4
5 struct {
6         __uint(type, BPF_MAP_TYPE_SOCKMAP);
7         __uint(max_entries, 2);
8         __type(key, __u32);
9         __type(value, __u64);
10 } sock_map SEC(".maps");
11
12 SEC("sk_skb/skb_verdict")
13 int prog_skb_verdict(struct __sk_buff *skb)
14 {
15         return SK_DROP;
16 }
17
18 char _license[] SEC("license") = "GPL";