wpa_cli ping-pong and power management
j at w1.fi
Fri Oct 31 13:02:30 EDT 2008
On Fri, Oct 31, 2008 at 06:00:51PM +0200, Alon Bar-Lev wrote:
> At least Gentoo network init script  uses wpa_cli with a script 
> to simulate ifplugd events for wpa_supplicant enabled interfaces.
> Can it be done better using scripts with current wpa_supplicant
> offering? (Without forking new processes every time and without waking
> up the process).
wpa_cli can be used in three "modes": interactive, action monitor,
command line tool. As far as I can tell, alarm(1) is only used in the
interactive case and Gentoo script does not use it (-a on the wpa_cli
command line indicates use of action monitor operation).
Action monitor uses a select() loop while waiting for new messages.
However, it does have a PING operation to test whether the connection is
still available. This is currently hardcoded to be done every two
seconds. Unlike the alarm() in interactive mode, I would agree on this
action monitor case benefiting from optimization from the viewpoint of
At minimum, the 2 second ping interval could be made configurable, but
it could also be possible to change the select() call to catch
wpa_supplicant exiting bit more reliably (well, at least in case this is
used on Linux/BSD).
Jouni Malinen PGP id EFC895FA
More information about the HostAP