Issue with wpa_cli and 'PING' check

Jouni Malinen j at w1.fi
Sat Dec 2 02:26:47 PST 2017


On Fri, Dec 01, 2017 at 04:41:43PM -0800, Ben Greear wrote:
> While debugging some strange issues, I noticed that my wpa_cli
> in monitor mode was disconnecting because the PING failed.
> 
> It looks like the reason it fails goes something like this:
> 
> wpa_cli: ping
> wpa_supplicant:  do things, post logging message to wpa-cli
> wpa_supplicant:  read ping & reply with pong
> wpa_cli:  reads 'logging message', decides PONG fails, and disconnects.

Looks like wpa_cli -a<script> case is not using two control interface
sockets like the interactive case does to avoid this.. I guess that
should be fixed.

> So, nasty race I guess?

Yeah.. wpa_ctrl_request() tries to avoid this with the msg_cb() design
based on reply starting with '<', but that is not really perfect and
everything that really matters from robustness view point should use a
separate socket for receiving messages (registered with "ATTACH") and
for commands (like this "PING" case) to avoid any chance of interpreting
an unsolicited event message as a response to a pending command.

In case of wpa_cli, this would need changes in wpa_cli_open_connection()
to open mon_conn for the action script case as well and then make
wpa_cli_action() use mon_conn instad of ctrl for wpa_ctrl_get_fd().. Or
something very similar to that.

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list