[PATCH] hostapd: Fix: A power-saving station can't reconnect

Igor Perminov igor.perminov
Tue Aug 4 02:39:09 PDT 2009


A power-saving station can't reconnect to an AP, because at the moment
of authentication the AP considers the station being in the power-saving
mode.

This problem affects hostapd with the nl80211 driver.
Hostapd version: both 0.6.9 and current from git.
Linux kernel: at least 2.6.30 and current wireless-testing.

Consider the following step-by-step:
1. A station authenticates and associates with the AP and exchanges
traffic.
2. The station indicates to the AP that it is going to sleep.
3. The station device (e.g. a PDA) goes to the stand-by mode (not only
its wi-fi card, but the device itself).
4. The station device wakes up and begins authentication with an
Authentication management frame.

The mac80211 stack at the point 4 "remembers" that the station has gone
to sleep. So, the response frames from hostapd are buffered by mac80211
and the station never receives the authentication response from the AP.

In general, the problem is at the point 4 the AP and the station
misunderstands the state of the station: the AP considers the station is
both authenticated and associated and the station considers itself
neither associated nor authenticated.

To fix this problem hostapd must force the mac80211 stack to "forget"
the station just after receiving an Authentication frame.

Signed-off-by: Igor Perminov <igor.perminov at inbox.ru>
---
 hostapd/ieee802_11.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/hostapd/ieee802_11.c b/hostapd/ieee802_11.c
index 584cd31..7e1814f 100644
--- a/hostapd/ieee802_11.c
+++ b/hostapd/ieee802_11.c
@@ -583,6 +583,13 @@ static void handle_auth(struct hostapd_data *hapd, struct ieee80211_mgmt *mgmt,
 		goto fail;
 	}
 
+	res = hostapd_sta_remove(hapd, mgmt->sa);
+	if (res) {
+		wpa_printf(MSG_DEBUG, "authentication: STA=" MACSTR
+				", hostapd_sta_remove returned %d",
+				MAC2STR(mgmt->sa), res);
+	}
+
 	if (vlan_id > 0) {
 		if (hostapd_get_vlan_id_ifname(hapd->conf->vlan,
 					       sta->vlan_id) == NULL) {





More information about the Hostap mailing list