wpa_supplicant_scan sometimes will not initiate association when it should

Adrian Caceres adrian at zermattsystems.com
Thu Mar 23 19:55:38 EST 2006


I wrote a small app that controls the supplicant using the same
interface as wpa_cli.

I am running rev 0.4.8 but I believe the same bug is in 0.5.1.

Here is the sequence of events:

- app adds network.  Only one network in list
- app selects network.  Supplicant attempts to connect but driver fails.
wpa_s->prev_scan_ssid ends points to selected network.
- app attempts to reconnect.  In wpa_supplicant_scan, prev_scan_ssid
still points to the only network in the list and the one we want.

	ssid = wpa_s->conf->ssid;
	if (wpa_s->prev_scan_ssid != BROADCAST_SSID_SCAN) {
		while (ssid) {
			if (ssid == wpa_s->prev_scan_ssid) {
				ssid = ssid->next;
>>> this will lead to ssid being set to NULL
				break;
			}
			ssid = ssid->next;
		}
	}
	if (scan_req != 2 && wpa_s->conf->ap_scan == 2) {
		/*
		 * ap_scan=2 mode - try to associate with each SSID instead of
		 * scanning for each scan_ssid=1 network.
		 */
		if (ssid == NULL) {
>>> and we will return here - never requesting the driver to associate
		    return;
        }

The fix I implemented is as follows but I am not sure if this will
work on the other ap_scan modes.

@@ -852,6 +857,9 @@
                        ssid = ssid->next;
                }
        }
+    if (ssid == NULL) {
+           ssid = wpa_s->conf->ssid;
+    }
        while (ssid) {
                if (!ssid->disabled &&
                    (ssid->scan_ssid || wpa_s->conf->ap_scan == 2))



regards

- adrian







More information about the HostAP mailing list