diff options
| author | Stanislav Fomichev <[email protected]> | 2020-05-08 17:46:08 +0000 |
|---|---|---|
| committer | Daniel Borkmann <[email protected]> | 2020-05-08 22:48:20 +0000 |
| commit | 33181bb8e8fe947e1f8020a4b103601a4cac94d9 (patch) | |
| tree | bc14ba3f6a663f0c0dc8505c983fbfdfd07c618a /tools/testing/selftests/bpf/network_helpers.h | |
| parent | bpf, i386: Remove unneeded conversion to bool (diff) | |
| download | kernel-33181bb8e8fe947e1f8020a4b103601a4cac94d9.tar.gz kernel-33181bb8e8fe947e1f8020a4b103601a4cac94d9.zip | |
selftests/bpf: Generalize helpers to control background listener
Move the following routines that let us start a background listener
thread and connect to a server by fd to the test_prog:
* start_server - socket+bind+listen
* connect_to_fd - connect to the server identified by fd
These will be used in the next commit.
Also, extend these helpers to support AF_INET6 and accept the family
as an argument.
v5:
* drop pthread.h (Martin KaFai Lau)
* add SO_SNDTIMEO (Martin KaFai Lau)
v4:
* export extra helper to start server without a thread (Martin KaFai Lau)
* tcp_rtt is no longer starting background thread (Martin KaFai Lau)
v2:
* put helpers into network_helpers.c (Andrii Nakryiko)
Signed-off-by: Stanislav Fomichev <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Acked-by: Andrey Ignatov <[email protected]>
Acked-by: Martin KaFai Lau <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/testing/selftests/bpf/network_helpers.h')
| -rw-r--r-- | tools/testing/selftests/bpf/network_helpers.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/network_helpers.h b/tools/testing/selftests/bpf/network_helpers.h new file mode 100644 index 000000000000..30068eacc1a2 --- /dev/null +++ b/tools/testing/selftests/bpf/network_helpers.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __NETWORK_HELPERS_H +#define __NETWORK_HELPERS_H +#include <sys/socket.h> +#include <sys/types.h> + +int start_server(int family, int type); +int connect_to_fd(int family, int type, int server_fd); + +#endif |
