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