| /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 | 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 | 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 | map_kptr_race.c | 148 int listen_fd = -1, client_fd = -1, map_id; in test_sk_ls_leak() local 161 client_fd = connect_to_fd(listen_fd, 0); in test_sk_ls_leak() 162 if (!ASSERT_GE(client_fd, 0, "connect_to_fd")) in test_sk_ls_leak() 168 close(client_fd); in test_sk_ls_leak() 169 client_fd = -1; in test_sk_ls_leak() 203 if (client_fd >= 0) in test_sk_ls_leak() 204 close(client_fd); in test_sk_ls_leak()
|
| 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 | test_tc_tunnel.c | 76 int client_fd; member 174 int client_fd, server_fd; in connect_client_to_server() local 180 client_fd = connect_to_addr_str(family, SOCK_STREAM, cfg->server_addr, in connect_client_to_server() 183 if (client_fd < 0) { in connect_client_to_server() 190 close(client_fd); in connect_client_to_server() 196 conn->client_fd = client_fd; in connect_client_to_server() 205 close(conn->client_fd); in disconnect_client_from_server() 218 err = send(conn->client_fd, tx_buffer, DEFAULT_TEST_DATA_SIZE, 0); in send_and_test_data() 229 err = send(conn->client_fd, tx_buffer, GSO_TEST_DATA_SIZE, 0); in send_and_test_data()
|
| H A D | bpf_nf.c | 59 int srv_fd = -1, client_fd = -1, srv_client_fd = -1; in test_bpf_nf_ct() local 95 client_fd = connect_to_server(srv_fd); in test_bpf_nf_ct() 96 if (!ASSERT_GE(client_fd, 0, "connect_to_server")) in test_bpf_nf_ct() 151 if (client_fd != -1) in test_bpf_nf_ct() 152 close(client_fd); in test_bpf_nf_ct()
|
| H A D | icmp_send_kfunc.c | 116 int srv_fd = -1, client_fd = -1; in trigger_prog_read_icmp_errqueue() local 135 client_fd = connect_to_fd_nonblock(srv_fd); in trigger_prog_read_icmp_errqueue() 136 if (!ASSERT_OK_FD(client_fd, "client_connect_nonblock")) { in trigger_prog_read_icmp_errqueue() 142 read_icmp_errqueue(client_fd, code, af); in trigger_prog_read_icmp_errqueue() 144 close(client_fd); in trigger_prog_read_icmp_errqueue()
|
| H A D | cgrp_local_storage.c | 87 int server_fd = 0, client_fd = 0, err = 0; in test_attach_cgroup() local 117 client_fd = connect_to_fd(server_fd, 0); in test_attach_cgroup() 118 if (!ASSERT_GE(client_fd, 0, "connect_to_fd")) in test_attach_cgroup() 126 err = getsockname(client_fd, (struct sockaddr *)&addr, &addr_len); in test_attach_cgroup() 134 close(client_fd); in test_attach_cgroup()
|
| H A D | tc_redirect.c | 430 int listen_fd = -1, accept_fd = -1, client_fd = -1; in test_tcp() local 448 client_fd = connect_to_fd(listen_fd, TIMEOUT_MILLIS); in test_tcp() 449 if (!ASSERT_GE(client_fd, 0, "connect_to_fd")) in test_tcp() 459 n = write(client_fd, buf, sizeof(buf)); in test_tcp() 473 if (client_fd >= 0) in test_tcp() 474 close(client_fd); in test_tcp() 646 int opt = 1, accept_fd = -1, client_fd = -1, listen_fd, err; in test_inet_dtime() local 678 client_fd = connect_to_fd(listen_fd, TIMEOUT_MILLIS); in test_inet_dtime() 681 if (!ASSERT_GE(client_fd, 0, "connect_to_fd")) in test_inet_dtime() 691 n = write(client_fd, buf, sizeof(buf)); in test_inet_dtime() [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/selftests/landlock/ |
| H A D | net_test.c | 355 const struct protocol_variant *prot, int client_fd, in test_sendmsg() argument 374 ASSERT_EQ(0, getsockopt(client_fd, SOL_SOCKET, SO_TYPE, &sock_type, in test_sendmsg() 377 ASSERT_EQ(0, getsockopt(client_fd, SOL_SOCKET, SO_DOMAIN, &addr_family, in test_sendmsg() 380 has_remote_port = (getpeername(client_fd, (struct sockaddr *)&peer_addr, in test_sendmsg() 383 get_binded_port(client_fd, prot) == 0; in test_sendmsg() 388 client_fd, srv, get_addrlen(srv, true) - 1, "A", 1, 0); in test_sendmsg() 408 ret = sendto_variant(client_fd, srv, "B", 1, 0); in test_sendmsg() 793 int inval_fd, bind_fd, client_fd, status, ret; in test_bind_and_connect() local 894 client_fd = bind_fd; in test_bind_and_connect() 897 client_fd = accept(bind_fd, NULL, 0); in test_bind_and_connect() [all …]
|
| H A D | scoped_abstract_unix_test.c | 1387 int client_fd, ret; in TEST_F() local 1408 client_fd = in TEST_F() 1410 if (client_fd < 0) in TEST_F() 1414 ret = connect(client_fd, (struct sockaddr *)&addr, in TEST_F() 1417 ret = sendto(client_fd, ".", 1, 0, in TEST_F() 1423 close(client_fd); in TEST_F() 1431 close(client_fd); in TEST_F() 1435 close(client_fd); in TEST_F()
|
| /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()
|
| 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()
|
| H A D | vsock_test.c | 1259 int listen_fd, client_fd, i; in test_double_bind_connect_server() local 1270 client_fd = accept(listen_fd, (struct sockaddr *)&sa_client, in test_double_bind_connect_server() 1273 } while (client_fd < 0 && errno == EINTR); in test_double_bind_connect_server() 1276 if (client_fd < 0) { in test_double_bind_connect_server() 1282 vsock_wait_remote_close(client_fd); in test_double_bind_connect_server() 1290 int i, client_fd; in test_double_bind_connect_client() local 1301 client_fd = vsock_bind_connect(opts->peer_cid, opts->peer_port, in test_double_bind_connect_client() 1304 close(client_fd); in test_double_bind_connect_client() 1312 int client_fd; in test_unsent_bytes_server() local 1314 client_fd = vsock_accept(VMADDR_CID_ANY, opts->peer_port, NULL, type); in test_unsent_bytes_server() [all …]
|
| /linux/tools/testing/selftests/drivers/net/hw/ |
| H A D | ncdevmem.c | 864 int client_fd; in do_server() local 936 client_fd = accept(socket_fd, &client_addr, &client_addr_len); in do_server() 937 if (client_fd < 0) { in do_server() 962 ret = recvmsg(client_fd, &msg, MSG_SOCK_DEVMEM); in do_server() 1042 ret = setsockopt(client_fd, SOL_SOCKET, in do_server() 1067 close(client_fd); in do_server()
|