@@ -6,25 +6,11 @@
#include <netinet/tcp.h>
#include "test_progs.h"
+#include "network_helpers.h"
#define MAX_TEST_NAME 80
#define TCP_ULP 31
-static int tcp_server(int family)
-{
- int err, s;
-
- s = socket(family, SOCK_STREAM, 0);
- if (!ASSERT_GE(s, 0, "socket"))
- return -1;
-
- err = listen(s, SOMAXCONN);
- if (!ASSERT_OK(err, "listen"))
- return -1;
-
- return s;
-}
-
static int disconnect(int fd)
{
struct sockaddr unspec = { AF_UNSPEC };
@@ -35,12 +21,15 @@ static int disconnect(int fd)
/* Disconnect (unhash) a kTLS socket after removing it from sockmap. */
static void test_sockmap_ktls_disconnect_after_delete(int family, int map)
{
+ struct network_helper_opts opts = {
+ .backlog = SOMAXCONN,
+ };
struct sockaddr_storage addr = {0};
socklen_t len = sizeof(addr);
int err, cli, srv, zero = 0;
- srv = tcp_server(family);
- if (srv == -1)
+ srv = start_server_str(family, SOCK_STREAM, NULL, 0, &opts);
+ if (!ASSERT_GE(srv, 0, "start_server_str"))
return;
err = getsockname(srv, (struct sockaddr *)&addr, &len);