selftests/bpf: Use start_server_addr in test_tcp_check_syncookie
authorGeliang Tang <tanggeliang@kylinos.cn>
Sun, 5 May 2024 11:35:10 +0000 (19:35 +0800)
committerMartin KaFai Lau <martin.lau@kernel.org>
Thu, 9 May 2024 20:40:38 +0000 (13:40 -0700)
commit49e1fa8dbd81340f610057be3f3909f24c232807
treefc50583586dff003832a56fa604d97e424694266
parent5166b3e3e30a8eb93f7182283ed4db719bdfde1a
selftests/bpf: Use start_server_addr in test_tcp_check_syncookie

Include network_helpers.h in test_tcp_check_syncookie_user.c, use
public helper start_server_addr() in it instead of the local defined
function start_server(). This can avoid duplicate code.

Add two helpers v6only_true() and v6only_false() to set IPV6_V6ONLY
sockopt to true or false, set them to post_socket_cb pointer of struct
network_helper_opts, and pass it to start_server_setsockopt().

In order to use functions defined in network_helpers.c, Makefile needs
to be updated too.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Link: https://lore.kernel.org/r/e0c5324f5da84f453f47543536e70f126eaa8678.1714907662.git.tanggeliang@kylinos.cn
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/bpf/test_tcp_check_syncookie_user.c