Lines Matching +full:closed +full:- +full:loop
6 * SPDX-License-Identifier: Apache-2.0
63 while ((p = k_fifo_get(&ctx->recv_q, K_NO_WAIT)) != NULL) { in zsock_flush_queue()
74 k_fifo_cancel_wait(&ctx->recv_q); in zsock_flush_queue()
77 (void)k_condvar_signal(&ctx->cond.recv); in zsock_flush_queue()
87 return -1; in zsock_socket_internal()
103 errno = -res; in zsock_socket_internal()
104 return -1; in zsock_socket_internal()
108 ctx->user_data = NULL; in zsock_socket_internal()
111 ctx->socket_data = NULL; in zsock_socket_internal()
114 k_fifo_init(&ctx->recv_q); in zsock_socket_internal()
119 k_condvar_init(&ctx->cond.recv); in zsock_socket_internal()
122 * and the stack: stack may detect that peer closed/aborted in zsock_socket_internal()
125 * context, it's not disposed of immediately - there's yet in zsock_socket_internal()
150 * as these are fail-free operations and we're closing in zsock_close_ctx()
159 ctx->user_data = INT_TO_POINTER(EINTR); in zsock_close_ctx()
166 errno = -ret; in zsock_close_ctx()
167 ret = -1; in zsock_close_ctx()
170 SYS_PORT_TRACING_OBJ_FUNC_EXIT(socket, close, sock, ret < 0 ? -errno : ret); in zsock_close_ctx()
191 k_fifo_init(&new_ctx->recv_q); in zsock_accepted_cb()
192 k_condvar_init(&new_ctx->cond.recv); in zsock_accepted_cb()
194 k_fifo_put(&parent->accept_q, new_ctx); in zsock_accepted_cb()
197 * and the stack: stack may detect that peer closed/aborted in zsock_accepted_cb()
200 * context, it's not disposed of immediately - there's yet in zsock_accepted_cb()
205 (void)k_condvar_signal(&parent->cond.recv); in zsock_accepted_cb()
217 if (ctx->cond.lock) { in zsock_received_cb()
218 (void)k_mutex_lock(ctx->cond.lock, K_FOREVER); in zsock_received_cb()
225 ctx->user_data = INT_TO_POINTER(-status); in zsock_received_cb()
231 struct net_pkt *last_pkt = k_fifo_peek_tail(&ctx->recv_q); in zsock_received_cb()
235 * be blocked waiting on it to become non-empty, in zsock_received_cb()
239 k_fifo_cancel_wait(&ctx->recv_q); in zsock_received_cb()
240 NET_DBG("Marked socket %p as peer-closed", ctx); in zsock_received_cb()
254 k_fifo_put(&ctx->recv_q, pkt); in zsock_received_cb()
258 (void)k_condvar_signal(&ctx->cond.recv); in zsock_received_cb()
260 if (ctx->cond.lock) { in zsock_received_cb()
261 (void)k_mutex_unlock(ctx->cond.lock); in zsock_received_cb()
273 errno = -ret; in zsock_shutdown_ctx()
274 return -1; in zsock_shutdown_ctx()
279 errno = -ret; in zsock_shutdown_ctx()
280 return -1; in zsock_shutdown_ctx()
293 return -1; in zsock_shutdown_ctx()
297 return -1; in zsock_shutdown_ctx()
307 errno = -ret; in zsock_bind_ctx()
308 return -1; in zsock_bind_ctx()
317 ctx->user_data); in zsock_bind_ctx()
319 errno = -ret; in zsock_bind_ctx()
320 return -1; in zsock_bind_ctx()
330 ctx->user_data = INT_TO_POINTER(-status); in zsock_connected_cb()
346 errno = -ret; in zsock_connect_ctx()
347 return -1; in zsock_connect_ctx()
350 K_NO_WAIT, ctx->user_data); in zsock_connect_ctx()
352 errno = -ret; in zsock_connect_ctx()
353 return -1; in zsock_connect_ctx()
364 errno = POINTER_TO_INT(ctx->user_data); in zsock_connect_ctx()
365 return -1; in zsock_connect_ctx()
369 return -1; in zsock_connect_ctx()
384 K_NO_WAIT, ctx->user_data); in zsock_connect_ctx()
386 errno = -ret; in zsock_connect_ctx()
387 return -1; in zsock_connect_ctx()
390 timeout, ctx->user_data); in zsock_connect_ctx()
392 errno = -ret; in zsock_connect_ctx()
393 return -1; in zsock_connect_ctx()
397 timeout, ctx->user_data); in zsock_connect_ctx()
399 errno = -ret; in zsock_connect_ctx()
400 return -1; in zsock_connect_ctx()
403 K_NO_WAIT, ctx->user_data); in zsock_connect_ctx()
405 errno = -ret; in zsock_connect_ctx()
406 return -1; in zsock_connect_ctx()
419 errno = -ret; in zsock_listen_ctx()
420 return -1; in zsock_listen_ctx()
425 errno = -ret; in zsock_listen_ctx()
426 return -1; in zsock_listen_ctx()
447 errno = -ret; in zsock_accept_ctx()
448 return -1; in zsock_accept_ctx()
452 ctx = k_fifo_get(&parent->accept_q, K_NO_WAIT); in zsock_accept_ctx()
455 return -1; in zsock_accept_ctx()
462 return -1; in zsock_accept_ctx()
466 last_pkt = k_fifo_peek_tail(&ctx->recv_q); in zsock_accept_ctx()
474 return -1; in zsock_accept_ctx()
483 return -1; in zsock_accept_ctx()
490 int len = MIN(*addrlen, sizeof(ctx->remote)); in zsock_accept_ctx()
492 memcpy(addr, &ctx->remote, len); in zsock_accept_ctx()
493 /* addrlen is a value-result argument, set to actual in zsock_accept_ctx()
496 if (ctx->remote.sa_family == AF_INET) { in zsock_accept_ctx()
498 } else if (ctx->remote.sa_family == AF_INET6) { in zsock_accept_ctx()
505 return -1; in zsock_accept_ctx()
529 if (status != -ENOBUFS && status != -EAGAIN) { in send_check_and_wait()
536 * If we get -EAGAIN and cannot recover, then in send_check_and_wait()
541 if (status == -ENOBUFS) { in send_check_and_wait()
542 status = -ENOMEM; in send_check_and_wait()
544 status = -ENOBUFS; in send_check_and_wait()
555 if (ctx->cond.lock) { in send_check_and_wait()
556 (void)k_mutex_unlock(ctx->cond.lock); in send_check_and_wait()
559 if (status == -ENOBUFS) { in send_check_and_wait()
564 if (status == -EAGAIN) { in send_check_and_wait()
585 if (ctx->cond.lock) { in send_check_and_wait()
586 (void)k_mutex_lock(ctx->cond.lock, K_FOREVER); in send_check_and_wait()
592 errno = -status; in send_check_and_wait()
593 return -1; in send_check_and_wait()
618 K_NO_WAIT, ctx->user_data); in zsock_sendto_ctx()
620 errno = -status; in zsock_sendto_ctx()
621 return -1; in zsock_sendto_ctx()
628 ctx->user_data); in zsock_sendto_ctx()
631 ctx->user_data); in zsock_sendto_ctx()
641 /* Update the timeout value in case loop is repeated. */ in zsock_sendto_ctx()
680 /* Update the timeout value in case loop is repeated. */ in zsock_sendmsg_ctx()
702 return -EINVAL; in sock_get_pkt_src_addr()
708 addr->sa_family = net_pkt_family(pkt); in sock_get_pkt_src_addr()
718 ret = -EINVAL; in sock_get_pkt_src_addr()
727 ret = -ENOBUFS; in sock_get_pkt_src_addr()
731 net_ipv4_addr_copy_raw((uint8_t *)&addr4->sin_addr, ipv4_hdr->src); in sock_get_pkt_src_addr()
732 port = &addr4->sin_port; in sock_get_pkt_src_addr()
741 ret = -EINVAL; in sock_get_pkt_src_addr()
750 ret = -ENOBUFS; in sock_get_pkt_src_addr()
754 net_ipv6_addr_copy_raw((uint8_t *)&addr6->sin6_addr, ipv6_hdr->src); in sock_get_pkt_src_addr()
755 port = &addr6->sin6_port; in sock_get_pkt_src_addr()
757 ret = -ENOTSUP; in sock_get_pkt_src_addr()
768 ret = -ENOBUFS; in sock_get_pkt_src_addr()
772 *port = udp_hdr->src_port; in sock_get_pkt_src_addr()
780 ret = -ENOBUFS; in sock_get_pkt_src_addr()
784 *port = tcp_hdr->src_port; in sock_get_pkt_src_addr()
786 ret = -ENOTSUP; in sock_get_pkt_src_addr()
801 ret = net_ipv4_is_addr_unspecified(&net_sin(&pkt->remote)->sin_addr); in net_pkt_remote_addr_is_unspecified()
803 ret = net_ipv6_is_addr_unspecified(&net_sin6(&pkt->remote)->sin6_addr); in net_pkt_remote_addr_is_unspecified()
817 return -EINVAL; in sock_get_offload_pkt_src_addr()
824 ret = -EINVAL; in sock_get_offload_pkt_src_addr()
828 memcpy(addr, &pkt->remote, sizeof(struct sockaddr_in)); in sock_get_offload_pkt_src_addr()
832 ret = -EINVAL; in sock_get_offload_pkt_src_addr()
836 memcpy(addr, &pkt->remote, sizeof(struct sockaddr_in6)); in sock_get_offload_pkt_src_addr()
838 } else if (ctx->flags & NET_CONTEXT_REMOTE_ADDR_SET) { in sock_get_offload_pkt_src_addr()
839 memcpy(addr, &ctx->remote, MIN(addrlen, sizeof(ctx->remote))); in sock_get_offload_pkt_src_addr()
841 ret = -ENOTSUP; in sock_get_offload_pkt_src_addr()
882 val = net_pkt_stats_tick(pkt)[i] - prev; in net_socket_update_tc_rx_time()
898 if (ctx->cond.lock == NULL) { in zsock_wait_data()
905 return -EINVAL; in zsock_wait_data()
908 if (k_fifo_is_empty(&ctx->recv_q)) { in zsock_wait_data()
910 ret = k_condvar_wait(&ctx->cond.recv, ctx->cond.lock, in zsock_wait_data()
917 return -POINTER_TO_INT(ctx->user_data); in zsock_wait_data()
929 if (msg->msg_controllen < pktinfo_len) { in insert_pktinfo()
930 return -EINVAL; in insert_pktinfo()
934 if (cmsg->cmsg_len == 0) { in insert_pktinfo()
940 return -EINVAL; in insert_pktinfo()
943 cmsg->cmsg_len = CMSG_LEN(pktinfo_len); in insert_pktinfo()
944 cmsg->cmsg_level = level; in insert_pktinfo()
945 cmsg->cmsg_type = type; in insert_pktinfo()
965 return -ENOTSUP; in add_timestamping()
972 int ret = -ENOTSUP; in add_pktinfo()
989 ret = -ENOBUFS; in add_pktinfo()
993 net_ipv4_addr_copy_raw((uint8_t *)&info.ipi_addr, ipv4_hdr->dst); in add_pktinfo()
995 (uint8_t *)net_sin_ptr(&ctx->local)->sin_addr); in add_pktinfo()
996 info.ipi_ifindex = ctx->iface; in add_pktinfo()
1015 ret = -ENOBUFS; in add_pktinfo()
1019 net_ipv6_addr_copy_raw((uint8_t *)&info.ipi6_addr, ipv6_hdr->dst); in add_pktinfo()
1020 info.ipi6_ifindex = ctx->iface; in add_pktinfo()
1040 if (cmsg->cmsg_len == 0) { in update_msg_controllen()
1043 cmsg_space += cmsg->cmsg_len; in update_msg_controllen()
1045 msg->msg_controllen = cmsg_space; in update_msg_controllen()
1073 errno = -ret; in zsock_recv_dgram()
1074 return -1; in zsock_recv_dgram()
1081 res = fifo_wait_non_empty(&ctx->recv_q, timeout); in zsock_recv_dgram()
1083 if (res && res != -EAGAIN && res != -EINTR) { in zsock_recv_dgram()
1084 errno = -res; in zsock_recv_dgram()
1085 return -1; in zsock_recv_dgram()
1088 pkt = k_fifo_peek_head(&ctx->recv_q); in zsock_recv_dgram()
1090 pkt = k_fifo_get(&ctx->recv_q, timeout); in zsock_recv_dgram()
1095 return -1; in zsock_recv_dgram()
1108 errno = -ret; in zsock_recv_dgram()
1118 errno = -ret; in zsock_recv_dgram()
1124 /* addrlen is a value-result argument, set to actual in zsock_recv_dgram()
1127 if (src_addr->sa_family == AF_INET) { in zsock_recv_dgram()
1129 } else if (src_addr->sa_family == AF_INET6) { in zsock_recv_dgram()
1141 if (msg->msg_iovlen < 1 || msg->msg_iov == NULL) { in zsock_recv_dgram()
1143 return -1; in zsock_recv_dgram()
1152 buf = msg->msg_iov[iovec].iov_base; in zsock_recv_dgram()
1155 return -1; in zsock_recv_dgram()
1158 len = MIN(tmp_read_len, msg->msg_iov[iovec].iov_len); in zsock_recv_dgram()
1166 tmp_read_len -= len; in zsock_recv_dgram()
1167 msg->msg_iov[iovec].iov_len = len; in zsock_recv_dgram()
1171 return -1; in zsock_recv_dgram()
1175 msg->msg_iovlen = iovec; in zsock_recv_dgram()
1178 msg->msg_flags |= ZSOCK_MSG_TRUNC; in zsock_recv_dgram()
1192 if (msg->msg_control != NULL) { in zsock_recv_dgram()
1193 if (msg->msg_controllen > 0) { in zsock_recv_dgram()
1197 msg->msg_flags |= ZSOCK_MSG_CTRUNC; in zsock_recv_dgram()
1204 msg->msg_flags |= ZSOCK_MSG_CTRUNC; in zsock_recv_dgram()
1211 * account pre-existing control data in zsock_recv_dgram()
1216 msg->msg_controllen = 0U; in zsock_recv_dgram()
1239 return -1; in zsock_recv_dgram()
1257 pkt = k_fifo_peek_head(&ctx->recv_q); in zsock_recv_stream_immediate()
1270 _max_len -= len; in zsock_recv_stream_immediate()
1289 pkt = k_fifo_get(&ctx->recv_q, K_NO_WAIT); in zsock_recv_stream_immediate()
1303 k_fifo_put(&ctx->recv_q, k_fifo_get(&ctx->recv_q, K_NO_WAIT)); in zsock_recv_stream_immediate()
1332 if (msg->msg_iovlen < 1) { in zsock_recv_stream_timed()
1333 return -EINVAL; in zsock_recv_stream_timed()
1336 buf = msg->msg_iov[iovec].iov_base; in zsock_recv_stream_timed()
1337 available_len = msg->msg_iov[iovec].iov_len; in zsock_recv_stream_timed()
1338 msg->msg_iov[iovec].iov_len = 0; in zsock_recv_stream_timed()
1339 max_iovlen = msg->msg_iovlen; in zsock_recv_stream_timed()
1345 return -POINTER_TO_INT(ctx->user_data); in zsock_recv_stream_timed()
1365 return -EAGAIN; in zsock_recv_stream_timed()
1368 msg->msg_iov[iovec].iov_len += res; in zsock_recv_stream_timed()
1369 buf = (uint8_t *)(msg->msg_iov[iovec].iov_base) + res; in zsock_recv_stream_timed()
1370 max_len -= res; in zsock_recv_stream_timed()
1380 msg->msg_iovlen = iovec; in zsock_recv_stream_timed()
1381 buf = msg->msg_iov[iovec].iov_base; in zsock_recv_stream_timed()
1382 available_len = msg->msg_iov[iovec].iov_len; in zsock_recv_stream_timed()
1383 msg->msg_iov[iovec].iov_len = 0; in zsock_recv_stream_timed()
1399 return -EAGAIN; in zsock_recv_stream_timed()
1421 return -1; in zsock_recv_stream()
1426 return -1; in zsock_recv_stream()
1436 /* no bytes requested - done! */ in zsock_recv_stream()
1444 errno = -res; in zsock_recv_stream()
1445 return -1; in zsock_recv_stream()
1475 return -1; in zsock_recvfrom_ctx()
1486 return -1; in zsock_recvmsg_ctx()
1489 if (msg->msg_iov == NULL) { in zsock_recvmsg_ctx()
1491 return -1; in zsock_recvmsg_ctx()
1494 for (i = 0; i < msg->msg_iovlen; i++) { in zsock_recvmsg_ctx()
1495 max_len += msg->msg_iov[i].iov_len; in zsock_recvmsg_ctx()
1500 msg->msg_name, &msg->msg_namelen); in zsock_recvmsg_ctx()
1509 return -1; in zsock_recvmsg_ctx()
1517 if (pfd->events & ZSOCK_POLLIN) { in zsock_poll_prepare_ctx()
1519 return -ENOMEM; in zsock_poll_prepare_ctx()
1522 (*pev)->obj = &ctx->recv_q; in zsock_poll_prepare_ctx()
1523 (*pev)->type = K_POLL_TYPE_FIFO_DATA_AVAILABLE; in zsock_poll_prepare_ctx()
1524 (*pev)->mode = K_POLL_MODE_NOTIFY_ONLY; in zsock_poll_prepare_ctx()
1525 (*pev)->state = K_POLL_STATE_NOT_READY; in zsock_poll_prepare_ctx()
1529 if (pfd->events & ZSOCK_POLLOUT) { in zsock_poll_prepare_ctx()
1534 return -ENOMEM; in zsock_poll_prepare_ctx()
1538 (*pev)->obj = net_tcp_conn_sem_get(ctx); in zsock_poll_prepare_ctx()
1540 (*pev)->obj = net_tcp_tx_sem_get(ctx); in zsock_poll_prepare_ctx()
1543 (*pev)->type = K_POLL_TYPE_SEM_AVAILABLE; in zsock_poll_prepare_ctx()
1544 (*pev)->mode = K_POLL_MODE_NOTIFY_ONLY; in zsock_poll_prepare_ctx()
1545 (*pev)->state = K_POLL_STATE_NOT_READY; in zsock_poll_prepare_ctx()
1548 return -EALREADY; in zsock_poll_prepare_ctx()
1554 * immediately, so we tell poll() to short-circuit wait. in zsock_poll_prepare_ctx()
1557 return -EALREADY; in zsock_poll_prepare_ctx()
1569 if (pfd->events & ZSOCK_POLLIN) { in zsock_poll_update_ctx()
1570 if ((*pev)->state != K_POLL_STATE_NOT_READY || sock_is_eof(ctx)) { in zsock_poll_update_ctx()
1571 pfd->revents |= ZSOCK_POLLIN; in zsock_poll_update_ctx()
1575 if (pfd->events & ZSOCK_POLLOUT) { in zsock_poll_update_ctx()
1579 if ((*pev)->state != K_POLL_STATE_NOT_READY && in zsock_poll_update_ctx()
1582 pfd->revents |= ZSOCK_POLLOUT; in zsock_poll_update_ctx()
1586 pfd->revents |= ZSOCK_POLLOUT; in zsock_poll_update_ctx()
1591 pfd->revents |= ZSOCK_POLLERR; in zsock_poll_update_ctx()
1595 pfd->revents |= ZSOCK_POLLHUP; in zsock_poll_update_ctx()
1612 return -EINVAL; in get_tcp_option()
1627 return -1; in ipv4_multicast_if()
1633 errno = -ret; in ipv4_multicast_if()
1634 return -1; in ipv4_multicast_if()
1639 ((struct in_addr *)optval)->s_addr = INADDR_ANY; in ipv4_multicast_if()
1646 return -1; in ipv4_multicast_if()
1649 net_ipaddr_copy((struct in_addr *)optval, &ifaddr->address.in_addr); in ipv4_multicast_if()
1660 return -1; in ipv4_multicast_if()
1666 if (mreqn->imr_ifindex != 0) { in ipv4_multicast_if()
1667 iface = net_if_get_by_index(mreqn->imr_ifindex); in ipv4_multicast_if()
1669 } else if (mreqn->imr_address.s_addr != INADDR_ANY) { in ipv4_multicast_if()
1672 ifaddr = net_if_ipv4_addr_lookup(&mreqn->imr_address, &iface); in ipv4_multicast_if()
1675 return -1; in ipv4_multicast_if()
1681 if (mreq->imr_interface.s_addr != INADDR_ANY) { in ipv4_multicast_if()
1684 ifaddr = net_if_ipv4_addr_lookup(&mreq->imr_interface, &iface); in ipv4_multicast_if()
1687 return -1; in ipv4_multicast_if()
1701 errno = -ret; in ipv4_multicast_if()
1702 return -1; in ipv4_multicast_if()
1719 return -1; in zsock_getsockopt_ctx()
1722 *(int *)optval = POINTER_TO_INT(ctx->user_data); in zsock_getsockopt_ctx()
1732 return -1; in zsock_getsockopt_ctx()
1746 errno = -ret; in zsock_getsockopt_ctx()
1747 return -1; in zsock_getsockopt_ctx()
1759 return -1; in zsock_getsockopt_ctx()
1770 return -1; in zsock_getsockopt_ctx()
1786 errno = -ret; in zsock_getsockopt_ctx()
1787 return -1; in zsock_getsockopt_ctx()
1800 errno = -ret; in zsock_getsockopt_ctx()
1801 return -1; in zsock_getsockopt_ctx()
1814 errno = -ret; in zsock_getsockopt_ctx()
1815 return -1; in zsock_getsockopt_ctx()
1828 errno = -ret; in zsock_getsockopt_ctx()
1829 return -1; in zsock_getsockopt_ctx()
1843 errno = -ret; in zsock_getsockopt_ctx()
1844 return -1; in zsock_getsockopt_ctx()
1859 errno = -ret; in zsock_getsockopt_ctx()
1860 return -1; in zsock_getsockopt_ctx()
1887 errno = -ret; in zsock_getsockopt_ctx()
1888 return -1; in zsock_getsockopt_ctx()
1908 errno = -ret; in zsock_getsockopt_ctx()
1909 return -1; in zsock_getsockopt_ctx()
1921 errno = -ret; in zsock_getsockopt_ctx()
1922 return -1; in zsock_getsockopt_ctx()
1931 return -1; in zsock_getsockopt_ctx()
1943 errno = -ret; in zsock_getsockopt_ctx()
1944 return -1; in zsock_getsockopt_ctx()
1954 errno = -ret; in zsock_getsockopt_ctx()
1955 return -1; in zsock_getsockopt_ctx()
1969 errno = -ret; in zsock_getsockopt_ctx()
1970 return -1; in zsock_getsockopt_ctx()
1988 errno = -ret; in zsock_getsockopt_ctx()
1989 return -1; in zsock_getsockopt_ctx()
2004 errno = -ret; in zsock_getsockopt_ctx()
2005 return -1; in zsock_getsockopt_ctx()
2020 errno = -ret; in zsock_getsockopt_ctx()
2021 return -1; in zsock_getsockopt_ctx()
2036 errno = -ret; in zsock_getsockopt_ctx()
2037 return -1; in zsock_getsockopt_ctx()
2050 errno = -ret; in zsock_getsockopt_ctx()
2051 return -1; in zsock_getsockopt_ctx()
2060 return -1; in zsock_getsockopt_ctx()
2067 errno = -ret; in zsock_getsockopt_ctx()
2068 return -1; in zsock_getsockopt_ctx()
2079 errno = -ret; in zsock_getsockopt_ctx()
2080 return -1; in zsock_getsockopt_ctx()
2090 return -1; in zsock_getsockopt_ctx()
2102 return -1; in ipv4_multicast_group()
2107 if (mreqn->imr_multiaddr.s_addr == INADDR_ANY) { in ipv4_multicast_group()
2109 return -1; in ipv4_multicast_group()
2112 if (mreqn->imr_ifindex != 0) { in ipv4_multicast_group()
2113 iface = net_if_get_by_index(mreqn->imr_ifindex); in ipv4_multicast_group()
2115 ifindex = net_if_ipv4_addr_lookup_by_index(&mreqn->imr_address); in ipv4_multicast_group()
2123 if (ctx->iface <= 0) { in ipv4_multicast_group()
2126 iface = net_if_get_by_index(ctx->iface); in ipv4_multicast_group()
2131 return -1; in ipv4_multicast_group()
2136 ret = net_ipv4_igmp_join(iface, &mreqn->imr_multiaddr, NULL); in ipv4_multicast_group()
2138 ret = net_ipv4_igmp_leave(iface, &mreqn->imr_multiaddr); in ipv4_multicast_group()
2142 errno = -ret; in ipv4_multicast_group()
2143 return -1; in ipv4_multicast_group()
2158 return -1; in ipv6_multicast_group()
2163 if (memcmp(&mreq->ipv6mr_multiaddr, in ipv6_multicast_group()
2165 sizeof(mreq->ipv6mr_multiaddr)) == 0) { in ipv6_multicast_group()
2167 return -1; in ipv6_multicast_group()
2170 iface = net_if_get_by_index(mreq->ipv6mr_ifindex); in ipv6_multicast_group()
2175 if (ctx->iface <= 0) { in ipv6_multicast_group()
2178 iface = net_if_get_by_index(ctx->iface); in ipv6_multicast_group()
2183 return -1; in ipv6_multicast_group()
2188 ret = net_ipv6_mld_join(iface, &mreq->ipv6mr_multiaddr); in ipv6_multicast_group()
2190 ret = net_ipv6_mld_leave(iface, &mreq->ipv6mr_multiaddr); in ipv6_multicast_group()
2194 errno = -ret; in ipv6_multicast_group()
2195 return -1; in ipv6_multicast_group()
2215 errno = -ret; in zsock_setsockopt_ctx()
2216 return -1; in zsock_setsockopt_ctx()
2230 errno = -ret; in zsock_setsockopt_ctx()
2231 return -1; in zsock_setsockopt_ctx()
2245 errno = -ret; in zsock_setsockopt_ctx()
2246 return -1; in zsock_setsockopt_ctx()
2260 errno = -ret; in zsock_setsockopt_ctx()
2261 return -1; in zsock_setsockopt_ctx()
2275 errno = -ret; in zsock_setsockopt_ctx()
2276 return -1; in zsock_setsockopt_ctx()
2291 return -1; in zsock_setsockopt_ctx()
2294 if (tv->tv_sec == 0 && tv->tv_usec == 0) { in zsock_setsockopt_ctx()
2297 timeout = K_USEC(tv->tv_sec * 1000000ULL in zsock_setsockopt_ctx()
2298 + tv->tv_usec); in zsock_setsockopt_ctx()
2307 errno = -ret; in zsock_setsockopt_ctx()
2308 return -1; in zsock_setsockopt_ctx()
2323 return -1; in zsock_setsockopt_ctx()
2326 if (tv->tv_sec == 0 && tv->tv_usec == 0) { in zsock_setsockopt_ctx()
2329 timeout = K_USEC(tv->tv_sec * 1000000ULL in zsock_setsockopt_ctx()
2330 + tv->tv_usec); in zsock_setsockopt_ctx()
2338 errno = -ret; in zsock_setsockopt_ctx()
2339 return -1; in zsock_setsockopt_ctx()
2353 errno = -ret; in zsock_setsockopt_ctx()
2354 return -1; in zsock_setsockopt_ctx()
2368 errno = -ret; in zsock_setsockopt_ctx()
2369 return -1; in zsock_setsockopt_ctx()
2386 return -1; in zsock_setsockopt_ctx()
2393 strlen(ifreq->ifr_name) == 0)) { in zsock_setsockopt_ctx()
2394 ctx->flags &= ~NET_CONTEXT_BOUND_TO_IFACE; in zsock_setsockopt_ctx()
2400 return -1; in zsock_setsockopt_ctx()
2404 ret = net_if_get_by_name(ifreq->ifr_name); in zsock_setsockopt_ctx()
2406 errno = -ret; in zsock_setsockopt_ctx()
2407 return -1; in zsock_setsockopt_ctx()
2413 return -1; in zsock_setsockopt_ctx()
2418 dev = device_get_binding(ifreq->ifr_name); in zsock_setsockopt_ctx()
2421 return -1; in zsock_setsockopt_ctx()
2427 return -1; in zsock_setsockopt_ctx()
2447 errno = -ret; in zsock_setsockopt_ctx()
2448 return -1; in zsock_setsockopt_ctx()
2463 errno = -ret; in zsock_setsockopt_ctx()
2464 return -1; in zsock_setsockopt_ctx()
2492 errno = -ret; in zsock_setsockopt_ctx()
2493 return -1; in zsock_setsockopt_ctx()
2512 errno = -ret; in zsock_setsockopt_ctx()
2513 return -1; in zsock_setsockopt_ctx()
2529 errno = -ret; in zsock_setsockopt_ctx()
2530 return -1; in zsock_setsockopt_ctx()
2549 errno = -ret; in zsock_setsockopt_ctx()
2550 return -1; in zsock_setsockopt_ctx()
2559 errno = -ret; in zsock_setsockopt_ctx()
2560 return -1; in zsock_setsockopt_ctx()
2587 errno = -ret; in zsock_setsockopt_ctx()
2588 return -1; in zsock_setsockopt_ctx()
2606 errno = -ret; in zsock_setsockopt_ctx()
2607 return -1; in zsock_setsockopt_ctx()
2622 errno = -ret; in zsock_setsockopt_ctx()
2623 return -1; in zsock_setsockopt_ctx()
2637 errno = -ret; in zsock_setsockopt_ctx()
2638 return -1; in zsock_setsockopt_ctx()
2653 errno = -ret; in zsock_setsockopt_ctx()
2654 return -1; in zsock_setsockopt_ctx()
2669 errno = -ret; in zsock_setsockopt_ctx()
2670 return -1; in zsock_setsockopt_ctx()
2683 errno = -ret; in zsock_setsockopt_ctx()
2684 return -1; in zsock_setsockopt_ctx()
2694 errno = -ret; in zsock_setsockopt_ctx()
2695 return -1; in zsock_setsockopt_ctx()
2705 errno = -ret; in zsock_setsockopt_ctx()
2706 return -1; in zsock_setsockopt_ctx()
2732 return -1; in zsock_setsockopt_ctx()
2742 return -1; in zsock_getpeername_ctx()
2745 if (!(ctx->flags & NET_CONTEXT_REMOTE_ADDR_SET)) { in zsock_getpeername_ctx()
2747 return -1; in zsock_getpeername_ctx()
2753 return -1; in zsock_getpeername_ctx()
2756 if (IS_ENABLED(CONFIG_NET_IPV4) && ctx->remote.sa_family == AF_INET) { in zsock_getpeername_ctx()
2760 addr4.sin_port = net_sin(&ctx->remote)->sin_port; in zsock_getpeername_ctx()
2761 memcpy(&addr4.sin_addr, &net_sin(&ctx->remote)->sin_addr, in zsock_getpeername_ctx()
2767 ctx->remote.sa_family == AF_INET6) { in zsock_getpeername_ctx()
2771 addr6.sin6_port = net_sin6(&ctx->remote)->sin6_port; in zsock_getpeername_ctx()
2772 memcpy(&addr6.sin6_addr, &net_sin6(&ctx->remote)->sin6_addr, in zsock_getpeername_ctx()
2779 return -1; in zsock_getpeername_ctx()
2793 if (IS_ENABLED(CONFIG_NET_IPV4) && ctx->local.family == AF_INET) { in zsock_getsockname_ctx()
2796 if (net_sin_ptr(&ctx->local)->sin_addr == NULL) { in zsock_getsockname_ctx()
2798 return -1; in zsock_getsockname_ctx()
2807 errno = -ret; in zsock_getsockname_ctx()
2808 return -1; in zsock_getsockname_ctx()
2813 } else if (IS_ENABLED(CONFIG_NET_IPV6) && ctx->local.family == AF_INET6) { in zsock_getsockname_ctx()
2816 if (net_sin6_ptr(&ctx->local)->sin6_addr == NULL) { in zsock_getsockname_ctx()
2818 return -1; in zsock_getsockname_ctx()
2827 errno = -ret; in zsock_getsockname_ctx()
2828 return -1; in zsock_getsockname_ctx()
2834 return -1; in zsock_getsockname_ctx()
2854 ctx->cond.lock = lock; in zsock_ctx_set_lock()
2927 return -1; in sock_ioctl_vmeth()