]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - src/ap/wpa_auth_glue.c
Allow WPA passphrase to be fetched with RADIUS Tunnel-Password attribute
[thirdparty/hostap.git] / src / ap / wpa_auth_glue.c
index f7999b9f02ecab310f8db66e03492de268510b3d..56bab2366a0c5d489af6d5f6cdd47e41f1589b6b 100644 (file)
 #include "ap_drv_ops.h"
 #include "ap_config.h"
 #include "wpa_auth.h"
+#include "wpa_auth_glue.h"
 
 
 static void hostapd_wpa_auth_conf(struct hostapd_bss_config *conf,
                                  struct wpa_auth_config *wconf)
 {
+       os_memset(wconf, 0, sizeof(*wconf));
        wconf->wpa = conf->wpa;
        wconf->wpa_key_mgmt = conf->wpa_key_mgmt;
        wconf->wpa_pairwise = conf->wpa_pairwise;
@@ -48,6 +50,7 @@ static void hostapd_wpa_auth_conf(struct hostapd_bss_config *conf,
        wconf->peerkey = conf->peerkey;
        wconf->wmm_enabled = conf->wmm_enabled;
        wconf->wmm_uapsd = conf->wmm_uapsd;
+       wconf->disable_pmksa_caching = conf->disable_pmksa_caching;
        wconf->okc = conf->okc;
 #ifdef CONFIG_IEEE80211W
        wconf->ieee80211w = conf->ieee80211w;
@@ -183,6 +186,9 @@ static const u8 * hostapd_wpa_auth_get_psk(void *ctx, const u8 *addr,
                                           const u8 *prev_psk)
 {
        struct hostapd_data *hapd = ctx;
+       struct sta_info *sta = ap_get_sta(hapd, addr);
+       if (sta && sta->psk)
+               return sta->psk;
        return hostapd_get_psk(hapd->conf, addr, prev_psk);
 }
 
@@ -243,8 +249,15 @@ static int hostapd_wpa_auth_send_eapol(void *ctx, const u8 *addr,
                                       int encrypt)
 {
        struct hostapd_data *hapd = ctx;
+       struct sta_info *sta;
+       u32 flags = 0;
+
+       sta = ap_get_sta(hapd, addr);
+       if (sta)
+               flags = hostapd_sta_flags_to_drv(sta->flags);
+
        return hostapd_drv_hapd_send_eapol(hapd, addr, data, data_len,
-                                          encrypt);
+                                          encrypt, flags);
 }
 
 
@@ -376,7 +389,7 @@ static int hostapd_wpa_auth_send_ether(void *ctx, const u8 *dst, u16 proto,
        ret = l2_packet_send(hapd->l2, dst, proto, (u8 *) buf,
                             sizeof(*buf) + data_len);
        os_free(buf);
-       return -1;
+       return ret;
 }
 
 
@@ -406,7 +419,7 @@ static int hostapd_wpa_auth_send_ft_action(void *ctx, const u8 *dst,
        os_memcpy(m->bssid, hapd->own_addr, ETH_ALEN);
        os_memcpy(&m->u, data, data_len);
 
-       res = hostapd_drv_send_mlme(hapd, (u8 *) m, mlen);
+       res = hostapd_drv_send_mlme(hapd, (u8 *) m, mlen, 0);
        os_free(m);
        return res;
 }
@@ -539,6 +552,7 @@ void hostapd_reconfig_wpa(struct hostapd_data *hapd)
 
 void hostapd_deinit_wpa(struct hostapd_data *hapd)
 {
+       ieee80211_tkip_countermeasures_deinit(hapd);
        rsn_preauth_iface_deinit(hapd);
        if (hapd->wpa_auth) {
                wpa_deinit(hapd->wpa_auth);