2 * hostapd / IEEE 802.11 MLME
3 * Copyright 2003-2006, Jouni Malinen <j@w1.fi>
4 * Copyright 2003-2004, Instant802 Networks, Inc.
5 * Copyright 2005-2006, Devicescape Software, Inc.
7 * This software may be distributed under the terms of the BSD license.
8 * See README for more details.
11 #include "utils/includes.h"
13 #include "utils/common.h"
14 #include "common/ieee802_11_defs.h"
15 #include "ieee802_11.h"
22 #ifndef CONFIG_NO_HOSTAPD_LOGGER
23 static const char * mlme_auth_alg_str(int alg)
28 case WLAN_AUTH_SHARED_KEY:
36 #endif /* CONFIG_NO_HOSTAPD_LOGGER */
40 * mlme_authenticate_indication - Report the establishment of an authentication
41 * relationship with a specific peer MAC entity
45 * MLME calls this function as a result of the establishment of an
46 * authentication relationship with a specific peer MAC entity that
47 * resulted from an authentication procedure that was initiated by
48 * that specific peer MAC entity.
50 * PeerSTAAddress = sta->addr
51 * AuthenticationType = sta->auth_alg (WLAN_AUTH_OPEN / WLAN_AUTH_SHARED_KEY)
53 void mlme_authenticate_indication(struct hostapd_data *hapd,
56 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
58 "MLME-AUTHENTICATE.indication(" MACSTR ", %s)",
59 MAC2STR(sta->addr), mlme_auth_alg_str(sta->auth_alg));
60 if (sta->auth_alg != WLAN_AUTH_FT &&
61 sta->auth_alg != WLAN_AUTH_FILS_SK &&
62 sta->auth_alg != WLAN_AUTH_FILS_SK_PFS &&
63 sta->auth_alg != WLAN_AUTH_FILS_PK &&
64 !(sta->flags & WLAN_STA_MFP))
65 mlme_deletekeys_request(hapd, sta);
66 ap_sta_clear_disconnect_timeouts(hapd, sta);
71 * mlme_deauthenticate_indication - Report the invalidation of an
72 * authentication relationship with a specific peer MAC entity
75 * @reason_code: ReasonCode from Deauthentication frame
77 * MLME calls this function as a result of the invalidation of an
78 * authentication relationship with a specific peer MAC entity.
80 * PeerSTAAddress = sta->addr
82 void mlme_deauthenticate_indication(struct hostapd_data *hapd,
83 struct sta_info *sta, u16 reason_code)
85 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
87 "MLME-DEAUTHENTICATE.indication(" MACSTR ", %d)",
88 MAC2STR(sta->addr), reason_code);
89 if (!hapd->iface->driver_ap_teardown)
90 mlme_deletekeys_request(hapd, sta);
95 * mlme_associate_indication - Report the establishment of an association with
96 * a specific peer MAC entity
100 * MLME calls this function as a result of the establishment of an
101 * association with a specific peer MAC entity that resulted from an
102 * association procedure that was initiated by that specific peer MAC entity.
104 * PeerSTAAddress = sta->addr
106 void mlme_associate_indication(struct hostapd_data *hapd, struct sta_info *sta)
108 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
110 "MLME-ASSOCIATE.indication(" MACSTR ")",
112 if (sta->auth_alg != WLAN_AUTH_FT &&
113 sta->auth_alg != WLAN_AUTH_FILS_SK &&
114 sta->auth_alg != WLAN_AUTH_FILS_SK_PFS &&
115 sta->auth_alg != WLAN_AUTH_FILS_PK)
116 mlme_deletekeys_request(hapd, sta);
117 ap_sta_clear_disconnect_timeouts(hapd, sta);
122 * mlme_reassociate_indication - Report the establishment of an reassociation
123 * with a specific peer MAC entity
125 * @sta: peer STA data
127 * MLME calls this function as a result of the establishment of an
128 * reassociation with a specific peer MAC entity that resulted from a
129 * reassociation procedure that was initiated by that specific peer MAC entity.
131 * PeerSTAAddress = sta->addr
133 void mlme_reassociate_indication(struct hostapd_data *hapd,
134 struct sta_info *sta)
136 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
138 "MLME-REASSOCIATE.indication(" MACSTR ")",
140 if (sta->auth_alg != WLAN_AUTH_FT &&
141 sta->auth_alg != WLAN_AUTH_FILS_SK &&
142 sta->auth_alg != WLAN_AUTH_FILS_SK_PFS &&
143 sta->auth_alg != WLAN_AUTH_FILS_PK)
144 mlme_deletekeys_request(hapd, sta);
145 ap_sta_clear_disconnect_timeouts(hapd, sta);
150 * mlme_disassociate_indication - Report disassociation with a specific peer
153 * @sta: Peer STA data
154 * @reason_code: ReasonCode from Disassociation frame
156 * MLME calls this function as a result of the invalidation of an association
157 * relationship with a specific peer MAC entity.
159 * PeerSTAAddress = sta->addr
161 void mlme_disassociate_indication(struct hostapd_data *hapd,
162 struct sta_info *sta, u16 reason_code)
164 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
166 "MLME-DISASSOCIATE.indication(" MACSTR ", %d)",
167 MAC2STR(sta->addr), reason_code);
168 mlme_deletekeys_request(hapd, sta);
172 void mlme_michaelmicfailure_indication(struct hostapd_data *hapd,
175 hostapd_logger(hapd, addr, HOSTAPD_MODULE_MLME,
177 "MLME-MichaelMICFailure.indication(" MACSTR ")",
182 void mlme_deletekeys_request(struct hostapd_data *hapd, struct sta_info *sta)
184 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_MLME,
186 "MLME-DELETEKEYS.request(" MACSTR ")",
190 wpa_remove_ptk(sta->wpa_sm);