aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
diff options
context:
space:
mode:
authorLorenz Bauer <[email protected]>2020-09-09 16:27:11 +0000
committerAlexei Starovoitov <[email protected]>2020-09-10 19:31:55 +0000
commit0365351524d7560d8ed7a42801a15252c6c56f41 (patch)
tree7fd76c80163d4dc5a5a439e3c4ce7603c6dd0965 /tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
parentnet: sockmap: Remove unnecessary sk_fullsock checks (diff)
downloadkernel-0365351524d7560d8ed7a42801a15252c6c56f41.tar.gz
kernel-0365351524d7560d8ed7a42801a15252c6c56f41.zip
net: Allow iterating sockmap and sockhash
Add bpf_iter support for sockmap / sockhash, based on the bpf_sk_storage and hashtable implementation. sockmap and sockhash share the same iteration context: a pointer to an arbitrary key and a pointer to a socket. Both pointers may be NULL, and so BPF has to perform a NULL check before accessing them. Technically it's not possible for sockhash iteration to yield a NULL socket, but we ignore this to be able to use a single iteration point. Iteration will visit all keys that remain unmodified during the lifetime of the iterator. It may or may not visit newly added ones. Switch from using rcu_dereference_raw to plain rcu_dereference, so we gain another guard rail if CONFIG_PROVE_RCU is enabled. Signed-off-by: Lorenz Bauer <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Acked-by: Yonghong Song <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/sockmap_basic.c')
0 files changed, 0 insertions, 0 deletions