00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "utils/includes.h"
00018
00019 #include "utils/common.h"
00020 #include "common/ieee802_11_defs.h"
00021 #include "ieee802_11.h"
00022 #include "wpa_auth.h"
00023 #include "sta_info.h"
00024 #include "ap_mlme.h"
00025
00026
00027 #ifndef CONFIG_NO_HOSTAPD_LOGGER
00028 static const char * mlme_auth_alg_str(int alg)
00029 {
00030 switch (alg) {
00031 case WLAN_AUTH_OPEN:
00032 return "OPEN_SYSTEM";
00033 case WLAN_AUTH_SHARED_KEY:
00034 return "SHARED_KEY";
00035 case WLAN_AUTH_FT:
00036 return "FT";
00037 }
00038
00039 return "unknown";
00040 }
00041 #endif
00042
00043
00058 void mlme_authenticate_indication(struct hostapd_data *hapd,
00059 struct sta_info *sta)
00060 {
00061 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
00062 HOSTAPD_LEVEL_DEBUG,
00063 "MLME-AUTHENTICATE.indication(" MACSTR ", %s)",
00064 MAC2STR(sta->addr), mlme_auth_alg_str(sta->auth_alg));
00065 if (sta->auth_alg != WLAN_AUTH_FT && !(sta->flags & WLAN_STA_MFP))
00066 mlme_deletekeys_request(hapd, sta);
00067 }
00068
00069
00082 void mlme_deauthenticate_indication(struct hostapd_data *hapd,
00083 struct sta_info *sta, u16 reason_code)
00084 {
00085 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
00086 HOSTAPD_LEVEL_DEBUG,
00087 "MLME-DEAUTHENTICATE.indication(" MACSTR ", %d)",
00088 MAC2STR(sta->addr), reason_code);
00089 mlme_deletekeys_request(hapd, sta);
00090 }
00091
00092
00105 void mlme_associate_indication(struct hostapd_data *hapd, struct sta_info *sta)
00106 {
00107 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
00108 HOSTAPD_LEVEL_DEBUG,
00109 "MLME-ASSOCIATE.indication(" MACSTR ")",
00110 MAC2STR(sta->addr));
00111 if (sta->auth_alg != WLAN_AUTH_FT)
00112 mlme_deletekeys_request(hapd, sta);
00113 }
00114
00115
00130 void mlme_reassociate_indication(struct hostapd_data *hapd,
00131 struct sta_info *sta)
00132 {
00133 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
00134 HOSTAPD_LEVEL_DEBUG,
00135 "MLME-REASSOCIATE.indication(" MACSTR ")",
00136 MAC2STR(sta->addr));
00137 if (sta->auth_alg != WLAN_AUTH_FT)
00138 mlme_deletekeys_request(hapd, sta);
00139 }
00140
00141
00154 void mlme_disassociate_indication(struct hostapd_data *hapd,
00155 struct sta_info *sta, u16 reason_code)
00156 {
00157 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
00158 HOSTAPD_LEVEL_DEBUG,
00159 "MLME-DISASSOCIATE.indication(" MACSTR ", %d)",
00160 MAC2STR(sta->addr), reason_code);
00161 mlme_deletekeys_request(hapd, sta);
00162 }
00163
00164
00165 void mlme_michaelmicfailure_indication(struct hostapd_data *hapd,
00166 const u8 *addr)
00167 {
00168 hostapd_logger(hapd, addr, HOSTAPD_MODULE_MLME,
00169 HOSTAPD_LEVEL_DEBUG,
00170 "MLME-MichaelMICFailure.indication(" MACSTR ")",
00171 MAC2STR(addr));
00172 }
00173
00174
00175 void mlme_deletekeys_request(struct hostapd_data *hapd, struct sta_info *sta)
00176 {
00177 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
00178 HOSTAPD_LEVEL_DEBUG,
00179 "MLME-DELETEKEYS.request(" MACSTR ")",
00180 MAC2STR(sta->addr));
00181
00182 if (sta->wpa_sm)
00183 wpa_remove_ptk(sta->wpa_sm);
00184 }