Fix wpa_supplicant build without CONFIG_WPS and CONFIG_AP
[libeap.git] / wpa_supplicant / events.c
index 4be6475..e9dea15 100644 (file)
@@ -463,6 +463,11 @@ static struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
                }
 
 #ifdef CONFIG_WPS
+               if ((ssid->key_mgmt & WPA_KEY_MGMT_WPS) && e && e->count > 0) {
+                       wpa_printf(MSG_DEBUG, "   skip - blacklisted (WPS)");
+                       continue;
+               }
+
                if (wpa && ssid->ssid_len == 0 &&
                    wpas_wps_ssid_wildcard_ok(wpa_s, ssid, bss))
                        check_ssid = 0;
@@ -627,7 +632,10 @@ void wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
                if (wpas_p2p_notif_pbc_overlap(wpa_s) == 1)
                        return;
 #endif /* CONFIG_P2P */
-               wpa_supplicant_req_new_scan(wpa_s, 10, 0);
+
+#ifdef CONFIG_WPS
+               wpas_wps_cancel(wpa_s);
+#endif /* CONFIG_WPS */
                return;
        }
 
@@ -1800,9 +1808,18 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
        case EVENT_INTERFACE_ENABLED:
                wpa_printf(MSG_DEBUG, "Interface was enabled");
                if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {
-                       wpa_supplicant_set_state(wpa_s,
-                                                WPA_DISCONNECTED);
+#ifdef CONFIG_AP
+                       if (!wpa_s->ap_iface) {
+                               wpa_supplicant_set_state(wpa_s,
+                                                        WPA_DISCONNECTED);
+                               wpa_supplicant_req_scan(wpa_s, 0, 0);
+                       } else
+                               wpa_supplicant_set_state(wpa_s,
+                                                        WPA_COMPLETED);
+#else /* CONFIG_AP */
+                       wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
                        wpa_supplicant_req_scan(wpa_s, 0, 0);
+#endif /* CONFIG_AP */
                }
                break;
        case EVENT_INTERFACE_DISABLED: