Set own MAC address in AP data structures
[wpasupplicant] / wpa_supplicant / ap.c
index 0ccdfdd..9c8bdad 100644 (file)
@@ -19,6 +19,9 @@
 #include "../hostapd/hostapd.h"
 #include "../hostapd/config.h"
 #include "../hostapd/driver.h"
+#ifdef NEED_MLME
+#include "../hostapd/ieee802_11.h"
+#endif /* NEED_MLME */
 #include "eap_common/eap_defs.h"
 #include "eap_server/eap_methods.h"
 #include "eap_common/eap_wsc_common.h"
@@ -55,6 +58,7 @@ struct ap_driver_data {
 static void * ap_driver_init(struct hostapd_data *hapd)
 {
        struct ap_driver_data *drv;
+       struct wpa_supplicant *wpa_s = hapd->iface->owner;
 
        drv = os_zalloc(sizeof(struct ap_driver_data));
        if (drv == NULL) {
@@ -63,6 +67,7 @@ static void * ap_driver_init(struct hostapd_data *hapd)
                return NULL;
        }
        drv->hapd = hapd;
+       os_memcpy(hapd->own_addr, wpa_s->own_addr, ETH_ALEN);
 
        return drv;
 }
@@ -152,8 +157,9 @@ static int ap_driver_sta_remove(void *priv, const u8 *addr)
 static int ap_driver_send_mgmt_frame(void *priv, const void *data, size_t len,
                                     int flags)
 {
-       wpa_printf(MSG_DEBUG, "AP TODO: %s", __func__);
-       return -1;
+       struct ap_driver_data *drv = priv;
+       struct wpa_supplicant *wpa_s = drv->hapd->iface->owner;
+       return wpa_drv_send_mlme(wpa_s, data, len);
 }
 
 
@@ -412,3 +418,35 @@ void wpa_supplicant_ap_deinit(struct wpa_supplicant *wpa_s)
        hostapd_interface_deinit(wpa_s->ap_iface);
        wpa_s->ap_iface = NULL;
 }
+
+
+void ap_tx_status(void *ctx, const u8 *addr,
+                 const u8 *buf, size_t len, int ack)
+{
+       struct wpa_supplicant *wpa_s = ctx;
+       hostapd_tx_status(wpa_s->ap_iface->bss[0], addr, buf, len, ack);
+}
+
+
+void ap_rx_from_unknown_sta(void *ctx, const u8 *addr)
+{
+       struct wpa_supplicant *wpa_s = ctx;
+       ap_rx_from_unknown_sta(wpa_s->ap_iface->bss[0], addr);
+}
+
+
+#ifdef NEED_MLME
+void ap_mgmt_rx(void *ctx, u8 *buf, size_t len, u16 stype,
+               struct hostapd_frame_info *fi)
+{
+       struct wpa_supplicant *wpa_s = ctx;
+       ieee802_11_mgmt(wpa_s->ap_iface->bss[0], buf, len, stype, fi);
+}
+
+
+void ap_mgmt_tx_cb(void *ctx, u8 *buf, size_t len, u16 stype, int ok)
+{
+       struct wpa_supplicant *wpa_s = ctx;
+       ieee802_11_mgmt_cb(wpa_s->ap_iface->bss[0], buf, len, stype, ok);
+}
+#endif /* NEED_MLME */