zephyr/subsys/net/lib/sockets
Maochen Wang 1dbe1dfa1f net: lib: sockets: fix socket_service thread stuck by mistake
Use Wi-Fi connecting to Qualcomm IPQ8074 AP, and run the UDP RX traffic
with Zperf, but zperf does not return the throughput number after
traffic completion nor any session started prints. After traffic
completion, ping from STA to AP and vice versa does not work. The
socket_service thread is found blocked forever at zsock_wait_data()
after dns_dispatcher_svc_handler() is called via trigger_work().
The root cause of this issue is:
STA received one DHCPv4 packet containing DHCPV4_OPTIONS_DNS_SERVER,
it will create DNS socket and registered to socket_service. Then STA
received another IPv6 router advertisement packet containing
NET_ICMPV6_ND_OPT_RDNSS, it will close socket and change the state of
poll_events to K_POLL_STATE_CANCELLED(8), then registered to
socket_service with same fd. In socket_service thread, zsock_poll()
called zsock_poll_update_ctx() when handled ZFD_IOCTL_POLL_UPDATE, and
it checked the state of poll_events was not K_POLL_STATE_NOT_READY(0),
then it will set pfd->revents to '|= ZSOCK_POLLIN'. Finally
trigger_work() can be called as 'ctx.events[i].revents > 0' is matched.

The fix of this issue is that, in zsock_poll_update_ctx(), it should
check the state of poll_events is neither K_POLL_STATE_NOT_READY nor
K_POLL_STATE_CANCELLED before setting revents as ZSOCK_POLLIN, to avoid
trigger_work be unexpectedly called.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2025-03-12 07:14:46 +01:00
..
CMakeLists.txt net: sockets: move select() implementation to zvfs 2024-10-14 13:01:51 +02:00
getaddrinfo.c style: subsys: adjust return usage in void functions 2024-09-20 11:06:55 +02:00
getnameinfo.c
Kconfig net: socketpair to use ring_buffer instead of k_pipe 2025-01-17 19:43:44 +01:00
socket_dispatcher.c
socket_obj_core.c
socket_offload.c style: subsys: adjust return usage in void functions 2024-09-20 11:06:55 +02:00
socketpair.c net: socketpair to use ring_buffer instead of k_pipe 2025-01-17 19:43:44 +01:00
sockets_can.c
sockets_inet.c net: lib: sockets: fix socket_service thread stuck by mistake 2025-03-12 07:14:46 +01:00
sockets_internal.h net: sockets: Cleanup socket properly if POSIX API is enabled 2024-11-08 15:56:39 -06:00
sockets_misc.c
sockets_net_mgmt.c
sockets_packet.c net: sockets: Fix AF_PACKET sll_protocol in recvfrom 2025-03-10 15:02:38 +01:00
sockets_service.c net: socket: service: Restart instead of bailing out when error 2025-02-07 17:48:14 +01:00
sockets_tls.c net: sockets: tls: Fix connect timeout error code 2024-12-06 18:19:54 +01:00
sockets.c Revert "arch: deprecate _current" 2025-01-10 07:49:08 +01:00