How to run a helper script on state changes?

Jouni Malinen j
Tue Mar 4 10:11:47 PST 2014

On Thu, Feb 27, 2014 at 05:28:20PM +0100, Denys Vlasenko wrote:
> Looks like a round-about way to achieve it, though:
> it needs enabled "ctrl_interface" thing in wpa_supplicant.conf,
> it needs a running wpa_cli process all the time,
> and since wpa_cli exits if wpa_supplicant is restarted:
>   # wpa_cli -a /qwe/rty
>   Selected interface 'wlan0'
>   wpa_supplicant is terminating - stop monitoring
>   # _
> it also needs a process to babysit wpa_cli.
> Any chances wpa_supplicant can be taught to launch
> a script by itself, avoiding the need to have an extra process?

Not much, exporting this to an external program is very much by design.
I don't want to see any external programs blocking wpa_supplicant
process or getting access to the same memory space, etc., so at minimum
it would need to fork a separate handler process. Anyway, I think it is
cleaner to just leave such operations to completely external processes.
Improving wpa_cli -a works or introducing a new program for such
operations would sound more acceptable approach.

Jouni Malinen                                            PGP id EFC895FA

More information about the Hostap mailing list