aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/progs/socket_cookie_prog.c
diff options
context:
space:
mode:
authorAndrii Nakryiko <andriin@fb.com>2019-06-17 12:26:59 -0700
committerDaniel Borkmann <daniel@iogearbox.net>2019-06-18 00:10:43 +0200
commitdf0b7792598291128fcca66b039fd027be25c10a (patch)
treed04dba2d6c2e76d1987c71faf627403074c297c4 /tools/testing/selftests/bpf/progs/socket_cookie_prog.c
parentselftests/bpf: switch BPF_ANNOTATE_KV_PAIR tests to BTF-defined maps (diff)
downloadlinux-df0b7792598291128fcca66b039fd027be25c10a.tar.gz
linux-df0b7792598291128fcca66b039fd027be25c10a.zip
selftests/bpf: convert tests w/ custom values to BTF-defined maps
Convert a bulk of selftests that have maps with custom (not integer) key and/or value. Signed-off-by: Andrii Nakryiko <andriin@fb.com> Acked-by: Song Liu <songliubraving@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/socket_cookie_prog.c')
-rw-r--r--tools/testing/selftests/bpf/progs/socket_cookie_prog.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/testing/selftests/bpf/progs/socket_cookie_prog.c b/tools/testing/selftests/bpf/progs/socket_cookie_prog.c
index 0db15c3210ad..6aabb681fb9a 100644
--- a/tools/testing/selftests/bpf/progs/socket_cookie_prog.c
+++ b/tools/testing/selftests/bpf/progs/socket_cookie_prog.c
@@ -12,15 +12,16 @@ struct socket_cookie {
__u32 cookie_value;
};
-struct bpf_map_def SEC("maps") socket_cookies = {
+struct {
+ __u32 type;
+ __u32 map_flags;
+ int *key;
+ struct socket_cookie *value;
+} socket_cookies SEC(".maps") = {
.type = BPF_MAP_TYPE_SK_STORAGE,
- .key_size = sizeof(int),
- .value_size = sizeof(struct socket_cookie),
.map_flags = BPF_F_NO_PREALLOC,
};
-BPF_ANNOTATE_KV_PAIR(socket_cookies, int, struct socket_cookie);
-
SEC("cgroup/connect6")
int set_cookie(struct bpf_sock_addr *ctx)
{