]> git.ipfire.org Git - thirdparty/hostap.git/blame - src/ap/drv_callbacks.c
Fix EAP/WPS to PSK transition on reassociation in authenticator
[thirdparty/hostap.git] / src / ap / drv_callbacks.c
CommitLineData
b5b969e9
JM
1/*
2 * hostapd / Callback functions for driver wrappers
3 * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
4 *
0f3d578e
JM
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
b5b969e9
JM
7 */
8
6226e38d 9#include "utils/includes.h"
b5b969e9 10
6226e38d 11#include "utils/common.h"
b5b969e9 12#include "radius/radius.h"
6e6e8c31 13#include "drivers/driver.h"
81f4f619 14#include "common/ieee802_11_defs.h"
c41a1095 15#include "common/ieee802_11_common.h"
bbb921da 16#include "crypto/random.h"
ef796391 17#include "p2p/p2p.h"
54f489be 18#include "wps/wps.h"
6226e38d
JM
19#include "hostapd.h"
20#include "ieee802_11.h"
21#include "sta_info.h"
22#include "accounting.h"
23#include "tkip_countermeasures.h"
6226e38d
JM
24#include "ieee802_1x.h"
25#include "wpa_auth.h"
6226e38d 26#include "wps_hostapd.h"
51e2a27a 27#include "ap_drv_ops.h"
8b06c1ed 28#include "ap_config.h"
b5b969e9
JM
29
30
b5b969e9 31int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
2bb20281 32 const u8 *req_ies, size_t req_ies_len, int reassoc)
b5b969e9
JM
33{
34 struct sta_info *sta;
35 int new_assoc, res;
c41a1095 36 struct ieee802_11_elems elems;
2bb20281
JM
37 const u8 *ie;
38 size_t ielen;
08a74e6a 39 u16 reason = WLAN_REASON_UNSPECIFIED;
b5b969e9 40
68532a9c
JM
41 if (addr == NULL) {
42 /*
43 * This could potentially happen with unexpected event from the
44 * driver wrapper. This was seen at least in one case where the
45 * driver ended up being set to station mode while hostapd was
46 * running, so better make sure we stop processing such an
47 * event here.
48 */
49 wpa_printf(MSG_DEBUG, "hostapd_notif_assoc: Skip event with "
50 "no address");
51 return -1;
52 }
bbb921da 53 random_add_randomness(addr, ETH_ALEN);
68532a9c 54
b5b969e9
JM
55 hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
56 HOSTAPD_LEVEL_INFO, "associated");
57
2bb20281 58 ieee802_11_parse_elems(req_ies, req_ies_len, &elems, 0);
c41a1095
JM
59 if (elems.wps_ie) {
60 ie = elems.wps_ie - 2;
61 ielen = elems.wps_ie_len + 2;
62 wpa_printf(MSG_DEBUG, "STA included WPS IE in (Re)AssocReq");
63 } else if (elems.rsn_ie) {
64 ie = elems.rsn_ie - 2;
65 ielen = elems.rsn_ie_len + 2;
66 wpa_printf(MSG_DEBUG, "STA included RSN IE in (Re)AssocReq");
67 } else if (elems.wpa_ie) {
68 ie = elems.wpa_ie - 2;
69 ielen = elems.wpa_ie_len + 2;
70 wpa_printf(MSG_DEBUG, "STA included WPA IE in (Re)AssocReq");
71 } else {
72 ie = NULL;
73 ielen = 0;
74 wpa_printf(MSG_DEBUG, "STA did not include WPS/RSN/WPA IE in "
75 "(Re)AssocReq");
76 }
77
b5b969e9
JM
78 sta = ap_get_sta(hapd, addr);
79 if (sta) {
80 accounting_sta_stop(hapd, sta);
81 } else {
82 sta = ap_sta_add(hapd, addr);
83 if (sta == NULL)
84 return -1;
85 }
17f6b900 86 sta->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS | WLAN_STA_WPS2);
b5b969e9 87
b305c684
JM
88#ifdef CONFIG_P2P
89 if (elems.p2p) {
90 wpabuf_free(sta->p2p_ie);
2bb20281 91 sta->p2p_ie = ieee802_11_vendor_ie_concat(req_ies, req_ies_len,
b305c684
JM
92 P2P_IE_VENDOR_TYPE);
93 }
94#endif /* CONFIG_P2P */
95
b5b969e9
JM
96 if (hapd->conf->wpa) {
97 if (ie == NULL || ielen == 0) {
633d4469 98#ifdef CONFIG_WPS
b5b969e9
JM
99 if (hapd->conf->wps_state) {
100 wpa_printf(MSG_DEBUG, "STA did not include "
101 "WPA/RSN IE in (Re)Association "
102 "Request - possible WPS use");
103 sta->flags |= WLAN_STA_MAYBE_WPS;
104 goto skip_wpa_check;
105 }
633d4469 106#endif /* CONFIG_WPS */
b5b969e9
JM
107
108 wpa_printf(MSG_DEBUG, "No WPA/RSN IE from STA");
109 return -1;
110 }
633d4469 111#ifdef CONFIG_WPS
b5b969e9
JM
112 if (hapd->conf->wps_state && ie[0] == 0xdd && ie[1] >= 4 &&
113 os_memcmp(ie + 2, "\x00\x50\xf2\x04", 4) == 0) {
17f6b900 114 struct wpabuf *wps;
b5b969e9 115 sta->flags |= WLAN_STA_WPS;
17f6b900
JM
116 wps = ieee802_11_vendor_ie_concat(ie, ielen,
117 WPS_IE_VENDOR_TYPE);
118 if (wps) {
119 if (wps_is_20(wps)) {
120 wpa_printf(MSG_DEBUG, "WPS: STA "
121 "supports WPS 2.0");
122 sta->flags |= WLAN_STA_WPS2;
123 }
124 wpabuf_free(wps);
125 }
b5b969e9
JM
126 goto skip_wpa_check;
127 }
633d4469 128#endif /* CONFIG_WPS */
b5b969e9
JM
129
130 if (sta->wpa_sm == NULL)
131 sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth,
132 sta->addr);
133 if (sta->wpa_sm == NULL) {
134 wpa_printf(MSG_ERROR, "Failed to initialize WPA state "
135 "machine");
136 return -1;
137 }
138 res = wpa_validate_wpa_ie(hapd->wpa_auth, sta->wpa_sm,
139 ie, ielen, NULL, 0);
140 if (res != WPA_IE_OK) {
141 wpa_printf(MSG_DEBUG, "WPA/RSN information element "
142 "rejected? (res %u)", res);
143 wpa_hexdump(MSG_DEBUG, "IE", ie, ielen);
355d36a7 144 if (res == WPA_INVALID_GROUP)
08a74e6a 145 reason = WLAN_REASON_GROUP_CIPHER_NOT_VALID;
355d36a7 146 else if (res == WPA_INVALID_PAIRWISE)
08a74e6a 147 reason = WLAN_REASON_PAIRWISE_CIPHER_NOT_VALID;
355d36a7 148 else if (res == WPA_INVALID_AKMP)
08a74e6a 149 reason = WLAN_REASON_AKMP_NOT_VALID;
355d36a7
AT
150#ifdef CONFIG_IEEE80211W
151 else if (res == WPA_MGMT_FRAME_PROTECTION_VIOLATION)
08a74e6a 152 reason = WLAN_REASON_INVALID_IE;
355d36a7 153 else if (res == WPA_INVALID_MGMT_GROUP_CIPHER)
08a74e6a 154 reason = WLAN_REASON_GROUP_CIPHER_NOT_VALID;
355d36a7
AT
155#endif /* CONFIG_IEEE80211W */
156 else
08a74e6a
JM
157 reason = WLAN_REASON_INVALID_IE;
158 goto fail;
b5b969e9 159 }
a9aca28b 160 } else if (hapd->conf->wps_state) {
633d4469 161#ifdef CONFIG_WPS
17f6b900 162 struct wpabuf *wps;
2bb20281
JM
163 if (req_ies)
164 wps = ieee802_11_vendor_ie_concat(req_ies, req_ies_len,
fa15d405
JM
165 WPS_IE_VENDOR_TYPE);
166 else
167 wps = NULL;
54f489be 168#ifdef CONFIG_WPS_STRICT
fa15d405 169 if (wps && wps_validate_assoc_req(wps) < 0) {
08a74e6a 170 reason = WLAN_REASON_INVALID_IE;
fa15d405 171 wpabuf_free(wps);
08a74e6a 172 goto fail;
54f489be 173 }
54f489be 174#endif /* CONFIG_WPS_STRICT */
fa15d405 175 if (wps) {
a9aca28b 176 sta->flags |= WLAN_STA_WPS;
fa15d405 177 if (wps_is_20(wps)) {
17f6b900
JM
178 wpa_printf(MSG_DEBUG, "WPS: STA supports "
179 "WPS 2.0");
180 sta->flags |= WLAN_STA_WPS2;
181 }
a9aca28b
JM
182 } else
183 sta->flags |= WLAN_STA_MAYBE_WPS;
17f6b900 184 wpabuf_free(wps);
633d4469 185#endif /* CONFIG_WPS */
b5b969e9 186 }
633d4469 187#ifdef CONFIG_WPS
b5b969e9 188skip_wpa_check:
633d4469 189#endif /* CONFIG_WPS */
b5b969e9
JM
190
191 new_assoc = (sta->flags & WLAN_STA_ASSOC) == 0;
192 sta->flags |= WLAN_STA_AUTH | WLAN_STA_ASSOC;
193 wpa_auth_sm_event(sta->wpa_sm, WPA_ASSOC);
194
195 hostapd_new_assoc_sta(hapd, sta, !new_assoc);
196
197 ieee802_1x_notify_port_enabled(sta->eapol_sm, 1);
198
ef796391 199#ifdef CONFIG_P2P
99c01af9
JM
200 if (req_ies) {
201 p2p_group_notif_assoc(hapd->p2p_group, sta->addr,
202 req_ies, req_ies_len);
203 }
ef796391
JM
204#endif /* CONFIG_P2P */
205
b5b969e9 206 return 0;
08a74e6a
JM
207
208fail:
209 hostapd_drv_sta_disassoc(hapd, sta->addr, reason);
210 ap_free_sta(hapd, sta);
211 return -1;
b5b969e9
JM
212}
213
214
215void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr)
216{
217 struct sta_info *sta;
218
83e843e8
JM
219 if (addr == NULL) {
220 /*
221 * This could potentially happen with unexpected event from the
222 * driver wrapper. This was seen at least in one case where the
223 * driver ended up reporting a station mode event while hostapd
224 * was running, so better make sure we stop processing such an
225 * event here.
226 */
227 wpa_printf(MSG_DEBUG, "hostapd_notif_disassoc: Skip event "
228 "with no address");
1f4c7b6b 229 return;
83e843e8
JM
230 }
231
b5b969e9
JM
232 hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
233 HOSTAPD_LEVEL_INFO, "disassociated");
234
235 sta = ap_get_sta(hapd, addr);
236 if (sta == NULL) {
237 wpa_printf(MSG_DEBUG, "Disassociation notification for "
238 "unknown STA " MACSTR, MAC2STR(addr));
239 return;
240 }
241
ae055af4 242 ap_sta_set_authorized(hapd, sta, 0);
b5b969e9
JM
243 sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC);
244 wpa_auth_sm_event(sta->wpa_sm, WPA_DISASSOC);
245 sta->acct_terminate_cause = RADIUS_ACCT_TERMINATE_CAUSE_USER_REQUEST;
246 ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);
247 ap_free_sta(hapd, sta);
248}
249
250
0d7e5a3a
JB
251void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr)
252{
253 struct sta_info *sta = ap_get_sta(hapd, addr);
254
255 if (!sta || !hapd->conf->disassoc_low_ack)
256 return;
257
258 hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
259 HOSTAPD_LEVEL_INFO, "disconnected due to excessive "
260 "missing ACKs");
261 hostapd_drv_sta_disassoc(hapd, addr, WLAN_REASON_DISASSOC_LOW_ACK);
262 if (sta)
263 ap_sta_disassociate(hapd, sta, WLAN_REASON_DISASSOC_LOW_ACK);
264}
265
266
04a85e44 267int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da,
baf513d6
JB
268 const u8 *bssid, const u8 *ie, size_t ie_len,
269 int ssi_signal)
e67b55fb
JM
270{
271 size_t i;
272 int ret = 0;
273
b211f3eb
JM
274 if (sa == NULL || ie == NULL)
275 return -1;
276
277 random_add_randomness(sa, ETH_ALEN);
e67b55fb
JM
278 for (i = 0; hapd->probereq_cb && i < hapd->num_probereq_cb; i++) {
279 if (hapd->probereq_cb[i].cb(hapd->probereq_cb[i].ctx,
baf513d6
JB
280 sa, da, bssid, ie, ie_len,
281 ssi_signal) > 0) {
e67b55fb
JM
282 ret = 1;
283 break;
284 }
285 }
286 return ret;
287}
288
289
f8b1f695
JM
290#ifdef HOSTAPD
291
fe6bdb77 292#ifdef NEED_AP_MLME
f8b1f695 293
f8b1f695
JM
294#define HAPD_BROADCAST ((struct hostapd_data *) -1)
295
296static struct hostapd_data * get_hapd_bssid(struct hostapd_iface *iface,
297 const u8 *bssid)
298{
299 size_t i;
300
301 if (bssid == NULL)
302 return NULL;
303 if (bssid[0] == 0xff && bssid[1] == 0xff && bssid[2] == 0xff &&
304 bssid[3] == 0xff && bssid[4] == 0xff && bssid[5] == 0xff)
305 return HAPD_BROADCAST;
306
307 for (i = 0; i < iface->num_bss; i++) {
308 if (os_memcmp(bssid, iface->bss[i]->own_addr, ETH_ALEN) == 0)
309 return iface->bss[i];
310 }
311
312 return NULL;
313}
314
315
316static void hostapd_rx_from_unknown_sta(struct hostapd_data *hapd,
9b90955e
JB
317 const u8 *bssid, const u8 *addr,
318 int wds)
f8b1f695 319{
9b90955e 320 hapd = get_hapd_bssid(hapd->iface, bssid);
f8b1f695
JM
321 if (hapd == NULL || hapd == HAPD_BROADCAST)
322 return;
323
9b90955e 324 ieee802_11_rx_from_unknown(hapd, addr, wds);
f8b1f695
JM
325}
326
327
2a8b7416 328static void hostapd_mgmt_rx(struct hostapd_data *hapd, struct rx_mgmt *rx_mgmt)
b5b969e9 329{
4b9841d3 330 struct hostapd_iface *iface = hapd->iface;
b57e086c 331 const struct ieee80211_hdr *hdr;
4b9841d3 332 const u8 *bssid;
2a8b7416 333 struct hostapd_frame_info fi;
4b9841d3 334
2a8b7416
JM
335 hdr = (const struct ieee80211_hdr *) rx_mgmt->frame;
336 bssid = get_hdr_bssid(hdr, rx_mgmt->frame_len);
4b9841d3
JM
337 if (bssid == NULL)
338 return;
339
340 hapd = get_hapd_bssid(iface, bssid);
341 if (hapd == NULL) {
342 u16 fc;
343 fc = le_to_host16(hdr->frame_control);
344
345 /*
346 * Drop frames to unknown BSSIDs except for Beacon frames which
347 * could be used to update neighbor information.
348 */
349 if (WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT &&
350 WLAN_FC_GET_STYPE(fc) == WLAN_FC_STYPE_BEACON)
351 hapd = iface->bss[0];
352 else
353 return;
354 }
355
2a8b7416
JM
356 os_memset(&fi, 0, sizeof(fi));
357 fi.datarate = rx_mgmt->datarate;
358 fi.ssi_signal = rx_mgmt->ssi_signal;
359
4b9841d3
JM
360 if (hapd == HAPD_BROADCAST) {
361 size_t i;
362 for (i = 0; i < iface->num_bss; i++)
2a8b7416
JM
363 ieee802_11_mgmt(iface->bss[i], rx_mgmt->frame,
364 rx_mgmt->frame_len, &fi);
4b9841d3 365 } else
2a8b7416 366 ieee802_11_mgmt(hapd, rx_mgmt->frame, rx_mgmt->frame_len, &fi);
bbb921da
JM
367
368 random_add_randomness(&fi, sizeof(fi));
b5b969e9
JM
369}
370
371
9e2704c3
JM
372static void hostapd_rx_action(struct hostapd_data *hapd,
373 struct rx_action *rx_action)
374{
375 struct rx_mgmt rx_mgmt;
376 u8 *buf;
377 struct ieee80211_hdr *hdr;
378
379 wpa_printf(MSG_DEBUG, "EVENT_RX_ACTION DA=" MACSTR " SA=" MACSTR
380 " BSSID=" MACSTR " category=%u",
381 MAC2STR(rx_action->da), MAC2STR(rx_action->sa),
382 MAC2STR(rx_action->bssid), rx_action->category);
383 wpa_hexdump(MSG_MSGDUMP, "Received action frame contents",
384 rx_action->data, rx_action->len);
385
386 buf = os_zalloc(24 + 1 + rx_action->len);
387 if (buf == NULL)
388 return;
389 hdr = (struct ieee80211_hdr *) buf;
390 hdr->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
391 WLAN_FC_STYPE_ACTION);
392 if (rx_action->category == WLAN_ACTION_SA_QUERY) {
393 /*
394 * Assume frame was protected; it would have been dropped if
395 * not.
396 */
397 hdr->frame_control |= host_to_le16(WLAN_FC_ISWEP);
398 }
399 os_memcpy(hdr->addr1, rx_action->da, ETH_ALEN);
400 os_memcpy(hdr->addr2, rx_action->sa, ETH_ALEN);
401 os_memcpy(hdr->addr3, rx_action->bssid, ETH_ALEN);
402 buf[24] = rx_action->category;
403 os_memcpy(buf + 24 + 1, rx_action->data, rx_action->len);
404 os_memset(&rx_mgmt, 0, sizeof(rx_mgmt));
405 rx_mgmt.frame = buf;
406 rx_mgmt.frame_len = 24 + 1 + rx_action->len;
407 hostapd_mgmt_rx(hapd, &rx_mgmt);
408 os_free(buf);
409}
410
411
f8b1f695
JM
412static void hostapd_mgmt_tx_cb(struct hostapd_data *hapd, const u8 *buf,
413 size_t len, u16 stype, int ok)
b5b969e9 414{
4b9841d3
JM
415 struct ieee80211_hdr *hdr;
416 hdr = (struct ieee80211_hdr *) buf;
417 hapd = get_hapd_bssid(hapd->iface, get_hdr_bssid(hdr, len));
418 if (hapd == NULL || hapd == HAPD_BROADCAST)
419 return;
b5b969e9
JM
420 ieee802_11_mgmt_cb(hapd, buf, len, stype, ok);
421}
f82ef4d8 422
f8b1f695 423#endif /* NEED_AP_MLME */
ad1e68e6
JM
424
425
a8e0505b
JM
426static int hostapd_event_new_sta(struct hostapd_data *hapd, const u8 *addr)
427{
428 struct sta_info *sta = ap_get_sta(hapd, addr);
429 if (sta)
430 return 0;
431
432 wpa_printf(MSG_DEBUG, "Data frame from unknown STA " MACSTR
433 " - adding a new STA", MAC2STR(addr));
434 sta = ap_sta_add(hapd, addr);
435 if (sta) {
436 hostapd_new_assoc_sta(hapd, sta, 0);
437 } else {
438 wpa_printf(MSG_DEBUG, "Failed to add STA entry for " MACSTR,
439 MAC2STR(addr));
440 return -1;
441 }
442
443 return 0;
444}
445
446
447static void hostapd_event_eapol_rx(struct hostapd_data *hapd, const u8 *src,
448 const u8 *data, size_t data_len)
449{
450 struct hostapd_iface *iface = hapd->iface;
451 size_t j;
452
453 for (j = 0; j < iface->num_bss; j++) {
454 if (ap_get_sta(iface->bss[j], src)) {
455 hapd = iface->bss[j];
456 break;
457 }
458 }
459
460 ieee802_1x_receive(hapd, src, data, data_len);
461}
462
463
9646a8ab 464void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
ad1e68e6
JM
465 union wpa_event_data *data)
466{
467 struct hostapd_data *hapd = ctx;
74781dfc
JM
468#ifndef CONFIG_NO_STDOUT_DEBUG
469 int level = MSG_DEBUG;
ad1e68e6 470
74781dfc
JM
471 if (event == EVENT_RX_MGMT && data && data->rx_mgmt.frame &&
472 data->rx_mgmt.frame_len >= 24) {
473 const struct ieee80211_hdr *hdr;
474 u16 fc;
475 hdr = (const struct ieee80211_hdr *) data->rx_mgmt.frame;
476 fc = le_to_host16(hdr->frame_control);
477 if (WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT &&
478 WLAN_FC_GET_STYPE(fc) == WLAN_FC_STYPE_BEACON)
479 level = MSG_EXCESSIVE;
480 }
481
482 wpa_dbg(hapd->msg_ctx, level, "Event %s (%d) received",
e26cd1a1 483 event_to_string(event), event);
74781dfc 484#endif /* CONFIG_NO_STDOUT_DEBUG */
e26cd1a1 485
ad1e68e6
JM
486 switch (event) {
487 case EVENT_MICHAEL_MIC_FAILURE:
488 michael_mic_failure(hapd, data->michael_mic_failure.src, 1);
489 break;
490 case EVENT_SCAN_RESULTS:
491 if (hapd->iface->scan_cb)
492 hapd->iface->scan_cb(hapd->iface);
493 break;
08fd8c15 494#ifdef CONFIG_IEEE80211R
f2dab64e 495 case EVENT_FT_RRB_RX:
08fd8c15
JM
496 wpa_ft_rrb_rx(hapd->wpa_auth, data->ft_rrb_rx.src,
497 data->ft_rrb_rx.data, data->ft_rrb_rx.data_len);
498 break;
499#endif /* CONFIG_IEEE80211R */
fcf0f87d 500 case EVENT_WPS_BUTTON_PUSHED:
d601247c 501 hostapd_wps_button_pushed(hapd, NULL);
fcf0f87d 502 break;
f8b1f695
JM
503#ifdef NEED_AP_MLME
504 case EVENT_TX_STATUS:
505 switch (data->tx_status.type) {
506 case WLAN_FC_TYPE_MGMT:
507 hostapd_mgmt_tx_cb(hapd, data->tx_status.data,
508 data->tx_status.data_len,
509 data->tx_status.stype,
510 data->tx_status.ack);
511 break;
512 case WLAN_FC_TYPE_DATA:
513 hostapd_tx_status(hapd, data->tx_status.dst,
514 data->tx_status.data,
515 data->tx_status.data_len,
516 data->tx_status.ack);
517 break;
518 }
519 break;
dd840f79
JB
520 case EVENT_EAPOL_TX_STATUS:
521 hostapd_eapol_tx_status(hapd, data->eapol_tx_status.dst,
522 data->eapol_tx_status.data,
523 data->eapol_tx_status.data_len,
524 data->eapol_tx_status.ack);
525 break;
bcf24348
JB
526 case EVENT_DRIVER_CLIENT_POLL_OK:
527 hostapd_client_poll_ok(hapd, data->client_poll.addr);
528 break;
f8b1f695 529 case EVENT_RX_FROM_UNKNOWN:
9b90955e
JB
530 hostapd_rx_from_unknown_sta(hapd, data->rx_from_unknown.bssid,
531 data->rx_from_unknown.addr,
532 data->rx_from_unknown.wds);
f8b1f695
JM
533 break;
534 case EVENT_RX_MGMT:
2a8b7416 535 hostapd_mgmt_rx(hapd, &data->rx_mgmt);
f8b1f695
JM
536 break;
537#endif /* NEED_AP_MLME */
a0e0d3bb 538 case EVENT_RX_PROBE_REQ:
b211f3eb
JM
539 if (data->rx_probe_req.sa == NULL ||
540 data->rx_probe_req.ie == NULL)
541 break;
a0e0d3bb 542 hostapd_probe_req_rx(hapd, data->rx_probe_req.sa,
04a85e44
JM
543 data->rx_probe_req.da,
544 data->rx_probe_req.bssid,
a0e0d3bb 545 data->rx_probe_req.ie,
baf513d6
JB
546 data->rx_probe_req.ie_len,
547 data->rx_probe_req.ssi_signal);
a0e0d3bb 548 break;
a70a5d6d 549 case EVENT_NEW_STA:
a8e0505b
JM
550 hostapd_event_new_sta(hapd, data->new_sta.addr);
551 break;
552 case EVENT_EAPOL_RX:
553 hostapd_event_eapol_rx(hapd, data->eapol_rx.src,
554 data->eapol_rx.data,
555 data->eapol_rx.data_len);
556 break;
1d041bec
JM
557 case EVENT_ASSOC:
558 hostapd_notif_assoc(hapd, data->assoc_info.addr,
559 data->assoc_info.req_ies,
39b08b5f
SP
560 data->assoc_info.req_ies_len,
561 data->assoc_info.reassoc);
1d041bec
JM
562 break;
563 case EVENT_DISASSOC:
564 if (data)
565 hostapd_notif_disassoc(hapd, data->disassoc_info.addr);
566 break;
567 case EVENT_DEAUTH:
568 if (data)
569 hostapd_notif_disassoc(hapd, data->deauth_info.addr);
570 break;
0d7e5a3a
JB
571 case EVENT_STATION_LOW_ACK:
572 if (!data)
573 break;
574 hostapd_event_sta_low_ack(hapd, data->low_ack.addr);
575 break;
7cc7307d 576#ifdef NEED_AP_MLME
9e2704c3
JM
577 case EVENT_RX_ACTION:
578 if (data->rx_action.da == NULL || data->rx_action.sa == NULL ||
579 data->rx_action.bssid == NULL)
580 break;
581 hostapd_rx_action(hapd, &data->rx_action);
582 break;
7cc7307d 583#endif /* NEED_AP_MLME */
ad1e68e6
JM
584 default:
585 wpa_printf(MSG_DEBUG, "Unknown event %d", event);
586 break;
587 }
588}
f8b1f695
JM
589
590#endif /* HOSTAPD */