]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: selftest: Ensure the child sk inherited all bpf_sock_ops_cb_flags
authorMartin KaFai Lau <kafai@fb.com>
Fri, 2 Oct 2020 01:34:54 +0000 (18:34 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 2 Oct 2020 18:34:48 +0000 (11:34 -0700)
commitb214fa31c100f53825a643dfa0a33fca0cf1577e
tree2dc8b38a12a4ce910cfcaf187b32b45565d358a6
parent2c0f8bf592f324547367065280714a3b6c865020
bpf: selftest: Ensure the child sk inherited all bpf_sock_ops_cb_flags

This patch adds a test to ensure the child sk inherited everything
from the bpf_sock_ops_cb_flags of the listen sk:
1. Sets one more cb_flags (BPF_SOCK_OPS_STATE_CB_FLAG) to the listen sk
   in test_tcp_hdr_options.c
2. Saves the skops->bpf_sock_ops_cb_flags when handling the newly
   established passive connection
3. CHECK() it is the same as the listen sk

This also covers the fastopen case as the existing test_tcp_hdr_options.c
does.

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20201002013454.2542367-1-kafai@fb.com
tools/testing/selftests/bpf/prog_tests/tcp_hdr_options.c
tools/testing/selftests/bpf/progs/test_misc_tcp_hdr_options.c
tools/testing/selftests/bpf/progs/test_tcp_hdr_options.c
tools/testing/selftests/bpf/test_tcp_hdr_options.h