summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/test_misc_tcp_hdr_options.c
diff options
context:
space:
mode:
authorMartin KaFai Lau <kafai@fb.com>2020-10-01 18:34:54 -0700
committerAlexei Starovoitov <ast@kernel.org>2020-10-02 11:34:48 -0700
commit96d46c508506136ed35c4b02d74ce38e91d88421 (patch)
tree2dc8b38a12a4ce910cfcaf187b32b45565d358a6 /tools/testing/selftests/bpf/progs/test_misc_tcp_hdr_options.c
parent82f45c6c4a70622cc0585e3f4372e192a6491d26 (diff)
downloadlinux-96d46c508506136ed35c4b02d74ce38e91d88421.tar.gz
linux-96d46c508506136ed35c4b02d74ce38e91d88421.tar.bz2
linux-96d46c508506136ed35c4b02d74ce38e91d88421.zip
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
Diffstat (limited to 'tools/testing/selftests/bpf/progs/test_misc_tcp_hdr_options.c')
-rw-r--r--tools/testing/selftests/bpf/progs/test_misc_tcp_hdr_options.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_misc_tcp_hdr_options.c b/tools/testing/selftests/bpf/progs/test_misc_tcp_hdr_options.c
index 3a216d1d0226..72ec0178f653 100644
--- a/tools/testing/selftests/bpf/progs/test_misc_tcp_hdr_options.c
+++ b/tools/testing/selftests/bpf/progs/test_misc_tcp_hdr_options.c
@@ -304,10 +304,10 @@ int misc_estab(struct bpf_sock_ops *skops)
passive_lport_n = __bpf_htons(passive_lport_h);
bpf_setsockopt(skops, SOL_TCP, TCP_SAVE_SYN,
&true_val, sizeof(true_val));
- set_hdr_cb_flags(skops);
+ set_hdr_cb_flags(skops, 0);
break;
case BPF_SOCK_OPS_TCP_CONNECT_CB:
- set_hdr_cb_flags(skops);
+ set_hdr_cb_flags(skops, 0);
break;
case BPF_SOCK_OPS_PARSE_HDR_OPT_CB:
return handle_parse_hdr(skops);