diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_nf.c b/tools/testing/selftests/bpf/prog_tests/bpf_nf.c index b30ff6b3b81a..0a54cd2c3fe2 100644 --- a/tools/testing/selftests/bpf/prog_tests/bpf_nf.c +++ b/tools/testing/selftests/bpf/prog_tests/bpf_nf.c @@ -31,22 +31,6 @@ enum { IPS_SRC_NAT_DONE | IPS_DST_NAT_DONE | \ IPS_SRC_NAT | IPS_DST_NAT) -static int connect_to_server(int srv_fd) -{ - int fd = -1; - - fd = socket(AF_INET, SOCK_STREAM, 0); - if (!ASSERT_GE(fd, 0, "socket")) - goto out; - - if (!ASSERT_EQ(connect_fd_to_fd(fd, srv_fd, TIMEOUT_MS), 0, "connect_fd_to_fd")) { - close(fd); - fd = -1; - } -out: - return fd; -} - static void test_bpf_nf_ct(int mode) { const char *iptables = "iptables-legacy -t raw %s PREROUTING -j CONNMARK --set-mark 42/0"; @@ -77,7 +61,7 @@ static void test_bpf_nf_ct(int mode) if (!ASSERT_GE(srv_fd, 0, "start_server")) goto end; - client_fd = connect_to_server(srv_fd); + client_fd = connect_to_fd(srv_fd, TIMEOUT_MS); if (!ASSERT_GE(client_fd, 0, "connect_to_server")) goto end;