00001
00018 #include "includes.h"
00019
00020 #include "hostapd.h"
00021 #include "ieee802_11.h"
00022 #include "wpa.h"
00023 #include "sta_info.h"
00024 #include "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
00059 void mlme_authenticate_indication(struct hostapd_data *hapd,
00060 struct sta_info *sta)
00061 {
00062 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
00063 HOSTAPD_LEVEL_DEBUG,
00064 "MLME-AUTHENTICATE.indication(" MACSTR ", %s)",
00065 MAC2STR(sta->addr), mlme_auth_alg_str(sta->auth_alg));
00066 if (sta->auth_alg != WLAN_AUTH_FT && !(sta->flags & WLAN_STA_MFP))
00067 mlme_deletekeys_request(hapd, sta);
00068 }
00069
00070
00084 void mlme_deauthenticate_indication(struct hostapd_data *hapd,
00085 struct sta_info *sta, u16 reason_code)
00086 {
00087 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
00088 HOSTAPD_LEVEL_DEBUG,
00089 "MLME-DEAUTHENTICATE.indication(" MACSTR ", %d)",
00090 MAC2STR(sta->addr), reason_code);
00091 mlme_deletekeys_request(hapd, sta);
00092 }
00093
00094
00108 void mlme_associate_indication(struct hostapd_data *hapd, struct sta_info *sta)
00109 {
00110 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
00111 HOSTAPD_LEVEL_DEBUG,
00112 "MLME-ASSOCIATE.indication(" MACSTR ")",
00113 MAC2STR(sta->addr));
00114 if (sta->auth_alg != WLAN_AUTH_FT)
00115 mlme_deletekeys_request(hapd, sta);
00116 }
00117
00118
00134 void mlme_reassociate_indication(struct hostapd_data *hapd,
00135 struct sta_info *sta)
00136 {
00137 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
00138 HOSTAPD_LEVEL_DEBUG,
00139 "MLME-REASSOCIATE.indication(" MACSTR ")",
00140 MAC2STR(sta->addr));
00141 if (sta->auth_alg != WLAN_AUTH_FT)
00142 mlme_deletekeys_request(hapd, sta);
00143 }
00144
00145
00159 void mlme_disassociate_indication(struct hostapd_data *hapd,
00160 struct sta_info *sta, u16 reason_code)
00161 {
00162 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
00163 HOSTAPD_LEVEL_DEBUG,
00164 "MLME-DISASSOCIATE.indication(" MACSTR ", %d)",
00165 MAC2STR(sta->addr), reason_code);
00166 mlme_deletekeys_request(hapd, sta);
00167 }
00168
00169
00170 void mlme_michaelmicfailure_indication(struct hostapd_data *hapd,
00171 const u8 *addr)
00172 {
00173 hostapd_logger(hapd, addr, HOSTAPD_MODULE_MLME,
00174 HOSTAPD_LEVEL_DEBUG,
00175 "MLME-MichaelMICFailure.indication(" MACSTR ")",
00176 MAC2STR(addr));
00177 }
00178
00179
00180 void mlme_deletekeys_request(struct hostapd_data *hapd, struct sta_info *sta)
00181 {
00182 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
00183 HOSTAPD_LEVEL_DEBUG,
00184 "MLME-DELETEKEYS.request(" MACSTR ")",
00185 MAC2STR(sta->addr));
00186
00187 if (sta->wpa_sm)
00188 wpa_remove_ptk(sta->wpa_sm);
00189 }
00190