@@ -861,7 +861,6 @@ static void drop_on_lookup(const struct test *t)
.post_socket_cb = setsockopts,
.cb_opts = &cb_opts,
};
- struct sockaddr_storage dst = {};
int client_fd, server_fd, err;
struct bpf_link *lookup_link;
ssize_t n;
@@ -878,12 +877,11 @@ static void drop_on_lookup(const struct test *t)
if (attach_reuseport(server_fd, t->reuseport_prog))
goto close_srv;
- client_fd = make_socket(t->sotype, t->connect_to.ip,
- t->connect_to.port, &dst);
+ client_fd = connect_to_fd(server_fd, IO_TIMEOUT_SEC);
if (client_fd < 0)
goto close_srv;
- err = connect(client_fd, (void *)&dst, inetaddr_len(&dst));
+ err = 0;
if (t->sotype == SOCK_DGRAM) {
err = send_byte(client_fd);
if (err)
@@ -997,7 +995,6 @@ static void drop_on_reuseport(const struct test *t)
.post_socket_cb = setsockopts,
.cb_opts = &cb_opts2,
};
- struct sockaddr_storage dst = { 0 };
int client, server1, server2, err;
struct bpf_link *lookup_link;
ssize_t n;
@@ -1024,12 +1021,11 @@ static void drop_on_reuseport(const struct test *t)
if (server2 < 0)
goto close_srv1;
- client = make_socket(t->sotype, t->connect_to.ip,
- t->connect_to.port, &dst);
+ client = connect_to_fd(server2, IO_TIMEOUT_SEC);
if (client < 0)
goto close_srv2;
- err = connect(client, (void *)&dst, inetaddr_len(&dst));
+ err = 0;
if (t->sotype == SOCK_DGRAM) {
err = send_byte(client);
if (err)
@@ -1195,7 +1191,7 @@ static void run_sk_assign_connected(struct test_sk_lookup *skel,
if (server_fd < 0)
return;
- connected_fd = make_client(sotype, EXT_IP4, EXT_PORT);
+ connected_fd = connect_to_fd(server_fd, IO_TIMEOUT_SEC);
if (connected_fd < 0)
goto out_close_server;
@@ -1209,7 +1205,7 @@ static void run_sk_assign_connected(struct test_sk_lookup *skel,
goto out_close_connected;
/* Try to redirect TCP SYN / UDP packet to a connected socket */
- client_fd = make_client(sotype, EXT_IP4, EXT_PORT);
+ client_fd = connect_to_fd(server_fd, IO_TIMEOUT_SEC);
if (client_fd < 0)
goto out_unlink_prog;
if (sotype == SOCK_DGRAM) {