| /freebsd/tools/regression/sockets/listen_backlog/ |
| H A D | listen_backlog.c | 67 socket_get_backlog(int sock, int *backlogp, const char *testclass, in socket_get_backlog() argument 74 if (getsockopt(sock, SOL_SOCKET, SO_LISTENQLIMIT, &i, &len) < 0) { in socket_get_backlog() 103 int backlog_retrieved, sock; in socket_listen() local 105 sock = socket(domain, type, protocol); in socket_listen() 106 if (sock < 0) { in socket_listen() 109 close(sock); in socket_listen() 113 if (socket_get_backlog(sock, &backlog_retrieved, testclass, test, in socket_listen() 115 close(sock); in socket_listen() 123 close(sock); in socket_listen() 127 if (listen(sock, backlog) < 0) { in socket_listen() [all …]
|
| /freebsd/tools/regression/netinet/ipsockopt/ |
| H A D | ipsockopt.c | 75 int sock; in get_socket_priv() local 84 sock = socket(PF_INET, type, 0); in get_socket_priv() 89 return (sock); in get_socket_priv() 112 test_ip_options(int sock, const char *socktypename) in test_ip_options() argument 122 if (getsockopt(sock, IPPROTO_IP, IP_OPTIONS, test_options, &len) < 0) in test_ip_options() 138 if (setsockopt(sock, IPPROTO_IP, IP_OPTIONS, &new_options, in test_ip_options() 152 if (getsockopt(sock, IPPROTO_IP, IP_OPTIONS, test_options, &len) < 0) in test_ip_options() 182 if (setsockopt(sock, IPPROTO_IP, IP_OPTIONS, NULL, 0) < 0) in test_ip_options() 192 if (getsockopt(sock, IPPROTO_IP, IP_OPTIONS, test_options, &len) < 0) in test_ip_options() 215 int flag[2], sock; in test_ip_hdrincl() local [all …]
|
| /freebsd/tools/regression/sockets/shutdown/ |
| H A D | shutdown.c | 41 struct sockaddr_in sock; in main() local 59 bzero(&sock, sizeof(sock)); in main() 60 sock.sin_len = sizeof(sock); in main() 61 sock.sin_family = AF_INET; in main() 62 sock.sin_addr.s_addr = htonl(INADDR_LOOPBACK); in main() 63 sock.sin_port = 0; in main() 65 if (bind(listen_sock, (struct sockaddr *)&sock, sizeof(sock)) < 0) in main() 67 inet_ntoa(sock.sin_addr), sock.sin_port, strerror(errno)); in main() 69 len = sizeof(sock); in main() 70 if (getsockname(listen_sock, (struct sockaddr *)&sock, &len) < 0) in main() [all …]
|
| /freebsd/contrib/bsnmp/snmpd/ |
| H A D | trans_inet.c | 354 struct port_sock *sock = __containerof(pi, struct port_sock, input); in inet_recv() local 367 sock->parse_ctrl(sock, &msg); in inet_recv() 462 struct port_sock *sock = calloc(1, sizeof(struct port_sock)); in ipv4_create() local 463 if (sock == NULL) in ipv4_create() 466 snmpd_input_init(&sock->input); in ipv4_create() 468 TAILQ_INSERT_HEAD(&port->socks, sock, link); in ipv4_create() 471 (struct sockaddr_in *)&sock->bind_addr; in ipv4_create() 478 sock->port = port; in ipv4_create() 493 struct port_sock *sock = udata; in ipv4_input() local 495 sock->input.peerlen = sizeof(struct sockaddr_in); in ipv4_input() [all …]
|
| /freebsd/tools/regression/sockets/sigpipe/ |
| H A D | sigpipe.c | 86 test_send(const char *testname, int sock) in test_send() argument 92 len = send(sock, &ch, sizeof(ch), 0); in test_send() 102 test_write(const char *testname, int sock) in test_write() argument 108 len = write(sock, &ch, sizeof(ch)); in test_write() 216 tcp_pair(u_short port, int sock[2]) in tcp_pair() 244 sock[0] = accept_sock; in tcp_pair() 245 sock[1] = connect_sock; in tcp_pair() 252 int sock[2]; in main() local 269 if (socketpair(PF_LOCAL, SOCK_STREAM, 0, sock) < 0) in main() 271 test_send_wantsignal("test_send_wantsignal(PF_LOCAL)", sock[0], in main() [all …]
|
| /freebsd/contrib/ntp/libntp/lib/isc/include/isc/ |
| H A D | socket.h | 277 void (*attach)(isc_socket_t *sock, 280 isc_result_t (*bind)(isc_socket_t *sock, isc_sockaddr_t *sockaddr, 282 isc_result_t (*sendto)(isc_socket_t *sock, isc_region_t *region, 286 isc_result_t (*connect)(isc_socket_t *sock, isc_sockaddr_t *addr, 289 isc_result_t (*recv)(isc_socket_t *sock, isc_region_t *region, 292 void (*cancel)(isc_socket_t *sock, isc_task_t *task, 294 isc_result_t (*getsockname)(isc_socket_t *sock, 296 isc_sockettype_t (*gettype)(isc_socket_t *sock); 297 void (*ipv6only)(isc_socket_t *sock, isc_boolean_t yes); 298 isc_result_t (*fdwatchpoke)(isc_socket_t *sock, int flags); [all …]
|
| /freebsd/contrib/wpa/wpa_supplicant/ |
| H A D | ctrl_iface_unix.c | 36 int sock; member 46 int sock; member 64 const char *ifname, int sock, 76 static void wpas_ctrl_sock_debug(const char *title, int sock, const char *buf, in wpas_ctrl_sock_debug() argument 89 if (getsockopt(sock, SOL_SOCKET, SO_SNDBUF, &sndbuf, &optlen) < 0) in wpas_ctrl_sock_debug() 92 if (ioctl(sock, TIOCOUTQ, &outq) < 0) in wpas_ctrl_sock_debug() 97 title, sock, sndbuf, outq, (int) len); in wpas_ctrl_sock_debug() 129 static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx, in wpa_supplicant_ctrl_iface_receive() argument 145 res = recvfrom(sock, buf, CTRL_IFACE_MAX_LEN + 1, 0, in wpa_supplicant_ctrl_iface_receive() 205 wpas_ctrl_sock_debug("ctrl_sock-sendto", sock, reply, in wpa_supplicant_ctrl_iface_receive() [all …]
|
| /freebsd/crypto/openssl/crypto/bio/ |
| H A D | bio_sock2.c | 44 int sock = -1; in BIO_socket() local 49 sock = socket(domain, socktype, protocol); in BIO_socket() 50 if (sock == -1) { in BIO_socket() 64 ktls_enable(sock); in BIO_socket() 68 return sock; in BIO_socket() 92 int BIO_connect(int sock, const BIO_ADDR *addr, int options) in BIO_connect() argument 96 if (sock == -1) { in BIO_connect() 101 if (!BIO_socket_nbio(sock, (options & BIO_SOCK_NONBLOCK) != 0)) in BIO_connect() 105 if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, in BIO_connect() 116 if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, in BIO_connect() [all …]
|
| /freebsd/contrib/sendmail/contrib/ |
| H A D | socketmapClient.pl | 14 my $sock; 17 $sock = new IO::Socket::INET ( 23 $sock = new IO::Socket::UNIX ( 31 die "Could not create socket: $!\n" unless $sock; 35 netstringWrite($sock, $request); 36 $sock->flush(); 37 my $response = netstringRead($sock); 42 $sock->close(); 45 my $sock = shift; 48 print $sock length($data).':'.$data.','; [all …]
|
| H A D | socketmapServer.pl | 11 my $sock; 14 $sock = new IO::Socket::INET ( 23 $sock = new IO::Socket::UNIX ( 32 while(my $client = $sock->accept()) { 38 $sock->close(); 45 $sock->close(); 76 my $sock = shift; 79 print $sock length($data).':'.$data.','; 83 my $sock = shift; 86 my $dataLength = <$sock>; [all …]
|
| /freebsd/contrib/openbsm/bin/auditdistd/ |
| H A D | proto_common.c | 52 blocking_socket(int sock) in blocking_socket() argument 56 flags = fcntl(sock, F_GETFL); in blocking_socket() 62 proto_descriptor_send(int sock, int fd) in proto_descriptor_send() argument 68 PJDLOG_ASSERT(sock >= 0); in proto_descriptor_send() 85 if (sendmsg(sock, &msg, 0) == -1) in proto_descriptor_send() 92 proto_common_send(int sock, const unsigned char *data, size_t size, int fd) in proto_common_send() argument 98 PJDLOG_ASSERT(sock >= 0); in proto_common_send() 105 if (shutdown(sock, SHUT_RD) == -1) in proto_common_send() 115 done = send(sock, data, sendsize, MSG_NOSIGNAL); in proto_common_send() 144 if (errno == EAGAIN && blocking_socket(sock)) in proto_common_send() [all …]
|
| /freebsd/sbin/hastd/ |
| H A D | proto_common.c | 52 blocking_socket(int sock) in blocking_socket() argument 56 flags = fcntl(sock, F_GETFL); in blocking_socket() 62 proto_descriptor_send(int sock, int fd) in proto_descriptor_send() argument 68 PJDLOG_ASSERT(sock >= 0); in proto_descriptor_send() 85 if (sendmsg(sock, &msg, 0) == -1) in proto_descriptor_send() 92 proto_common_send(int sock, const unsigned char *data, size_t size, int fd) in proto_common_send() argument 98 PJDLOG_ASSERT(sock >= 0); in proto_common_send() 105 if (shutdown(sock, SHUT_RD) == -1) in proto_common_send() 115 done = send(sock, data, sendsize, MSG_NOSIGNAL); in proto_common_send() 144 if (errno == EAGAIN && blocking_socket(sock)) in proto_common_send() [all …]
|
| /freebsd/lib/libc/tests/secure/ |
| H A D | fortify_socket_test.c | 77 new_socket(int sock[2]) in new_socket() 87 error = socketpair(AF_UNIX, SOCK_STREAM, 0, sock); in new_socket() 91 rv = send(sock[1], &sockbuf[total], sizeof(sockbuf) - total, 0); in new_socket() 111 error = sendmsg(sock[1], &hdr, 0); in new_socket() 181 int sock[2] = { -1, -1 }; in ATF_TC_BODY() local 183 new_socket(sock); in ATF_TC_BODY() 186 getpeername(sock[0], &__stack.__buf, &socklen); in ATF_TC_BODY() 206 int sock[2] = { -1, -1 }; in ATF_TC_BODY() local 208 new_socket(sock); in ATF_TC_BODY() 211 getpeername(sock[0], &__stack.__buf, &socklen); in ATF_TC_BODY() [all …]
|
| /freebsd/lib/libnv/ |
| H A D | msgio.c | 100 msg_recv(int sock, struct msghdr *msg) in msg_recv() argument 104 PJDLOG_ASSERT(sock >= 0); in msg_recv() 113 fd_wait(sock, true); in msg_recv() 114 if (recvmsg(sock, msg, flags) == -1) { in msg_recv() 126 msg_send(int sock, const struct msghdr *msg) in msg_send() argument 129 PJDLOG_ASSERT(sock >= 0); in msg_send() 132 fd_wait(sock, false); in msg_send() 133 if (sendmsg(sock, msg, 0) == -1) { in msg_send() 146 cred_send(int sock) in cred_send() argument 179 if (msg_send(sock, &msg) == -1) in cred_send() [all …]
|
| /freebsd/contrib/netbsd-tests/net/ |
| H A D | net_common.sh | 110 local sock=$1 114 export RUMP_SERVER=$sock 146 local sock=$1 152 atf_check -s exit:0 rump_server $libs $sock 154 echo $sock >> $_rump_server_socks 160 local sock=$1 171 _rump_server_start_common $sock $libs 178 local sock=$1 189 _rump_server_start_common $sock $libs 196 local sock=$1 [all …]
|
| /freebsd/tools/regression/sockets/rtsocket/ |
| H A D | rtsocket.c | 44 int sock, socks[2]; in main() local 46 sock = socket(PF_ROUTE, SOCK_STREAM, 0); in main() 47 if (sock >= 0) { in main() 48 close(sock); in main() 50 sock); in main() 56 sock = socket(PF_ROUTE, SOCK_DGRAM, 0); in main() 57 if (sock >= 0) { in main() 58 close(sock); in main() 60 sock); in main() 66 sock = socket(PF_ROUTE, SOCK_RAW, 0); in main() [all …]
|
| /freebsd/tests/sys/netinet/ |
| H A D | ip_mroute.py | 24 def _msgwait(sock: socket.socket, expected: bytes, timeout=None): 26 sock.settimeout(timeout) 27 msg = sock.recv(1024) 172 self.sock = self.mcast_join(self.MULTICAST_ADDR, 12345) 175 self._msgwait(self.sock, b"Hello, Multicast!") 178 self._msgwait(self.sock, b"Goodbye, Multicast!") 184 self.sock = self.mcast_join(self.MULTICAST_ADDR, 12345) 189 self._msgwait(self.sock, b"Hello, Multicast!") 190 self._msgwait(self.sock, b"Goodbye, Multicast!") 254 self.sock = self.mcast_join(self.MULTICAST_ADDR, 12345) [all …]
|
| /freebsd/tools/regression/sockets/unix_socket/ |
| H A D | unix_socket.c | 43 int sock, socks[2]; in main() local 45 sock = socket(PF_LOCAL, SOCK_STREAM, 0); in main() 46 if (sock < 0) in main() 48 close(sock); in main() 50 sock = socket(PF_LOCAL, SOCK_DGRAM, 0); in main() 51 if (sock < 0) in main() 53 close(sock); in main() 55 sock = socket(PF_LOCAL, SOCK_RAW, 0); in main() 56 if (sock >= 0) { in main() 57 close(sock); in main() [all …]
|
| /freebsd/crypto/krb5/src/util/verto/ |
| H A D | ev_win32.c | 67 SOCKET sock [2] = { -1, -1 }; in ev_pipe() local 85 if ((sock [0] = ev_tcp_socket ()) == INVALID_SOCKET) in ev_pipe() 88 if (connect (sock [0], (struct sockaddr *)&addr, addr_size)) in ev_pipe() 93 if ((sock [1] = accept (listener, 0, 0)) < 0) in ev_pipe() 108 if (getpeername (sock [0], (struct sockaddr *)&addr, &addr_size)) in ev_pipe() 111 if (getsockname (sock [1], (struct sockaddr *)&adr2, &adr2_size)) in ev_pipe() 123 filedes [0] = EV_WIN32_HANDLE_TO_FD (sock [0]); in ev_pipe() 124 filedes [1] = EV_WIN32_HANDLE_TO_FD (sock [1]); in ev_pipe() 128 filedes [0] = sock [0]; in ev_pipe() 129 filedes [1] = sock [1]; in ev_pipe() [all …]
|
| /freebsd/crypto/heimdal/lib/kadm5/ |
| H A D | send_recv.c | 44 krb5_storage *sock; in _kadm5_client_send() local 46 assert(context->sock != -1); in _kadm5_client_send() 62 sock = krb5_storage_from_fd(context->sock); in _kadm5_client_send() 63 if(sock == NULL) { in _kadm5_client_send() 69 ret = krb5_store_data(sock, out); in _kadm5_client_send() 72 krb5_storage_free(sock); in _kadm5_client_send() 82 krb5_storage *sock; in _kadm5_client_recv() local 84 sock = krb5_storage_from_fd(context->sock); in _kadm5_client_recv() 85 if(sock == NULL) { in _kadm5_client_recv() 89 ret = krb5_ret_data(sock, &data); in _kadm5_client_recv() [all …]
|
| /freebsd/usr.bin/sockstat/ |
| H A D | main.c | 185 struct sock { struct 187 RB_ENTRY(sock) socket_tree; /* tree of pcbs with socket */ argument 188 SLIST_ENTRY(sock) socket_list; /* list of pcbs w/o socket */ 190 RB_ENTRY(sock) pcb_tree; 212 static RB_HEAD(socks_t, sock) socks = RB_INITIALIZER(&socks); argument 214 socket_compare(const struct sock *a, const struct sock *b) in socket_compare() 218 RB_GENERATE_STATIC(socks_t, sock, socket_tree, socket_compare); 220 static RB_HEAD(pcbs_t, sock) pcbs = RB_INITIALIZER(&pcbs); 222 pcb_compare(const struct sock *a, const struct sock *b) in pcb_compare() 226 RB_GENERATE_STATIC(pcbs_t, sock, pcb_tree, pcb_compare); [all …]
|
| /freebsd/crypto/openssh/ |
| H A D | canohost.c | 67 get_socket_address(int sock, int remote, int flags) in get_socket_address() argument 74 if (sock < 0) in get_socket_address() 82 if (getpeername(sock, (struct sockaddr *)&addr, &addrlen) != 0) in get_socket_address() 85 if (getsockname(sock, (struct sockaddr *)&addr, &addrlen) != 0) in get_socket_address() 116 get_peer_ipaddr(int sock) in get_peer_ipaddr() argument 120 if ((p = get_socket_address(sock, 1, NI_NUMERICHOST)) != NULL) in get_peer_ipaddr() 126 get_local_ipaddr(int sock) in get_local_ipaddr() argument 130 if ((p = get_socket_address(sock, 0, NI_NUMERICHOST)) != NULL) in get_local_ipaddr() 158 get_sock_port(int sock, int local) in get_sock_port() argument 165 if (sock < 0) in get_sock_port() [all …]
|
| /freebsd/tests/sys/capsicum/ |
| H A D | socket.cc | 32 int sock = socket(AF_UNIX, SOCK_STREAM, 0); in TEST() local 33 EXPECT_OK(sock); in TEST() 34 if (sock < 0) return; in TEST() 36 int cap_sock_rw = dup(sock); in TEST() 39 int cap_sock_all = dup(sock); in TEST() 42 EXPECT_OK(close(sock)); in TEST() 56 int sock = socket(AF_UNIX, SOCK_STREAM, 0); in TEST() local 57 EXPECT_OK(sock); in TEST() 58 if (sock < 0) return; in TEST() 60 int cap_sock_rw = dup(sock); in TEST() [all …]
|
| /freebsd/tools/regression/sockets/listen_kqueue/ |
| H A D | listen_kqueue.c | 52 int kq, sock, opt, pid, nev, fd; in main() local 57 if ((sock = socket(PF_INET, SOCK_STREAM, 0)) == -1) in main() 60 EV_SET(&ev[0], sock, EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, NULL); in main() 61 EV_SET(&ev[1], sock, EVFILT_WRITE, EV_ADD | EV_CLEAR, 0, 0, NULL); in main() 64 if (setsockopt(sock, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof(opt)) == -1) in main() 70 if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) == -1) in main() 77 if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) == -1) in main() 79 if (listen(sock, 0x80) == -1) in main() 82 if (ioctl(sock, FIONBIO, &opt) == -1) in main() 92 if (close(sock) == -1) in main() [all …]
|
| /freebsd/contrib/wpa/src/drivers/ |
| H A D | linux_ioctl.c | 19 int linux_set_iface_flags(int sock, const char *ifname, int dev_up) in linux_set_iface_flags() argument 24 if (sock < 0) in linux_set_iface_flags() 30 if (ioctl(sock, SIOCGIFFLAGS, &ifr) != 0) { in linux_set_iface_flags() 47 if (ioctl(sock, SIOCSIFFLAGS, &ifr) != 0) { in linux_set_iface_flags() 59 int linux_iface_up(int sock, const char *ifname) in linux_iface_up() argument 64 if (sock < 0) in linux_iface_up() 70 if (ioctl(sock, SIOCGIFFLAGS, &ifr) != 0) { in linux_iface_up() 81 int linux_get_ifhwaddr(int sock, const char *ifname, u8 *addr) in linux_get_ifhwaddr() argument 87 if (ioctl(sock, SIOCGIFHWADDR, &ifr)) { in linux_get_ifhwaddr() 104 int linux_set_ifhwaddr(int sock, const char *ifname, const u8 *addr) in linux_set_ifhwaddr() argument [all …]
|