diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2019-12-18 19:07:01 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-12-20 21:09:21 -0800 |
commit | 9bb8a29d28e01bf7dcdb67f71edbca9d3826d004 (patch) | |
tree | 5ae4d12ca7d3281a62d1741b40ff6b11f44d94a4 /tools/testing/vsock/util.h | |
parent | df7e0e0d237e5a4ee262befb11b599058a178966 (diff) | |
download | linux-stable-9bb8a29d28e01bf7dcdb67f71edbca9d3826d004.tar.gz linux-stable-9bb8a29d28e01bf7dcdb67f71edbca9d3826d004.tar.bz2 linux-stable-9bb8a29d28e01bf7dcdb67f71edbca9d3826d004.zip |
VSOCK: extract connect/accept functions from vsock_diag_test.c
Many test cases will need to connect to the server or accept incoming
connections. This patch extracts these operations into utility
functions that can be reused.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/vsock/util.h')
-rw-r--r-- | tools/testing/vsock/util.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/testing/vsock/util.h b/tools/testing/vsock/util.h index 033e7d59a42a..1786305cfddd 100644 --- a/tools/testing/vsock/util.h +++ b/tools/testing/vsock/util.h @@ -2,6 +2,9 @@ #ifndef UTIL_H #define UTIL_H +#include <sys/socket.h> +#include <linux/vm_sockets.h> + /* Tests can either run as the client or the server */ enum test_mode { TEST_MODE_UNSET, @@ -30,6 +33,9 @@ struct test_case { void init_signals(void); unsigned int parse_cid(const char *str); +int vsock_stream_connect(unsigned int cid, unsigned int port); +int vsock_stream_accept(unsigned int cid, unsigned int port, + struct sockaddr_vm *clientaddrp); void run_tests(const struct test_case *test_cases, const struct test_opts *opts); |