How to run a helper script on state changes?

Jouni Malinen j at w1.fi
Tue Feb 25 12:21:07 EST 2014


On Fri, Feb 07, 2014 at 03:55:12PM +0100, Denys Vlasenko wrote:
> I want to run a script every time wpa_supplicant detects
> a change in association state.
> In particular, I want to restart DHCP client,
> since my home wifi is not using the same IP as my work wifi.
> Currently, wpa_supplicant happily drops old association and
> acquires new one... but DHCP client is blissfully unaware
> that it needs to restart, and I am stuck with wrong IP
> until I manually restart DHCP client.

It sounds a bit unfortunate if one were to need to restart DHCP client
for this.. A good DHCP client should really track network operstate
changes and handle this automatically, e.g., with a check that the
default gateway is still there after operstate changes..

> I read "man wpa_supplicant" and "man wpa_supplicant.conf"
> and I don't see such functionality mentioned anywhere.
> Did I miss it?

wpa_supplicant/README and the "Using wpa_cli to run external program on
connect/disconnect" section.

-- 
Jouni Malinen                                            PGP id EFC895FA


More information about the HostAP mailing list