]> git.baikalelectronics.ru Git - kernel.git/commit
selftests: bpf: Test sockmap update from BPF
authorLorenz Bauer <lmb@cloudflare.com>
Fri, 21 Aug 2020 10:29:48 +0000 (11:29 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 21 Aug 2020 22:16:12 +0000 (15:16 -0700)
commitf1e8756091e081a110ea47f5f9ba9b04b6955c6e
tree50361f2ed977f724fc78f240c2a01df9f130f87f
parent02fc3d5324dd3b914a843f9c252dba44e51332d2
selftests: bpf: Test sockmap update from BPF

Add a test which copies a socket from a sockmap into another sockmap
or sockhash. This excercises bpf_map_update_elem support from BPF
context. Compare the socket cookies from source and destination to
ensure that the copy succeeded.

Also check that the verifier rejects map_update from unsafe contexts.

Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20200821102948.21918-7-lmb@cloudflare.com
tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
tools/testing/selftests/bpf/progs/test_sockmap_invalid_update.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/test_sockmap_update.c [new file with mode: 0644]