OSDN Git Service

selftests/bpf: add test for bpf_tcp_gen_syncookie
authorPetar Penkov <ppenkov@google.com>
Mon, 29 Jul 2019 16:59:18 +0000 (09:59 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 31 Jul 2019 04:03:05 +0000 (21:03 -0700)
commit91bc35789db4e1a489be7ab6e318e6265202e096
treeb268597b9de7c61cd2427727c2213d8d17998fe0
parent637f71c09ba22d1042f5b48b58c249ee5665d44d
selftests/bpf: add test for bpf_tcp_gen_syncookie

Modify the existing bpf_tcp_check_syncookie test to also generate a
SYN cookie, pass the packet to the kernel, and verify that the two
cookies are the same (and both valid). Since cloned SKBs are skipped
during generic XDP, this test does not issue a SYN cookie when run in
XDP mode. We therefore only check that a valid SYN cookie was issued at
the TC hook.

Additionally, verify that the MSS for that SYN cookie is within
expected range.

Signed-off-by: Petar Penkov <ppenkov@google.com>
Reviewed-by: Lorenz Bauer <lmb@cloudflare.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/progs/test_tcp_check_syncookie_kern.c
tools/testing/selftests/bpf/test_tcp_check_syncookie.sh
tools/testing/selftests/bpf/test_tcp_check_syncookie_user.c