]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - wpa_supplicant/ap.c
Use driver event, EVENT_EAPOL_RX, for EAPOL frame indication
[thirdparty/hostap.git] / wpa_supplicant / ap.c
index c730127c624a24046f29fda69c82ae2b19e4abcf..ff07d60e0dcd4a29195210612e3f974a4702f049 100644 (file)
  * See README and COPYING for more details.
  */
 
-#include "includes.h"
+#include "utils/includes.h"
 
-#include "common.h"
+#include "utils/common.h"
+#include "common/ieee802_11_defs.h"
 #include "ap/hostapd.h"
-#include "ap/config.h"
+#include "ap/ap_config.h"
 #ifdef NEED_AP_MLME
 #include "ap/ieee802_11.h"
 #endif /* NEED_AP_MLME */
+#include "ap/ieee802_1x.h"
 #include "ap/wps_hostapd.h"
 #include "ap/ctrl_iface_ap.h"
 #include "eap_common/eap_defs.h"
@@ -154,7 +156,17 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
        os_memset(&params, 0, sizeof(params));
        params.ssid = ssid->ssid;
        params.ssid_len = ssid->ssid_len;
-       params.mode = ssid->mode;
+       switch (ssid->mode) {
+       case WPAS_MODE_INFRA:
+               params.mode = IEEE80211_MODE_INFRA;
+               break;
+       case WPAS_MODE_IBSS:
+               params.mode = IEEE80211_MODE_IBSS;
+               break;
+       case WPAS_MODE_AP:
+               params.mode = IEEE80211_MODE_AP;
+               break;
+       }
        params.freq = ssid->frequency;
 
        if (wpa_drv_associate(wpa_s, &params) < 0) {
@@ -223,6 +235,7 @@ void wpa_supplicant_ap_deinit(struct wpa_supplicant *wpa_s)
                return;
 
        hostapd_interface_deinit(wpa_s->ap_iface);
+       hostapd_interface_free(wpa_s->ap_iface);
        wpa_s->ap_iface = NULL;
 }
 
@@ -237,11 +250,12 @@ void ap_tx_status(void *ctx, const u8 *addr,
 }
 
 
-void ap_rx_from_unknown_sta(void *ctx, const struct ieee80211_hdr *hdr,
-                           size_t len)
+void ap_rx_from_unknown_sta(void *ctx, const u8 *frame, size_t len)
 {
 #ifdef NEED_AP_MLME
        struct wpa_supplicant *wpa_s = ctx;
+       const struct ieee80211_hdr *hdr =
+               (const struct ieee80211_hdr *) frame;
        u16 fc = le_to_host16(hdr->frame_control);
        ieee802_11_rx_from_unknown(wpa_s->ap_iface->bss[0], hdr->addr2,
                                   (fc & (WLAN_FC_TODS | WLAN_FC_FROMDS)) ==
@@ -250,12 +264,16 @@ void ap_rx_from_unknown_sta(void *ctx, const struct ieee80211_hdr *hdr,
 }
 
 
-void ap_mgmt_rx(void *ctx, const u8 *buf, size_t len,
-               struct hostapd_frame_info *fi)
+void ap_mgmt_rx(void *ctx, struct rx_mgmt *rx_mgmt)
 {
 #ifdef NEED_AP_MLME
        struct wpa_supplicant *wpa_s = ctx;
-       ieee802_11_mgmt(wpa_s->ap_iface->bss[0], buf, len, fi);
+       struct hostapd_frame_info fi;
+       os_memset(&fi, 0, sizeof(fi));
+       fi.datarate = rx_mgmt->datarate;
+       fi.ssi_signal = rx_mgmt->ssi_signal;
+       ieee802_11_mgmt(wpa_s->ap_iface->bss[0], rx_mgmt->frame,
+                       rx_mgmt->frame_len, &fi);
 #endif /* NEED_AP_MLME */
 }
 
@@ -272,7 +290,7 @@ void ap_mgmt_tx_cb(void *ctx, const u8 *buf, size_t len, u16 stype, int ok)
 void wpa_supplicant_ap_rx_eapol(struct wpa_supplicant *wpa_s,
                                const u8 *src_addr, const u8 *buf, size_t len)
 {
-       hostapd_eapol_receive(wpa_s->ap_iface->bss[0], src_addr, buf, len);
+       ieee802_1x_receive(wpa_s->ap_iface->bss[0], src_addr, buf, len);
 }