| /linux/tools/testing/selftests/bpf/prog_tests/ |
| H A D | sockopt_inherit.c | 44 int client_fd; in server_thread() local 60 client_fd = accept(fd, (struct sockaddr *)&addr, &len); in server_thread() 61 if (!ASSERT_GE(client_fd, 0, "accept client")) in server_thread() 64 err += verify_sockopt(client_fd, CUSTOM_INHERIT1, "accept", 1); in server_thread() 65 err += verify_sockopt(client_fd, CUSTOM_INHERIT2, "accept", 1); in server_thread() 66 err += verify_sockopt(client_fd, CUSTOM_LISTENER, "accept", 0); in server_thread() 68 close(client_fd); in server_thread() 98 int server_fd = -1, client_fd; in run_test() local 138 client_fd = connect_to_fd(server_fd, 0); in run_test() 139 if (!ASSERT_GE(client_fd, 0, "connect_to_server")) in run_test() [all …]
|
| 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 74 *client_fd = create_client_sock_v6(); in talk_to_cgroup() 75 if (!ASSERT_GE(*client_fd, 0, "client_fd")) in talk_to_cgroup() 89 err = connect_fd_to_fd(*client_fd, *listen_fd, 0); in talk_to_cgroup() 98 cp = write(*client_fd, "hello", 5); in talk_to_cgroup() 109 static int talk_to_outside(int *client_fd, int *listen_fd, int *service_fd, in talk_to_outside() argument 127 *client_fd = create_client_sock_v6(); in talk_to_outside() 128 if (!ASSERT_GE(*client_fd, 0, "client_fd")) in talk_to_outside() 139 err = connect_fd_to_fd(*client_fd, *listen_fd, 0); in talk_to_outside() 145 cp = write(*client_fd, "hello", 5); in talk_to_outside() [all …]
|
| H A D | mptcp.c | 85 static int verify_tsk(int map_fd, int client_fd) in verify_tsk() argument 87 int err, cfd = client_fd; in verify_tsk() 123 static int verify_msk(int map_fd, int client_fd, __u32 token) in verify_msk() argument 126 int err, cfd = client_fd; in verify_msk() 158 int client_fd, prog_fd, map_fd, err; in run_test() local 175 client_fd = connect_to_fd(server_fd, 0); in run_test() 176 if (!ASSERT_GE(client_fd, 0, "connect to fd")) { in run_test() 181 err += is_mptcp ? verify_msk(map_fd, client_fd, sock_skel->bss->token) : in run_test() 182 verify_tsk(map_fd, client_fd); in run_test() 184 close(client_fd); in run_test() [all …]
|
| H A D | tcp_rtt.c | 50 static int verify_sk(int map_fd, int client_fd, const char *msg, __u32 invoked, in verify_sk() argument 57 if (!ASSERT_GE(bpf_map_lookup_elem(map_fd, &client_fd, &val), 0, "read socket storage")) in verify_sk() 108 int client_fd; in run_test() local 126 client_fd = connect_to_fd(server_fd, 0); in run_test() 127 if (client_fd < 0) { in run_test() 132 err += verify_sk(map_fd, client_fd, "syn-ack", in run_test() 139 send_byte(client_fd); in run_test() 140 if (wait_for_ack(client_fd, 100) < 0) { in run_test() 146 err += verify_sk(map_fd, client_fd, "first payload byte", in run_test() 154 close(client_fd); in run_test()
|
| H A D | socket_cookie.c | 18 int server_fd = 0, client_fd = 0, cgroup_fd = 0, err = 0; in test_socket_cookie() local 52 client_fd = connect_to_fd(server_fd, 0); in test_socket_cookie() 53 if (CHECK(client_fd < 0, "connect_to_fd", "errno %d\n", errno)) in test_socket_cookie() 57 &client_fd, &val); in test_socket_cookie() 61 err = getsockname(client_fd, (struct sockaddr *)&addr, &addr_len); in test_socket_cookie() 69 close(client_fd); in test_socket_cookie()
|
| H A D | sk_lookup.c | 376 static int tcp_echo_test(int client_fd, int server_fd) in tcp_echo_test() argument 380 err = send_byte(client_fd); in tcp_echo_test() 386 err = recv_byte(client_fd); in tcp_echo_test() 393 static int udp_echo_test(int client_fd, int server_fd) in udp_echo_test() argument 397 err = send_byte(client_fd); in udp_echo_test() 403 err = recv_byte(client_fd); in udp_echo_test() 541 int client_fd, reuse_conn_fd = -1; in run_lookup_prog() local 585 client_fd = connect_to_addr_str(is_ipv6(t->connect_to.ip) ? AF_INET6 : AF_INET, in run_lookup_prog() 587 if (!ASSERT_OK_FD(client_fd, "connect_to_addr_str")) in run_lookup_prog() 591 tcp_echo_test(client_fd, server_fds[t->accept_on]); in run_lookup_prog() [all …]
|
| H A D | ns_current_pid_tgid.c | 124 int verdict, map, server_fd = -1, client_fd = -1; in test_current_pid_tgid_sk_msg() local 155 client_fd = connect_to_fd(server_fd, 0); in test_current_pid_tgid_sk_msg() 156 if (!ASSERT_GE(client_fd, 0, "connect_to_fd")) in test_current_pid_tgid_sk_msg() 159 err = bpf_map_update_elem(map, &key, &client_fd, BPF_ANY); in test_current_pid_tgid_sk_msg() 163 err = send(client_fd, send_msg, sizeof(send_msg), 0); in test_current_pid_tgid_sk_msg() 176 if (client_fd >= 0) in test_current_pid_tgid_sk_msg() 177 close(client_fd); in test_current_pid_tgid_sk_msg()
|
| H A D | load_bytes_relative.c | 12 int server_fd, cgroup_fd, prog_fd, map_fd, client_fd; in test_load_bytes_relative() local 52 client_fd = connect_to_fd(server_fd, 0); in test_load_bytes_relative() 53 if (CHECK_FAIL(client_fd < 0)) in test_load_bytes_relative() 55 close(client_fd); in test_load_bytes_relative()
|
| H A D | cgroup_v1v2.c | 56 int server_fd, client_fd, cgroup_fd; in test_cgroup_v1v2() 62 client_fd = connect_to_fd_opts(server_fd, &opts); in test_cgroup_v1v2() 63 if (!ASSERT_GE(client_fd, 0, "client_fd")) { in test_cgroup_v1v2() 67 close(client_fd); in test_cgroup_v1v2() 50 int server_fd, client_fd, cgroup_fd; test_cgroup_v1v2() local
|
| H A D | xdp_synproxy.c | 60 int server_fd = -1, client_fd = -1, accept_fd = -1; in test_synproxy() local 135 client_fd = connect_to_fd(server_fd, 10000); in test_synproxy() 136 if (!ASSERT_GE(client_fd, 0, "connect_to_fd")) in test_synproxy() 161 if (client_fd >= 0) in test_synproxy() 162 close(client_fd); in test_synproxy()
|
| H A D | bpf_nf.c | 53 int srv_fd = -1, client_fd = -1, srv_client_fd = -1; in test_bpf_nf_ct() local 89 client_fd = connect_to_server(srv_fd); in test_bpf_nf_ct() 90 if (!ASSERT_GE(client_fd, 0, "connect_to_server")) in test_bpf_nf_ct() 142 if (client_fd != -1) in test_bpf_nf_ct() 143 close(client_fd); in test_bpf_nf_ct()
|
| H A D | tc_redirect.c | 410 int listen_fd = -1, accept_fd = -1, client_fd = -1; in test_tcp() 428 client_fd = connect_to_fd(listen_fd, TIMEOUT_MILLIS); in test_tcp() 429 if (!ASSERT_GE(client_fd, 0, "connect_to_fd")) in test_tcp() 439 n = write(client_fd, buf, sizeof(buf)); in test_tcp() 453 if (client_fd >= 0) in test_tcp() 454 close(client_fd); in test_tcp() 626 int opt = 1, accept_fd = -1, client_fd = -1, listen_fd, err; in test_inet_dtime() 658 client_fd = connect_to_fd(listen_fd, TIMEOUT_MILLIS); in test_inet_dtime() 661 if (!ASSERT_GE(client_fd, 0, "connect_to_fd")) in test_inet_dtime() 671 n = write(client_fd, bu in test_inet_dtime() 409 int listen_fd = -1, accept_fd = -1, client_fd = -1; test_tcp() local 625 int opt = 1, accept_fd = -1, client_fd = -1, listen_fd, err; test_inet_dtime() local [all...] |
| H A D | cg_storage_multi.c | 59 int server_fd = -1, client_fd = -1; in connect_send() local 70 client_fd = connect_to_fd(server_fd, 0); in connect_send() 71 if (client_fd < 0) in connect_send() 74 if (send(client_fd, &message, sizeof(message), 0) < 0) in connect_send() 83 close(client_fd); in connect_send()
|
| /linux/tools/testing/selftests/net/ |
| H A D | bind_timewait.c | 45 int server_fd, client_fd, child_fd, ret; in create_timewait_socket() local 61 client_fd = socket(AF_INET, SOCK_STREAM, 0); in create_timewait_socket() 62 ASSERT_GT(client_fd, 0); in create_timewait_socket() 64 ret = connect(client_fd, (struct sockaddr *)&self->addr, self->addrlen); in create_timewait_socket() 72 close(client_fd); in create_timewait_socket()
|
| /linux/tools/testing/vsock/ |
| H A D | vsock_perf.c | 142 int client_fd; in run_receiver() local 179 client_fd = accept(fd, &clientaddr.sa, &clientaddr_len); in run_receiver() 181 if (client_fd < 0) in run_receiver() 184 vsock_increase_buf_size(client_fd); in run_receiver() 186 if (setsockopt(client_fd, SOL_SOCKET, SO_RCVLOWAT, in run_receiver() 206 fds.fd = client_fd; in run_receiver() 250 close(client_fd); in run_receiver()
|
| H A D | util.c | 204 int client_fd; in vsock_bind_connect() local 206 client_fd = vsock_bind(VMADDR_CID_ANY, bind_port, type); in vsock_bind_connect() 208 if (vsock_connect_fd(client_fd, cid, port)) { in vsock_bind_connect() 213 return client_fd; in vsock_bind_connect() 276 int fd, client_fd, old_errno; in vsock_accept() local 284 client_fd = accept(fd, &clientaddr.sa, &clientaddr_len); in vsock_accept() 286 } while (client_fd < 0 && errno == EINTR); in vsock_accept() 293 if (client_fd < 0) in vsock_accept() 294 return client_fd; in vsock_accept() 309 return client_fd; in vsock_accept() [all...] |
| H A D | vsock_test.c | 1215 int listen_fd, client_fd, i; in test_double_bind_connect_server() local 1226 client_fd = accept(listen_fd, (struct sockaddr *)&sa_client, in test_double_bind_connect_server() 1229 } while (client_fd < 0 && errno == EINTR); in test_double_bind_connect_server() 1232 if (client_fd < 0) { in test_double_bind_connect_server() 1238 vsock_wait_remote_close(client_fd); in test_double_bind_connect_server() 1246 int i, client_fd; in test_double_bind_connect_client() local 1257 client_fd = vsock_bind_connect(opts->peer_cid, opts->peer_port, in test_double_bind_connect_client() 1260 close(client_fd); in test_double_bind_connect_client() 1268 int client_fd; in test_unsent_bytes_server() local 1270 client_fd in test_unsent_bytes_server() 1314 int client_fd; test_unread_bytes_server() local [all...] |
| H A D | vsock_diag_test.c | 406 int client_fd; in test_connect_server() local 408 client_fd = vsock_stream_accept(VMADDR_CID_ANY, opts->peer_port, NULL); in test_connect_server() 409 if (client_fd < 0) { in test_connect_server() 417 st = find_vsock_stat(&sockets, client_fd); in test_connect_server() 423 close(client_fd); in test_connect_server()
|
| /linux/tools/testing/selftests/landlock/ |
| H A D | net_test.c | 514 int inval_fd, bind_fd, client_fd, status, ret; in test_bind_and_connect() local 615 client_fd = bind_fd; in test_bind_and_connect() 618 client_fd = accept(bind_fd, NULL, 0); in test_bind_and_connect() 619 ASSERT_LE(0, client_fd); in test_bind_and_connect() 622 EXPECT_EQ(1, read(client_fd, &buf, 1)); in test_bind_and_connect() 631 if (client_fd != bind_fd) in test_bind_and_connect() 632 EXPECT_LE(0, close(client_fd)); in test_bind_and_connect() 824 int bind_fd, client_fd, status; in TEST_F() local 909 client_fd = bind_fd; in TEST_F() 911 client_fd = accept(bind_fd, NULL, 0); in TEST_F() [all …]
|
| /linux/tools/testing/selftests/drivers/net/hw/ |
| H A D | ncdevmem.c | 844 int client_fd; in do_client() 914 client_fd = accept(socket_fd, &client_addr, &client_addr_len); in do_client() 915 if (client_fd < 0) { in do_client() 940 ret = recvmsg(client_fd, &msg, MSG_SOCK_DEVMEM); in do_client() 1015 ret = setsockopt(client_fd, SOL_SOCKET, in main() 1040 close(client_fd); in main() 553 int client_fd; do_server() local
|
| /linux/tools/testing/selftests/bpf/ |
| H A D | network_helpers.h | 80 int connect_fd_to_fd(int client_fd, int server_fd, int timeout_ms);
|
| H A D | network_helpers.c | 374 int connect_fd_to_fd(int client_fd, int server_fd, int timeout_ms) in connect_fd_to_fd() 379 if (settimeo(client_fd, timeout_ms)) in connect_fd_to_fd() 387 if (connect(client_fd, (const struct sockaddr *)&addr, len)) { in connect_fd_to_fd() 368 connect_fd_to_fd(int client_fd,int server_fd,int timeout_ms) connect_fd_to_fd() argument
|