AP reboot issue in wpa_supplicant with generic Linux wireless extensions
Morris Lin
morrisl
Tue Jun 19 23:26:48 PDT 2007
Greetings,
When AP reboots, supplicant may take a long time to connect to
the AP in generic Linux wireless extension mode. (when no driver is
specified in command line.)
Environment:
Wireless NIC: dlink AG-660
supplicant : wpa_supplicant 0.57
Driver : madwifi 0.9.3
OS : Fedora 6 (2.6.18-1.2798.fc62.6.18-1.2798.fc6)
Command : wpa_supplicant -i ath0 -c psk.conf -dd
psk.conf
//============================================================
update_config=0
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
ap_scan=1
network={
disabled=0
scan_ssid=1
priority=0
mode=0
ssid="dlink-wpa2"
proto=WPA
auth_alg=OPEN
key_mgmt=WPA-PSK
pairwise=TKIP
group=CCMP TKIP
psk="tropostest"
}
//============================================================
Solution:
Solution 1: Specify driver in command line
Command :wpa_supplicant -i ath0 -Dmadwifi -c
psk.conf -dd
(the date path is different from generic wireless mode)
Solution 2: Code change
//==============================================================
void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
struct wpa_scan_result *bss,
struct wpa_ssid *ssid)
{
u8 wpa_ie[80];
size_t wpa_ie_len;
int use_crypt, ret, i;
int algs = AUTH_ALG_OPEN_SYSTEM;
wpa_cipher cipher_pairwise, cipher_group;
struct wpa_driver_associate_params params;
int wep_keys_set = 0;
struct wpa_driver_capa capa;
int assoc_failed = 0;
-wpa_s->reassociate = 0; <-------remove this line
if (bss) {
wpa_msg(wpa_s, MSG_INFO, "Trying to associate with "
MACSTR
" (SSID='%s' freq=%d MHz)", MAC2STR(bss->bssid),
wpa_ssid_txt(bss->ssid, bss->ssid_len),
bss->freq);
os_memset(wpa_s->bssid, 0, ETH_ALEN);
os_memcpy(wpa_s->pending_bssid, bss->bssid, ETH_ALEN);
} else {
wpa_msg(wpa_s, MSG_INFO, "Trying to associate with SSID
'%s'",
wpa_ssid_txt(ssid->ssid, ssid->ssid_len));
os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
}
//==============================================================
Following is my understanding about this issue.
//======================================================================
=
. Supplicant have to wait for driver to send 0x8b15 event to
notify the ASSOC is done. After that, the 4 way handshake will begin.
. When supplicant reconnect(AP reboots), supplicant will send an
SIOCGIWSCAN ioctl to issue AP SCAN which will block sta_pick_bss from
going to auth state. (coz IEEE80211_SCAN_NOPICK is set)
.But IEEE80211_SCAN_NOPICK will be self clear when it had been
triggered in sta_pick_bss.
. If sta_pick_bss can't go into auth state, then the 0x8b15
won't send to supplicant.
. wpa_supplicant_timeout will occur in every 10 seconds and will
issue SIOCGIWSCAN ioctl which will turn on IEEE80211_SCAN_NOPICK.
. Supplicant will have more chance to keep looping between scan
and timeout.
. solution:
1. If sta_pick_bss can keep running, then
IEEE80211_SCAN_NOPICK will be clear in the first match.
2. And suppliciant won't trigger SIOCGIWSCAN ioctl which
will set IEEE80211_SCAN_NOPICK on again.
3. Then madwifi could have more chance to assoc with the
AP.
. Code fix:
1. Mark wpa_s->reassociate = 0
2. Then supplicant will keep calling
wpa_supplicant_associate instead of let wpa_supplicant_timeout to occur
when match AP is found.
3. SIOCGIWSCAN ioctl won't be trigger.
4. Then madwifi could have more chance to assoc with
selecte AP.
//======================================================================
=
Please correct me if I was wrong!!
More information about the Hostap
mailing list