WIP FPC-III support
[linux/fpc-iii.git] / tools / testing / selftests / bpf / progs / test_sockmap_invalid_update.c
blob02a59e220cbc1250c26f6e5c74e45aa774cb7aa8
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2020 Cloudflare
3 #include "vmlinux.h"
4 #include <bpf/bpf_helpers.h>
6 struct {
7 __uint(type, BPF_MAP_TYPE_SOCKMAP);
8 __uint(max_entries, 1);
9 __type(key, __u32);
10 __type(value, __u64);
11 } map SEC(".maps");
13 SEC("sockops")
14 int bpf_sockmap(struct bpf_sock_ops *skops)
16 __u32 key = 0;
18 if (skops->sk)
19 bpf_map_update_elem(&map, &key, skops->sk, 0);
20 return 0;
23 char _license[] SEC("license") = "GPL";