Fixed a typo in printf -> wpa_printf changes
[wpasupplicant] / hostapd / driver_madwifi.c
index 47dab48..6238976 100644 (file)
 
 #include "hostapd.h"
 #include "driver.h"
-#include "ieee802_1x.h"
 #include "eloop.h"
 #include "priv_netlink.h"
-#include "sta_info.h"
 #include "l2_packet/l2_packet.h"
 
-#include "wpa.h"
-#include "radius/radius.h"
-#include "ieee802_11.h"
-#include "accounting.h"
 #include "common.h"
 #include "wps_hostapd.h"
+#include "ieee802_11_defs.h"
 
 
 struct madwifi_driver_data {
@@ -208,6 +203,7 @@ set80211param(struct madwifi_driver_data *drv, int op, int arg)
        return 0;
 }
 
+#ifndef CONFIG_NO_STDOUT_DEBUG
 static const char *
 ether_sprintf(const u8 *addr)
 {
@@ -219,6 +215,7 @@ ether_sprintf(const u8 *addr)
                snprintf(buf, sizeof(buf), MACSTR, 0,0,0,0,0,0);
        return buf;
 }
+#endif /* CONFIG_NO_STDOUT_DEBUG */
 
 /*
  * Configure WPA parameters.
@@ -795,26 +792,6 @@ static int madwifi_receive_probe_req(struct madwifi_driver_data *drv)
        return ret;
 }
 
-static int
-madwifi_del_sta(struct madwifi_driver_data *drv, u8 addr[IEEE80211_ADDR_LEN])
-{
-       struct hostapd_data *hapd = drv->hapd;
-       struct sta_info *sta;
-
-       hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
-               HOSTAPD_LEVEL_INFO, "disassociated");
-
-       sta = ap_get_sta(hapd, addr);
-       if (sta != NULL) {
-               sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC);
-               wpa_auth_sm_event(sta->wpa_sm, WPA_DISASSOC);
-               sta->acct_terminate_cause = RADIUS_ACCT_TERMINATE_CAUSE_USER_REQUEST;
-               ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);
-               ap_free_sta(hapd, sta);
-       }
-       return 0;
-}
-
 #ifdef CONFIG_WPS
 static int
 madwifi_set_wps_ie(void *priv, const u8 *ie, size_t len, u32 frametype)
@@ -927,7 +904,7 @@ madwifi_wireless_event_wireless_custom(struct madwifi_driver_data *drv,
                }
                pos += 5;
                if (hwaddr_aton(pos, addr) == 0) {
-                       ieee80211_michael_mic_failure(drv->hapd, addr, 1);
+                       hostapd_michael_mic_failure(drv->hapd, addr);
                } else {
                        wpa_printf(MSG_DEBUG,
                                   "MLME-MICHAELMICFAILURE.indication "
@@ -994,7 +971,8 @@ madwifi_wireless_event_wireless(struct madwifi_driver_data *drv,
 
                switch (iwe->cmd) {
                case IWEVEXPIRED:
-                       madwifi_del_sta(drv, (u8 *) iwe->u.addr.sa_data);
+                       hostapd_notif_disassoc(drv->hapd,
+                                              (u8 *) iwe->u.addr.sa_data);
                        break;
                case IWEVREGISTERED:
                        madwifi_new_sta(drv, (u8 *) iwe->u.addr.sa_data);
@@ -1224,7 +1202,7 @@ madwifi_send_eapol(void *priv, const u8 *addr, const u8 *data, size_t data_len,
        eth = (struct l2_ethhdr *) bp;
        memcpy(eth->h_dest, addr, ETH_ALEN);
        memcpy(eth->h_source, own_addr, ETH_ALEN);
-       eth->h_proto = htons(ETH_P_EAPOL);
+       eth->h_proto = host_to_be16(ETH_P_EAPOL);
        memcpy(eth+1, data, data_len);
 
        wpa_hexdump(MSG_MSGDUMP, "TX EAPOL", bp, len);
@@ -1240,18 +1218,9 @@ static void
 handle_read(void *ctx, const u8 *src_addr, const u8 *buf, size_t len)
 {
        struct madwifi_driver_data *drv = ctx;
-       struct hostapd_data *hapd = drv->hapd;
-       struct sta_info *sta;
-
-       sta = ap_get_sta(hapd, src_addr);
-       if (!sta || !(sta->flags & WLAN_STA_ASSOC)) {
-               printf("Data frame from not associated STA %s\n",
-                      ether_sprintf(src_addr));
-               /* XXX cannot happen */
-               return;
-       }
-       ieee802_1x_receive(hapd, src_addr, buf + sizeof(struct l2_ethhdr),
-                          len - sizeof(struct l2_ethhdr));
+       hostapd_eapol_receive(drv->hapd, src_addr,
+                             buf + sizeof(struct l2_ethhdr),
+                             len - sizeof(struct l2_ethhdr));
 }
 
 static void *