[bug] wpa session does not recover from disconnection

I am running Flukso 1.0 in a WPA-PSK network whose AP is running OpenWRT r15252 and when the router is rebooted the Flukso cannot recover once the router is back online.

The same issue can be triggered by using wpa_cli and issue "disconnect" / "reconnect":

-x-x-x-
> sta
bssid=00:17:31:d6:97:7a
ssid=IZ4FHT
id=0
pairwise_cipher=TKIP
group_cipher=TKIP
key_mgmt=WPA-PSK
wpa_state=COMPLETED
ip_address=192.168.2.12
> disconnect
OK
> <2>CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys
reconnect
OK
> <2>CTRL-EVENT-SCAN-RESULTS
<2>Trying to associate with 00:17:31:d6:97:7a (SSID='IZ4FHT' freq=2437 MHz)
<2>Associated with 00:17:31:d6:97:7a
<2>WPA: 4-Way Handshake failed - pre-shared key may be incorrect
<2>CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys
-x-x-x-

This is what happens on the router when the Flukso cannot reconnect:

-x-x-x-
[...more of the same...]
Feb 14 22:28:04 router-casa-andrea daemon.info hostapd: wlan0: STA
00:12:0e:b3:c0:b1 IEEE 802.11: authenticated
Feb 14 22:28:04 router-casa-andrea daemon.info hostapd: wlan0: STA
00:12:0e:b3:c0:b1 IEEE 802.11: associated (aid 1)
Feb 14 22:28:04 router-casa-andrea daemon.info hostapd: wlan0: STA
00:12:0e:b3:c0:b1 RADIUS: starting accounting session 49F3722C-000000D1
Feb 14 22:28:04 router-casa-andrea daemon.info hostapd: wlan0: STA
00:12:0e:b3:c0:b1 WPA: pairwise key handshake completed (WPA)
Feb 14 22:28:06 router-casa-andrea daemon.info hostapd: wlan0: STA
00:12:0e:b3:c0:b1 IEEE 802.11: authenticated
Feb 14 22:28:06 router-casa-andrea daemon.info hostapd: wlan0: STA
00:12:0e:b3:c0:b1 IEEE 802.11: associated (aid 1)
[...more of the same...]
Feb 14 22:28:26 router-casa-andrea daemon.info hostapd: wlan0: STA
00:12:0e:b3:c0:b1 IEEE 802.11: authenticated
Feb 14 22:28:26 router-casa-andrea daemon.info hostapd: wlan0: STA
00:12:0e:b3:c0:b1 IEEE 802.11: associated (aid 1)
Feb 14 22:28:26 router-casa-andrea daemon.info hostapd: wlan0: STA
00:12:0e:b3:c0:b1 WPA: received EAPOL-Key msg 4/4 in invalid state (7) -
dropped
Feb 14 22:28:28 router-casa-andrea daemon.info hostapd: wlan0: STA
00:12:0e:b3:c0:b1 IEEE 802.11: deauthenticated due to local deauth
request
Feb 14 22:28:29 router-casa-andrea daemon.info hostapd: wlan0: STA
00:12:0e:b3:c0:b1 IEEE 802.11: authenticated
Feb 14 22:28:29 router-casa-andrea daemon.info hostapd: wlan0: STA
00:12:0e:b3:c0:b1 IEEE 802.11: associated (aid 1)
[...more of the same...]
-x-x-x-

Another interesting point: rebooting the Flukso does not help, it must be powered off and on before it is able to join the network again. After rebooting, in fact, the Flukso does not even listen on the wired interface.

Originally I thought that https://dev.openwrt.org/ticket/6070 might be relevant on the Flukso but closer inspection shows that it is more likely the router needs it.

Any other OpenWRT users here? Any comments?

icarus75's picture

Hi Andrea,

I have tested different wifi authentications, i.e. 64-bit and 128-bit WEP, WPA-PSK (TKIP) and WPA2-PSK (AES) between a Fluksometer and a non-OpenWRT stock access point. I haven't noticed any association issues after a disconnection occurred. This wasn't an exhaustive interoperability test, so it would still be interesting to know the root cause of your problem.

Cheers,
Bart.

aboaboit's picture

Tried beta 10.03 (r19944) yesterday evening: while that has some issues with packet size (turned out to be https://dev.openwrt.org/ticket/5173, triggered by old config), as far as the Fluksometer is concerned the problem seems to be gone; I can even disconnect/reassociate via wpa_cli on a ssh connection on wlan and it still holds stable.

mvitale's picture

I had a similar,though not 100%, same problem. I was using a hostapd as access point software.
I was able to make a WPA link and as long as the AP didn't restart everything was stable. As soon as the hostapd was restarted, the re-authentication with the flukso device would fail during association:

extract log hostapd:
wlan0: STA 00:12:0e:b3:c0:85 WPA: sending 1/4 msg of 4-Way Handshake
WPA: Send EAPOL(version=1 secure=0 mic=0 ack=1 install=0 pairwise=8 kde_len=0 keyidx=0 encr=0)
IEEE 802.1X: 00:12:0e:b3:c0:85 TX status - version=2 type=3 length=95 - ack=1
wlan0: STA 00:12:0e:b3:c0:85 WPA: EAPOL-Key timeout
...
WPA: 00:12:0e:b3:c0:85 WPA_PTK entering state DISCONNECT
hostapd_wpa_auth_disconnect: WPA authenticator requests disconnect: STA 00:12:0e:b3:c0:85 reason 2
WPA: 00:12:0e:b3:c0:85 WPA_PTK entering state DISCONNECTED
WPA: 00:12:0e:b3:c0:85 WPA_PTK entering state INITIALIZE
wlan0: STA 00:12:0e:b3:c0:85 IEEE 802.1X: unauthorizing port
wlan0: STA 00:12:0e:b3:c0:85 IEEE 802.11: deauthenticated due to local deauth request

At the end the problem was fixed by adding '60' to the list of 'supported_rates' in the hostapd config file. Apparently the flukso devices configures its wireless interface at 6Mbps (see /etc/init.d/network) and that rate must be also defined in hostapd config file. I still suspect a bug in a driver (hostapd/madwifi/...) since I can't explain why this 6Mbps-rate in the supported_rates is needed for a re-authentication and not for an initial authentication. Anyway, that fixed my problem, maybe it will help/explain yours too.