Browse Source

Do not trigger initial scan if there are no enabled networks

This allows wpa_supplicant to be started quickly with an empty
configuration. If an external program wants to fetch scan results
from wpa_supplicant, it will need to request a scan explicitly
in this type of case.
Jouni Malinen 15 years ago
parent
commit
74e259ec7c
1 changed files with 5 additions and 2 deletions
  1. 5 2
      wpa_supplicant/wpa_supplicant.c

+ 5 - 2
wpa_supplicant/wpa_supplicant.c

@@ -1836,8 +1836,11 @@ int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s)
 	wpa_drv_flush_pmkid(wpa_s);
 
 	wpa_s->prev_scan_ssid = WILDCARD_SSID_SCAN;
-	wpa_supplicant_req_scan(wpa_s, interface_count, 100000);
-	interface_count++;
+	if (wpa_supplicant_enabled_networks(wpa_s->conf)) {
+		wpa_supplicant_req_scan(wpa_s, interface_count, 100000);
+		interface_count++;
+	} else
+		wpa_supplicant_set_state(wpa_s, WPA_INACTIVE);
 
 	return 0;
 }