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