[PATCH] wpa-cli: Support monitor mode without action file.
Jouni Malinen
j at w1.fi
Tue Apr 17 15:27:12 PDT 2018
On Tue, Apr 17, 2018 at 03:18:02PM -0700, Ben Greear wrote:
> I do want to receive events, such as notification of when 4-way auth
> completed so I could know when to start the dhcp client process ('iw event'
> doesn't seem to offer an event for this, so that is why I was using
> supplicant).
So this would be the exact use case that wpa_cli -a<action script> was
added for..
> I don't want to poll, as that would be inefficient in my setup where I have
> lots of virtual stations, so it seemed that wpa_cli in a monitor mode
> would be a good option, and it seemed less work to tweak wpa_cli than
> to re-write something similar.
>
> Maybe I am missing your point, but how would I use wpa_ctrl.c or wpaspy.py in this
> case?
Either use the action script for events like the CONNECTED event (which
will cover that DHCP client start) or wait for monitor socket events in
your own application (that would apparently now wait on stdout lines
from wpa_cli) if you need some messages for debugging purposes where it
does not make sense to support them with an action script. The latter
case could use wpa_ctrl.c or wpaspy.py as an helper:
ctrl = wpa_ctrl_open(..)
wpa_ctrl_attach(ctrl)
and then either blocking:
while (wpa_ctrl_recv(Ctrl, buf, &buflen) == 0) {
process..
}
or nonblocking:
fd = wpa_ctrl_get_fd(ctrl)
select/poll/etc. on fd being readable and run wpa_ctrl_recv()
--
Jouni Malinen PGP id EFC895FA
More information about the Hostap
mailing list