00001 00018 #include "includes.h" 00019 00020 #include "hostapd.h" 00021 #include "ieee802_11.h" 00022 #include "sta_info.h" 00023 #include "wpa.h" 00024 #include "mlme.h" 00025 00026 00027 static const char * mlme_auth_alg_str(int alg) 00028 { 00029 switch (alg) { 00030 case WLAN_AUTH_OPEN: 00031 return "OPEN_SYSTEM"; 00032 case WLAN_AUTH_SHARED_KEY: 00033 return "SHARED_KEY"; 00034 } 00035 00036 return "unknown"; 00037 } 00038 00039 00055 void mlme_authenticate_indication(struct hostapd_data *hapd, 00056 struct sta_info *sta) 00057 { 00058 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME, 00059 HOSTAPD_LEVEL_DEBUG, 00060 "MLME-AUTHENTICATE.indication(" MACSTR ", %s)", 00061 MAC2STR(sta->addr), mlme_auth_alg_str(sta->auth_alg)); 00062 mlme_deletekeys_request(hapd, sta); 00063 } 00064 00065 00079 void mlme_deauthenticate_indication(struct hostapd_data *hapd, 00080 struct sta_info *sta, u16 reason_code) 00081 { 00082 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME, 00083 HOSTAPD_LEVEL_DEBUG, 00084 "MLME-DEAUTHENTICATE.indication(" MACSTR ", %d)", 00085 MAC2STR(sta->addr), reason_code); 00086 mlme_deletekeys_request(hapd, sta); 00087 } 00088 00089 00103 void mlme_associate_indication(struct hostapd_data *hapd, struct sta_info *sta) 00104 { 00105 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME, 00106 HOSTAPD_LEVEL_DEBUG, 00107 "MLME-ASSOCIATE.indication(" MACSTR ")", 00108 MAC2STR(sta->addr)); 00109 mlme_deletekeys_request(hapd, sta); 00110 } 00111 00112 00128 void mlme_reassociate_indication(struct hostapd_data *hapd, 00129 struct sta_info *sta) 00130 { 00131 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME, 00132 HOSTAPD_LEVEL_DEBUG, 00133 "MLME-REASSOCIATE.indication(" MACSTR ")", 00134 MAC2STR(sta->addr)); 00135 mlme_deletekeys_request(hapd, sta); 00136 } 00137 00138 00152 void mlme_disassociate_indication(struct hostapd_data *hapd, 00153 struct sta_info *sta, u16 reason_code) 00154 { 00155 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME, 00156 HOSTAPD_LEVEL_DEBUG, 00157 "MLME-DISASSOCIATE.indication(" MACSTR ", %d)", 00158 MAC2STR(sta->addr), reason_code); 00159 mlme_deletekeys_request(hapd, sta); 00160 } 00161 00162 00163 void mlme_michaelmicfailure_indication(struct hostapd_data *hapd, 00164 const u8 *addr) 00165 { 00166 hostapd_logger(hapd, addr, HOSTAPD_MODULE_MLME, 00167 HOSTAPD_LEVEL_DEBUG, 00168 "MLME-MichaelMICFailure.indication(" MACSTR ")", 00169 MAC2STR(addr)); 00170 } 00171 00172 00173 void mlme_deletekeys_request(struct hostapd_data *hapd, struct sta_info *sta) 00174 { 00175 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME, 00176 HOSTAPD_LEVEL_DEBUG, 00177 "MLME-DELETEKEYS.request(" MACSTR ")", 00178 MAC2STR(sta->addr)); 00179 00180 if (sta->wpa_sm) 00181 wpa_remove_ptk(sta->wpa_sm); 00182 } 00183