Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
[nrf noup] zephyr: Handle socket close
Browse files Browse the repository at this point in the history
fixup! [nrf noup] zephyr: Add support for WPA CLI zephyr

In some cases (interface is disabled) the control interface socket is
closed but as we don't handle EoF control interface keeps receiving
zero bytes from the socket continuously and this causes an infinite
loop and starving other threads (even SHELL thread).

So, treat 0 bytes recv as EoF as its a connected socket and unregister
from eloop to avoid infinite loop of recv failures.

Fixes SHEL-2320.

Signed-off-by: Chaitanya Tata <[email protected]>
  • Loading branch information
krish2718 committed Dec 18, 2023
1 parent 92f056a commit d8d1d6d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions wpa_supplicant/ctrl_iface_zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx,
os_free(buf);
return;
}
if (!res) {
eloop_unregister_sock(sock, EVENT_TYPE_READ);
wpa_printf(MSG_DEBUG, "ctrl_iface: Peer unexpectedly shut down "
"socket");
os_free(buf);
return;
}

if ((size_t) res > CTRL_IFACE_MAX_LEN) {
wpa_printf(MSG_ERROR, "recvform(ctrl_iface): input truncated");
Expand Down

0 comments on commit d8d1d6d

Please sign in to comment.