| /linux/tools/testing/selftests/bpf/prog_tests/ |
| H A D | cgroup_tcp_skb.c | 63 static int talk_to_cgroup(int *client_fd, int *listen_fd, int *service_fd, in talk_to_cgroup() argument 80 *listen_fd = start_server(AF_INET6, SOCK_STREAM, NULL, 0, 0); in talk_to_cgroup() 81 if (!ASSERT_GE(*listen_fd, 0, "listen_fd")) in talk_to_cgroup() 83 port = get_socket_local_port(*listen_fd); in talk_to_cgroup() 89 err = connect_fd_to_fd(*client_fd, *listen_fd, 0); in talk_to_cgroup() 92 *service_fd = accept(*listen_fd, NULL, NULL); in talk_to_cgroup() 109 static int talk_to_outside(int *client_fd, int *listen_fd, int *service_fd, in talk_to_outside() argument 121 *listen_fd = start_server(AF_INET6, SOCK_STREAM, NULL, 0, 0); in talk_to_outside() 122 if (!ASSERT_GE(*listen_fd, 0, "listen_fd")) in talk_to_outside() 133 port = get_socket_local_port(*listen_fd); in talk_to_outside() [all …]
|
| H A D | bpf_iter_setsockopt.c | 51 static int *make_established(int listen_fd, unsigned int nr_est, in make_established() argument 68 est_fds[i] = connect_to_fd(listen_fd, 0); in make_established() 76 accepted_fds[i] = accept(listen_fd, NULL, 0); in make_established() 109 int err, iter_fd = -1, listen_fd = -1; in do_bpf_iter_setsockopt() local 113 listen_fd = start_server(AF_INET6, SOCK_STREAM, "::1", 0, 0); in do_bpf_iter_setsockopt() 114 if (!ASSERT_GE(listen_fd, 0, "start_server")) in do_bpf_iter_setsockopt() 116 if (!ASSERT_EQ(set_bpf_cubic(&listen_fd, 1), 1, in do_bpf_iter_setsockopt() 119 iter_skel->bss->listen_hport = get_local_port(listen_fd); in do_bpf_iter_setsockopt() 125 est_fds = make_established(listen_fd, nr_est, &accepted_fds); in do_bpf_iter_setsockopt() 161 ASSERT_EQ(check_bpf_dctcp(&listen_fd, 1), 1, in do_bpf_iter_setsockopt() [all …]
|
| H A D | sk_storage_tracing.c | 50 int listen_fd = -1, passive_fd = -1, active_fd = -1, value = 1, err; in do_test() local 53 listen_fd = start_server(AF_INET6, SOCK_STREAM, LO_ADDR6, 0, 0); in do_test() 54 if (CHECK(listen_fd == -1, "start_server", in do_test() 55 "listen_fd:%d errno:%d\n", listen_fd, errno)) in do_test() 58 active_fd = connect_to_fd(listen_fd, 0); in do_test() 68 passive_fd = accept(listen_fd, NULL, 0); in do_test() 88 err = check_sk_stg(listen_fd, BPF_TCP_LISTEN); in do_test() 104 if (listen_fd != -1) in do_test() 105 close(listen_fd); in do_test()
|
| H A D | mptcp.c | 444 int listen_fd = -1, client_fd1 = -1, client_fd2 = -1; in test_sockmap_with_mptcp_fallback() local 450 listen_fd = start_mptcp_server(AF_INET, NULL, 0, 0); in test_sockmap_with_mptcp_fallback() 451 if (!ASSERT_OK_FD(listen_fd, "sockmap-fb:start_mptcp_server")) in test_sockmap_with_mptcp_fallback() 454 skel->bss->trace_port = ntohs(get_socket_local_port(listen_fd)); in test_sockmap_with_mptcp_fallback() 457 client_fd1 = connect_to_fd_opts(listen_fd, NULL); in test_sockmap_with_mptcp_fallback() 461 server_fd1 = accept(listen_fd, NULL, 0); in test_sockmap_with_mptcp_fallback() 463 client_fd2 = connect_to_fd_opts(listen_fd, NULL); in test_sockmap_with_mptcp_fallback() 467 server_fd2 = accept(listen_fd, NULL, 0); in test_sockmap_with_mptcp_fallback() 490 close(listen_fd); in test_sockmap_with_mptcp_fallback() 496 int listen_fd = -1, server_fd = -1, client_fd1 = -1; in test_sockmap_reject_mptcp() local [all …]
|
| H A D | tcpbpf_user.c | 49 int listen_fd = -1, cli_fd = -1, accept_fd = -1; in run_test() local 54 listen_fd = start_server(AF_INET6, SOCK_STREAM, LO_ADDR6, 0, 0); in run_test() 55 if (!ASSERT_NEQ(listen_fd, -1, "start_server")) in run_test() 58 cli_fd = connect_to_fd(listen_fd, 0); in run_test() 62 accept_fd = accept(listen_fd, NULL, NULL); in run_test() 107 if (listen_fd != -1) in run_test() 108 close(listen_fd); in run_test()
|
| H A D | map_kptr_race.c | 148 int listen_fd = -1, client_fd = -1, map_id; in test_sk_ls_leak() local 157 listen_fd = start_server(AF_INET6, SOCK_STREAM, "::1", 0, 0); in test_sk_ls_leak() 158 if (!ASSERT_GE(listen_fd, 0, "start_server")) in test_sk_ls_leak() 161 client_fd = connect_to_fd(listen_fd, 0); in test_sk_ls_leak() 170 close(listen_fd); in test_sk_ls_leak() 171 listen_fd = -1; in test_sk_ls_leak() 205 if (listen_fd >= 0) in test_sk_ls_leak() 206 close(listen_fd); in test_sk_ls_leak()
|
| H A D | btf_skc_cls_ingress.c | 103 int listen_fd = -1, cli_fd = -1, srv_fd = -1, err; in run_test() local 142 listen_fd = start_server_str(sock_family, SOCK_STREAM, srv_addr, 0, in run_test() 144 if (!ASSERT_OK_FD(listen_fd, "start server")) in run_test() 147 err = getsockname(listen_fd, (struct sockaddr *)addr, &addr_len); in run_test() 165 cli_fd = connect_to_fd(listen_fd, 0); in run_test() 169 srv_fd = accept(listen_fd, NULL, NULL); in run_test() 196 if (listen_fd != -1) in run_test() 197 close(listen_fd); in run_test()
|
| H A D | sock_fields.c | 276 int listen_fd = -1, cli_fd = -1, accept_fd = -1, err, i; in test() local 281 listen_fd = start_server(AF_INET6, SOCK_STREAM, "::1", 0xcafe, 0); in test() 283 if (CHECK_FAIL(listen_fd == -1)) in test() 286 err = getsockname(listen_fd, (struct sockaddr *)&srv_sa6, &addrlen); in test() 292 cli_fd = connect_to_fd(listen_fd, 0); in test() 301 accept_fd = accept(listen_fd, NULL, NULL); in test() 343 if (listen_fd != -1) in test() 344 close(listen_fd); in test()
|
| H A D | lsm_cgroup.c | 66 int listen_fd, client_fd, accepted_fd; in test_lsm_cgroup_functional() local 216 listen_fd = start_server(AF_INET6, SOCK_STREAM, "::1", 0, 0); in test_lsm_cgroup_functional() 217 ASSERT_GE(listen_fd, 0, "start_server"); in test_lsm_cgroup_functional() 218 client_fd = connect_to_fd(listen_fd, 0); in test_lsm_cgroup_functional() 220 accepted_fd = accept(listen_fd, NULL, NULL); in test_lsm_cgroup_functional() 265 close(listen_fd); in test_lsm_cgroup_functional()
|
| H A D | tc_redirect.c | 410 int listen_fd = -1, accept_fd = -1, client_fd = -1; in test_tcp() local 419 listen_fd = start_server(family, SOCK_STREAM, addr, port, 0); in test_tcp() 420 if (!ASSERT_GE(listen_fd, 0, "listen")) in test_tcp() 428 client_fd = connect_to_fd(listen_fd, TIMEOUT_MILLIS); in test_tcp() 432 accept_fd = accept(listen_fd, NULL, NULL); in test_tcp() 449 if (listen_fd >= 0) in test_tcp() 450 close(listen_fd); in test_tcp() 626 int opt = 1, accept_fd = -1, client_fd = -1, listen_fd, err; in test_inet_dtime() local 633 listen_fd = start_server(family, type, addr, port, 0); in test_inet_dtime() 636 if (!ASSERT_GE(listen_fd, 0, "listen")) in test_inet_dtime() [all …]
|
| /linux/tools/testing/selftests/net/af_unix/ |
| H A D | msg_oob.c | 61 int listen_fd; in create_tcp_socketpair() local 64 listen_fd = socket(AF_INET, SOCK_STREAM, 0); in create_tcp_socketpair() 65 ASSERT_GE(listen_fd, 0); in create_tcp_socketpair() 67 ret = listen(listen_fd, -1); in create_tcp_socketpair() 71 ret = getsockname(listen_fd, (struct sockaddr *)&addr, &addrlen); in create_tcp_socketpair() 80 self->fd[3] = accept(listen_fd, (struct sockaddr *)&addr, &addrlen); in create_tcp_socketpair()
|
| /linux/tools/testing/vsock/ |
| H A D | vsock_test.c | 1227 int listen_fd, client_fd, i; in test_double_bind_connect_server() local 1231 listen_fd = vsock_stream_listen(VMADDR_CID_ANY, opts->peer_port); in test_double_bind_connect_server() 1238 client_fd = accept(listen_fd, (struct sockaddr *)&sa_client, in test_double_bind_connect_server() 1253 close(listen_fd); in test_double_bind_connect_server()
|