]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/bpf: add sockopt test that exercises sk helpers
authorStanislav Fomichev <sdf@google.com>
Thu, 27 Jun 2019 20:38:52 +0000 (13:38 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 27 Jun 2019 22:25:17 +0000 (15:25 -0700)
commitea035e5654d70921f34f75ad14d8829401156f16
treec307bccb558de0b14e3ce10a0150d24f252b8f45
parent114a49ee6ca2c9ed99d9e28600af7c02c1860a02
selftests/bpf: add sockopt test that exercises sk helpers

socktop test that introduces new SOL_CUSTOM sockopt level and
stores whatever users sets in sk storage. Whenever getsockopt
is called, the original value is retrieved.

v9:
* SO_SNDBUF example to override user-supplied buffer

v7:
* use retval=0 and optlen-1

v6:
* test 'ret=1' use-case as well (Alexei Starovoitov)

v4:
* don't call bpf_sk_fullsock helper

v3:
* drop (__u8 *)(long) casts for optval{,_end}

v2:
* new test

Cc: Andrii Nakryiko <andriin@fb.com>
Cc: Martin Lau <kafai@fb.com>
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/.gitignore
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/bpf/progs/sockopt_sk.c [new file with mode: 0644]
tools/testing/selftests/bpf/test_sockopt_sk.c [new file with mode: 0644]