diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 21:00:30 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 21:00:30 +0000 |
commit | e54def4ad8144ab15f826416e2e0f290ef1901b4 (patch) | |
tree | 583f8d4bd95cd67c44ff37b878a7eddfca9ab97a /tools/testing/selftests/bpf/progs/local_storage.c | |
parent | Adding upstream version 6.8.12. (diff) | |
download | linux-e54def4ad8144ab15f826416e2e0f290ef1901b4.tar.xz linux-e54def4ad8144ab15f826416e2e0f290ef1901b4.zip |
Adding upstream version 6.9.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/local_storage.c')
-rw-r--r-- | tools/testing/selftests/bpf/progs/local_storage.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/tools/testing/selftests/bpf/progs/local_storage.c b/tools/testing/selftests/bpf/progs/local_storage.c index 637e75df2e..e5e3a8b8dd 100644 --- a/tools/testing/selftests/bpf/progs/local_storage.c +++ b/tools/testing/selftests/bpf/progs/local_storage.c @@ -140,12 +140,11 @@ int BPF_PROG(socket_bind, struct socket *sock, struct sockaddr *address, { __u32 pid = bpf_get_current_pid_tgid() >> 32; struct local_storage *storage; - struct sock *sk = sock->sk; - if (pid != monitored_pid || !sk) + if (pid != monitored_pid) return 0; - storage = bpf_sk_storage_get(&sk_storage_map, sk, 0, 0); + storage = bpf_sk_storage_get(&sk_storage_map, sock->sk, 0, 0); if (!storage) return 0; @@ -156,24 +155,24 @@ int BPF_PROG(socket_bind, struct socket *sock, struct sockaddr *address, /* This tests that we can associate multiple elements * with the local storage. */ - storage = bpf_sk_storage_get(&sk_storage_map2, sk, 0, + storage = bpf_sk_storage_get(&sk_storage_map2, sock->sk, 0, BPF_LOCAL_STORAGE_GET_F_CREATE); if (!storage) return 0; - if (bpf_sk_storage_delete(&sk_storage_map2, sk)) + if (bpf_sk_storage_delete(&sk_storage_map2, sock->sk)) return 0; - storage = bpf_sk_storage_get(&sk_storage_map2, sk, 0, + storage = bpf_sk_storage_get(&sk_storage_map2, sock->sk, 0, BPF_LOCAL_STORAGE_GET_F_CREATE); if (!storage) return 0; - if (bpf_sk_storage_delete(&sk_storage_map, sk)) + if (bpf_sk_storage_delete(&sk_storage_map, sock->sk)) return 0; /* Ensure that the sk_storage_map is disconnected from the storage. */ - if (!sk->sk_bpf_storage || sk->sk_bpf_storage->smap) + if (!sock->sk->sk_bpf_storage || sock->sk->sk_bpf_storage->smap) return 0; sk_storage_result = 0; @@ -186,12 +185,11 @@ int BPF_PROG(socket_post_create, struct socket *sock, int family, int type, { __u32 pid = bpf_get_current_pid_tgid() >> 32; struct local_storage *storage; - struct sock *sk = sock->sk; - if (pid != monitored_pid || !sk) + if (pid != monitored_pid) return 0; - storage = bpf_sk_storage_get(&sk_storage_map, sk, 0, + storage = bpf_sk_storage_get(&sk_storage_map, sock->sk, 0, BPF_LOCAL_STORAGE_GET_F_CREATE); if (!storage) return 0; |