Changing debug level in 2 sockets control solution

Jouni Malinen j
Wed Feb 20 19:11:05 PST 2008

On Tue, Feb 19, 2008 at 06:12:39PM -0800, Dmitry Shmidt wrote:

> wpa_cli example is using 1 socket for both control and monitor.
> However it is more convenient to use different sockets for control and
> monitor.

Yes and that is the solution used, e.g., in wpa_gui.

> The problem:
> Command "level Number" that is used to set debug_level variable "arrives" to
>   wpa_supplicant_ctrl_iface_level() call from ctrl_iface_unix.c
> wpa_supplicant_ctrl_iface_level() checks that from-path and dest-path are
> the same and only then change debug_level.
>   However, dest-path is monitor socket, and command is done through control
> interface, so they differ and you can not set debug_level.

Well.. The monitor socket is actually already used to send at least one
command (ATTACH). Similarly, it could send a LEVEL command after the
ATTACH to change the debug level for the correct socket.

> The simplest solution is to remove this check or restrict it to smaller path
> size...
> What is the better one ?

I would prefer not to change this since only the owner of the connection
should be able to change its debug level and there may be multiple
monitor connection at the same time.

Sending out the LEVEL command through the attached monitor connection
should work here. Sure, it has a chance of getting a reply from an
unsolicited even, but I would not expect this to be an issue if the
debug level is not changed frequently. Furthermore, the msg_cb of
wpa_ctrl_request() can be used to handle the unsolicited messages while
waiting for the LEVEL command response.

Jouni Malinen                                            PGP id EFC895FA

More information about the Hostap mailing list