Disable AP PIN on all interfaces controlled by the same process
[libeap.git] / wpa_supplicant / wpas_glue.c
index b8a867d..4af0cd0 100644 (file)
@@ -31,6 +31,7 @@
 #include "wpas_glue.h"
 #include "wps_supplicant.h"
 #include "bss.h"
+#include "scan.h"
 
 
 #ifndef CONFIG_NO_CONFIG_BLOBS
@@ -343,9 +344,8 @@ static int wpa_supplicant_get_beacon_ie(void *ctx)
 
        /* No WPA/RSN IE found in the cached scan results. Try to get updated
         * scan results from the driver. */
-       if (wpa_supplicant_get_scan_results(wpa_s, NULL, 0) < 0) {
+       if (wpa_supplicant_update_scan_results(wpa_s) < 0)
                return -1;
-       }
 
        return wpa_get_beacon_ie(wpa_s);
 }
@@ -489,6 +489,30 @@ static int wpa_supplicant_send_ft_action(void *ctx, u8 action,
                                                    ies, ies_len);
        return wpa_drv_send_ft_action(wpa_s, action, target_ap, ies, ies_len);
 }
+
+
+static int wpa_supplicant_mark_authenticated(void *ctx, const u8 *target_ap)
+{
+       struct wpa_supplicant *wpa_s = ctx;
+       struct wpa_driver_auth_params params;
+       struct wpa_bss *bss;
+
+       if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_USER_SPACE_MLME)
+               return -1;
+
+       bss = wpa_bss_get_bssid(wpa_s, target_ap);
+       if (bss == NULL)
+               return -1;
+
+       os_memset(&params, 0, sizeof(params));
+       params.bssid = target_ap;
+       params.freq = bss->freq;
+       params.ssid = bss->ssid;
+       params.ssid_len = bss->ssid_len;
+       params.auth_alg = WPA_AUTH_ALG_FT;
+       params.local_state_change = 1;
+       return wpa_drv_authenticate(wpa_s, &params);
+}
 #endif /* CONFIG_IEEE80211R */
 
 #endif /* CONFIG_NO_WPA */
@@ -536,6 +560,14 @@ static void wpa_supplicant_eap_param_needed(void *ctx, const char *field,
 static void wpa_supplicant_port_cb(void *ctx, int authorized)
 {
        struct wpa_supplicant *wpa_s = ctx;
+#ifdef CONFIG_AP
+       if (wpa_s->ap_iface) {
+               wpa_printf(MSG_DEBUG, "AP mode active - skip EAPOL Supplicant "
+                          "port status: %s",
+                          authorized ? "Authorized" : "Unauthorized");
+               return;
+       }
+#endif /* CONFIG_AP */
        wpa_printf(MSG_DEBUG, "EAPOL: Supplicant port status: %s",
                   authorized ? "Authorized" : "Unauthorized");
        wpa_drv_set_supp_port(wpa_s, authorized);
@@ -617,6 +649,7 @@ int wpa_supplicant_init_wpa(struct wpa_supplicant *wpa_s)
 #ifdef CONFIG_IEEE80211R
        ctx->update_ft_ies = wpa_supplicant_update_ft_ies;
        ctx->send_ft_action = wpa_supplicant_send_ft_action;
+       ctx->mark_authenticated = wpa_supplicant_mark_authenticated;
 #endif /* CONFIG_IEEE80211R */
 
        wpa_s->wpa = wpa_sm_init(ctx);