wpa_cli -a is calling the action script only for connect, not for disconnect

Shawn Rutledge shawn.t.rutledge at gmail.com
Thu Jan 15 20:14:32 EST 2009


This is for an embedded system I'm working on.  I added some extra
printfs to try to debug this.  I'm testing by using wpa_gui to connect
and disconnect from the AP, and I wanted to do the scripting to run
dhcpcd when connected and to kill it when disconnected.  I have
previously tried ifplugd, which does not work well: when wlan0 is
connected, ifplugd still says there is no link beat, so it brings the
interface down.  Then it comes back up, ifplugd notices that it's
"up", and the process repeats indefinitely.  But I guess it's not a
normal practice to use ifplugd for wireless, so I need another
mechanism to run dhcpcd automatically.

# wpa_cli -a /etc/network/wpa-action -p /var/run/wpa_supplicant
Selected interface 'wlan0'
...  (I disconnect, then I reconnect to the AP, then this:)
wpa_cli_recv_pending
wpa_cli_action_process <2>CTRL-EVENT-SCAN-RESULTS
wpa_cli_action_process <2>Trying to associate with 00:12:17:03:c7:0c
(SSID='some where' freq=2437 MHz)
wpa_cli_recv_pending
wpa_cli_action_process <2>Associated with 00:12:17:03:c7:0c
wpa_cli_recv_pending
wpa_cli_action_process <2>WPA: Key negotiation completed with
00:12:17:03:c7:0c [PTK=CCMP GTK=TKIP]
wpa_cli_action_process <2>CTRL-EVENT-CONNECTED - Connection to
00:12:17:03:c7:0c completed (reauth) [id=3 id_str=]
wlan0: dhcpcd already running on pid 2447 (/var/run/dhcpcd-wlan0.pid)

It's looking like there is no notification coming across the socket
when wlan0 is disconnected from the AP... but then again, wpa_gui
notices somehow, and changes its Status: line accordingly; so why
doesn't wpa_cli notice it?


More information about the HostAP mailing list