wpa_auth_glue.c revision f21452aea786ac056eb01f1cbba4f553bd502747
1/* 2 * hostapd / WPA authenticator glue code 3 * Copyright (c) 2002-2012, 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 "common/ieee802_11_defs.h" 13#include "common/sae.h" 14#include "eapol_auth/eapol_auth_sm.h" 15#include "eapol_auth/eapol_auth_sm_i.h" 16#include "eap_server/eap.h" 17#include "l2_packet/l2_packet.h" 18#include "hostapd.h" 19#include "ieee802_1x.h" 20#include "preauth_auth.h" 21#include "sta_info.h" 22#include "tkip_countermeasures.h" 23#include "ap_drv_ops.h" 24#include "ap_config.h" 25#include "wpa_auth.h" 26#include "wpa_auth_glue.h" 27 28 29static void hostapd_wpa_auth_conf(struct hostapd_bss_config *conf, 30 struct hostapd_config *iconf, 31 struct wpa_auth_config *wconf) 32{ 33 os_memset(wconf, 0, sizeof(*wconf)); 34 wconf->wpa = conf->wpa; 35 wconf->wpa_key_mgmt = conf->wpa_key_mgmt; 36 wconf->wpa_pairwise = conf->wpa_pairwise; 37 wconf->wpa_group = conf->wpa_group; 38 wconf->wpa_group_rekey = conf->wpa_group_rekey; 39 wconf->wpa_strict_rekey = conf->wpa_strict_rekey; 40 wconf->wpa_gmk_rekey = conf->wpa_gmk_rekey; 41 wconf->wpa_ptk_rekey = conf->wpa_ptk_rekey; 42 wconf->rsn_pairwise = conf->rsn_pairwise; 43 wconf->rsn_preauth = conf->rsn_preauth; 44 wconf->eapol_version = conf->eapol_version; 45 wconf->peerkey = conf->peerkey; 46 wconf->wmm_enabled = conf->wmm_enabled; 47 wconf->wmm_uapsd = conf->wmm_uapsd; 48 wconf->disable_pmksa_caching = conf->disable_pmksa_caching; 49 wconf->okc = conf->okc; 50#ifdef CONFIG_IEEE80211W 51 wconf->ieee80211w = conf->ieee80211w; 52#endif /* CONFIG_IEEE80211W */ 53#ifdef CONFIG_IEEE80211R 54 wconf->ssid_len = conf->ssid.ssid_len; 55 if (wconf->ssid_len > SSID_LEN) 56 wconf->ssid_len = SSID_LEN; 57 os_memcpy(wconf->ssid, conf->ssid.ssid, wconf->ssid_len); 58 os_memcpy(wconf->mobility_domain, conf->mobility_domain, 59 MOBILITY_DOMAIN_ID_LEN); 60 if (conf->nas_identifier && 61 os_strlen(conf->nas_identifier) <= FT_R0KH_ID_MAX_LEN) { 62 wconf->r0_key_holder_len = os_strlen(conf->nas_identifier); 63 os_memcpy(wconf->r0_key_holder, conf->nas_identifier, 64 wconf->r0_key_holder_len); 65 } 66 os_memcpy(wconf->r1_key_holder, conf->r1_key_holder, FT_R1KH_ID_LEN); 67 wconf->r0_key_lifetime = conf->r0_key_lifetime; 68 wconf->reassociation_deadline = conf->reassociation_deadline; 69 wconf->r0kh_list = conf->r0kh_list; 70 wconf->r1kh_list = conf->r1kh_list; 71 wconf->pmk_r1_push = conf->pmk_r1_push; 72 wconf->ft_over_ds = conf->ft_over_ds; 73#endif /* CONFIG_IEEE80211R */ 74#ifdef CONFIG_HS20 75 wconf->disable_gtk = conf->disable_dgaf; 76 if (conf->osen) { 77 wconf->disable_gtk = 1; 78 wconf->wpa = WPA_PROTO_OSEN; 79 wconf->wpa_key_mgmt = WPA_KEY_MGMT_OSEN; 80 wconf->wpa_pairwise = 0; 81 wconf->wpa_group = WPA_CIPHER_CCMP; 82 wconf->rsn_pairwise = WPA_CIPHER_CCMP; 83 wconf->rsn_preauth = 0; 84 wconf->disable_pmksa_caching = 1; 85#ifdef CONFIG_IEEE80211W 86 wconf->ieee80211w = 1; 87#endif /* CONFIG_IEEE80211W */ 88 } 89#endif /* CONFIG_HS20 */ 90#ifdef CONFIG_TESTING_OPTIONS 91 wconf->corrupt_gtk_rekey_mic_probability = 92 iconf->corrupt_gtk_rekey_mic_probability; 93#endif /* CONFIG_TESTING_OPTIONS */ 94#ifdef CONFIG_P2P 95 os_memcpy(wconf->ip_addr_go, conf->ip_addr_go, 4); 96 os_memcpy(wconf->ip_addr_mask, conf->ip_addr_mask, 4); 97 os_memcpy(wconf->ip_addr_start, conf->ip_addr_start, 4); 98 os_memcpy(wconf->ip_addr_end, conf->ip_addr_end, 4); 99#endif /* CONFIG_P2P */ 100} 101 102 103static void hostapd_wpa_auth_logger(void *ctx, const u8 *addr, 104 logger_level level, const char *txt) 105{ 106#ifndef CONFIG_NO_HOSTAPD_LOGGER 107 struct hostapd_data *hapd = ctx; 108 int hlevel; 109 110 switch (level) { 111 case LOGGER_WARNING: 112 hlevel = HOSTAPD_LEVEL_WARNING; 113 break; 114 case LOGGER_INFO: 115 hlevel = HOSTAPD_LEVEL_INFO; 116 break; 117 case LOGGER_DEBUG: 118 default: 119 hlevel = HOSTAPD_LEVEL_DEBUG; 120 break; 121 } 122 123 hostapd_logger(hapd, addr, HOSTAPD_MODULE_WPA, hlevel, "%s", txt); 124#endif /* CONFIG_NO_HOSTAPD_LOGGER */ 125} 126 127 128static void hostapd_wpa_auth_disconnect(void *ctx, const u8 *addr, 129 u16 reason) 130{ 131 struct hostapd_data *hapd = ctx; 132 wpa_printf(MSG_DEBUG, "%s: WPA authenticator requests disconnect: " 133 "STA " MACSTR " reason %d", 134 __func__, MAC2STR(addr), reason); 135 ap_sta_disconnect(hapd, NULL, addr, reason); 136} 137 138 139static int hostapd_wpa_auth_mic_failure_report(void *ctx, const u8 *addr) 140{ 141 struct hostapd_data *hapd = ctx; 142 return michael_mic_failure(hapd, addr, 0); 143} 144 145 146static void hostapd_wpa_auth_set_eapol(void *ctx, const u8 *addr, 147 wpa_eapol_variable var, int value) 148{ 149 struct hostapd_data *hapd = ctx; 150 struct sta_info *sta = ap_get_sta(hapd, addr); 151 if (sta == NULL) 152 return; 153 switch (var) { 154 case WPA_EAPOL_portEnabled: 155 ieee802_1x_notify_port_enabled(sta->eapol_sm, value); 156 break; 157 case WPA_EAPOL_portValid: 158 ieee802_1x_notify_port_valid(sta->eapol_sm, value); 159 break; 160 case WPA_EAPOL_authorized: 161 ieee802_1x_set_sta_authorized(hapd, sta, value); 162 break; 163 case WPA_EAPOL_portControl_Auto: 164 if (sta->eapol_sm) 165 sta->eapol_sm->portControl = Auto; 166 break; 167 case WPA_EAPOL_keyRun: 168 if (sta->eapol_sm) 169 sta->eapol_sm->keyRun = value ? TRUE : FALSE; 170 break; 171 case WPA_EAPOL_keyAvailable: 172 if (sta->eapol_sm) 173 sta->eapol_sm->eap_if->eapKeyAvailable = 174 value ? TRUE : FALSE; 175 break; 176 case WPA_EAPOL_keyDone: 177 if (sta->eapol_sm) 178 sta->eapol_sm->keyDone = value ? TRUE : FALSE; 179 break; 180 case WPA_EAPOL_inc_EapolFramesTx: 181 if (sta->eapol_sm) 182 sta->eapol_sm->dot1xAuthEapolFramesTx++; 183 break; 184 } 185} 186 187 188static int hostapd_wpa_auth_get_eapol(void *ctx, const u8 *addr, 189 wpa_eapol_variable var) 190{ 191 struct hostapd_data *hapd = ctx; 192 struct sta_info *sta = ap_get_sta(hapd, addr); 193 if (sta == NULL || sta->eapol_sm == NULL) 194 return -1; 195 switch (var) { 196 case WPA_EAPOL_keyRun: 197 return sta->eapol_sm->keyRun; 198 case WPA_EAPOL_keyAvailable: 199 return sta->eapol_sm->eap_if->eapKeyAvailable; 200 default: 201 return -1; 202 } 203} 204 205 206static const u8 * hostapd_wpa_auth_get_psk(void *ctx, const u8 *addr, 207 const u8 *p2p_dev_addr, 208 const u8 *prev_psk) 209{ 210 struct hostapd_data *hapd = ctx; 211 struct sta_info *sta = ap_get_sta(hapd, addr); 212 const u8 *psk; 213 214#ifdef CONFIG_SAE 215 if (sta && sta->auth_alg == WLAN_AUTH_SAE) { 216 if (!sta->sae || prev_psk) 217 return NULL; 218 return sta->sae->pmk; 219 } 220#endif /* CONFIG_SAE */ 221 222 psk = hostapd_get_psk(hapd->conf, addr, p2p_dev_addr, prev_psk); 223 /* 224 * This is about to iterate over all psks, prev_psk gives the last 225 * returned psk which should not be returned again. 226 * logic list (all hostapd_get_psk; all sta->psk) 227 */ 228 if (sta && sta->psk && !psk) { 229 struct hostapd_sta_wpa_psk_short *pos; 230 psk = sta->psk->psk; 231 for (pos = sta->psk; pos; pos = pos->next) { 232 if (pos->psk == prev_psk) { 233 psk = pos->next ? pos->next->psk : NULL; 234 break; 235 } 236 } 237 } 238 return psk; 239} 240 241 242static int hostapd_wpa_auth_get_msk(void *ctx, const u8 *addr, u8 *msk, 243 size_t *len) 244{ 245 struct hostapd_data *hapd = ctx; 246 const u8 *key; 247 size_t keylen; 248 struct sta_info *sta; 249 250 sta = ap_get_sta(hapd, addr); 251 if (sta == NULL) 252 return -1; 253 254 key = ieee802_1x_get_key(sta->eapol_sm, &keylen); 255 if (key == NULL) 256 return -1; 257 258 if (keylen > *len) 259 keylen = *len; 260 os_memcpy(msk, key, keylen); 261 *len = keylen; 262 263 return 0; 264} 265 266 267static int hostapd_wpa_auth_set_key(void *ctx, int vlan_id, enum wpa_alg alg, 268 const u8 *addr, int idx, u8 *key, 269 size_t key_len) 270{ 271 struct hostapd_data *hapd = ctx; 272 const char *ifname = hapd->conf->iface; 273 274 if (vlan_id > 0) { 275 ifname = hostapd_get_vlan_id_ifname(hapd->conf->vlan, vlan_id); 276 if (ifname == NULL) 277 return -1; 278 } 279 280 return hostapd_drv_set_key(ifname, hapd, alg, addr, idx, 1, NULL, 0, 281 key, key_len); 282} 283 284 285static int hostapd_wpa_auth_get_seqnum(void *ctx, const u8 *addr, int idx, 286 u8 *seq) 287{ 288 struct hostapd_data *hapd = ctx; 289 return hostapd_get_seqnum(hapd->conf->iface, hapd, addr, idx, seq); 290} 291 292 293static int hostapd_wpa_auth_send_eapol(void *ctx, const u8 *addr, 294 const u8 *data, size_t data_len, 295 int encrypt) 296{ 297 struct hostapd_data *hapd = ctx; 298 struct sta_info *sta; 299 u32 flags = 0; 300 301 sta = ap_get_sta(hapd, addr); 302 if (sta) 303 flags = hostapd_sta_flags_to_drv(sta->flags); 304 305 return hostapd_drv_hapd_send_eapol(hapd, addr, data, data_len, 306 encrypt, flags); 307} 308 309 310static int hostapd_wpa_auth_for_each_sta( 311 void *ctx, int (*cb)(struct wpa_state_machine *sm, void *ctx), 312 void *cb_ctx) 313{ 314 struct hostapd_data *hapd = ctx; 315 struct sta_info *sta; 316 317 for (sta = hapd->sta_list; sta; sta = sta->next) { 318 if (sta->wpa_sm && cb(sta->wpa_sm, cb_ctx)) 319 return 1; 320 } 321 return 0; 322} 323 324 325struct wpa_auth_iface_iter_data { 326 int (*cb)(struct wpa_authenticator *sm, void *ctx); 327 void *cb_ctx; 328}; 329 330static int wpa_auth_iface_iter(struct hostapd_iface *iface, void *ctx) 331{ 332 struct wpa_auth_iface_iter_data *data = ctx; 333 size_t i; 334 for (i = 0; i < iface->num_bss; i++) { 335 if (iface->bss[i]->wpa_auth && 336 data->cb(iface->bss[i]->wpa_auth, data->cb_ctx)) 337 return 1; 338 } 339 return 0; 340} 341 342 343static int hostapd_wpa_auth_for_each_auth( 344 void *ctx, int (*cb)(struct wpa_authenticator *sm, void *ctx), 345 void *cb_ctx) 346{ 347 struct hostapd_data *hapd = ctx; 348 struct wpa_auth_iface_iter_data data; 349 if (hapd->iface->interfaces == NULL || 350 hapd->iface->interfaces->for_each_interface == NULL) 351 return -1; 352 data.cb = cb; 353 data.cb_ctx = cb_ctx; 354 return hapd->iface->interfaces->for_each_interface( 355 hapd->iface->interfaces, wpa_auth_iface_iter, &data); 356} 357 358 359#ifdef CONFIG_IEEE80211R 360 361struct wpa_auth_ft_iface_iter_data { 362 struct hostapd_data *src_hapd; 363 const u8 *dst; 364 const u8 *data; 365 size_t data_len; 366}; 367 368 369static int hostapd_wpa_auth_ft_iter(struct hostapd_iface *iface, void *ctx) 370{ 371 struct wpa_auth_ft_iface_iter_data *idata = ctx; 372 struct hostapd_data *hapd; 373 size_t j; 374 375 for (j = 0; j < iface->num_bss; j++) { 376 hapd = iface->bss[j]; 377 if (hapd == idata->src_hapd) 378 continue; 379 if (os_memcmp(hapd->own_addr, idata->dst, ETH_ALEN) == 0) { 380 wpa_printf(MSG_DEBUG, "FT: Send RRB data directly to " 381 "locally managed BSS " MACSTR "@%s -> " 382 MACSTR "@%s", 383 MAC2STR(idata->src_hapd->own_addr), 384 idata->src_hapd->conf->iface, 385 MAC2STR(hapd->own_addr), hapd->conf->iface); 386 wpa_ft_rrb_rx(hapd->wpa_auth, 387 idata->src_hapd->own_addr, 388 idata->data, idata->data_len); 389 return 1; 390 } 391 } 392 393 return 0; 394} 395 396#endif /* CONFIG_IEEE80211R */ 397 398 399static int hostapd_wpa_auth_send_ether(void *ctx, const u8 *dst, u16 proto, 400 const u8 *data, size_t data_len) 401{ 402 struct hostapd_data *hapd = ctx; 403 struct l2_ethhdr *buf; 404 int ret; 405 406#ifdef CONFIG_IEEE80211R 407 if (proto == ETH_P_RRB && hapd->iface->interfaces && 408 hapd->iface->interfaces->for_each_interface) { 409 int res; 410 struct wpa_auth_ft_iface_iter_data idata; 411 idata.src_hapd = hapd; 412 idata.dst = dst; 413 idata.data = data; 414 idata.data_len = data_len; 415 res = hapd->iface->interfaces->for_each_interface( 416 hapd->iface->interfaces, hostapd_wpa_auth_ft_iter, 417 &idata); 418 if (res == 1) 419 return data_len; 420 } 421#endif /* CONFIG_IEEE80211R */ 422 423 if (hapd->driver && hapd->driver->send_ether) 424 return hapd->driver->send_ether(hapd->drv_priv, dst, 425 hapd->own_addr, proto, 426 data, data_len); 427 if (hapd->l2 == NULL) 428 return -1; 429 430 buf = os_malloc(sizeof(*buf) + data_len); 431 if (buf == NULL) 432 return -1; 433 os_memcpy(buf->h_dest, dst, ETH_ALEN); 434 os_memcpy(buf->h_source, hapd->own_addr, ETH_ALEN); 435 buf->h_proto = host_to_be16(proto); 436 os_memcpy(buf + 1, data, data_len); 437 ret = l2_packet_send(hapd->l2, dst, proto, (u8 *) buf, 438 sizeof(*buf) + data_len); 439 os_free(buf); 440 return ret; 441} 442 443 444#ifdef CONFIG_IEEE80211R 445 446static int hostapd_wpa_auth_send_ft_action(void *ctx, const u8 *dst, 447 const u8 *data, size_t data_len) 448{ 449 struct hostapd_data *hapd = ctx; 450 int res; 451 struct ieee80211_mgmt *m; 452 size_t mlen; 453 struct sta_info *sta; 454 455 sta = ap_get_sta(hapd, dst); 456 if (sta == NULL || sta->wpa_sm == NULL) 457 return -1; 458 459 m = os_zalloc(sizeof(*m) + data_len); 460 if (m == NULL) 461 return -1; 462 mlen = ((u8 *) &m->u - (u8 *) m) + data_len; 463 m->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT, 464 WLAN_FC_STYPE_ACTION); 465 os_memcpy(m->da, dst, ETH_ALEN); 466 os_memcpy(m->sa, hapd->own_addr, ETH_ALEN); 467 os_memcpy(m->bssid, hapd->own_addr, ETH_ALEN); 468 os_memcpy(&m->u, data, data_len); 469 470 res = hostapd_drv_send_mlme(hapd, (u8 *) m, mlen, 0); 471 os_free(m); 472 return res; 473} 474 475 476static struct wpa_state_machine * 477hostapd_wpa_auth_add_sta(void *ctx, const u8 *sta_addr) 478{ 479 struct hostapd_data *hapd = ctx; 480 struct sta_info *sta; 481 482 if (hostapd_add_sta_node(hapd, sta_addr, WLAN_AUTH_FT) < 0) 483 return NULL; 484 485 sta = ap_sta_add(hapd, sta_addr); 486 if (sta == NULL) 487 return NULL; 488 if (sta->wpa_sm) { 489 sta->auth_alg = WLAN_AUTH_FT; 490 return sta->wpa_sm; 491 } 492 493 sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth, sta->addr, NULL); 494 if (sta->wpa_sm == NULL) { 495 ap_free_sta(hapd, sta); 496 return NULL; 497 } 498 sta->auth_alg = WLAN_AUTH_FT; 499 500 return sta->wpa_sm; 501} 502 503 504static void hostapd_rrb_receive(void *ctx, const u8 *src_addr, const u8 *buf, 505 size_t len) 506{ 507 struct hostapd_data *hapd = ctx; 508 struct l2_ethhdr *ethhdr; 509 if (len < sizeof(*ethhdr)) 510 return; 511 ethhdr = (struct l2_ethhdr *) buf; 512 wpa_printf(MSG_DEBUG, "FT: RRB received packet " MACSTR " -> " 513 MACSTR, MAC2STR(ethhdr->h_source), MAC2STR(ethhdr->h_dest)); 514 wpa_ft_rrb_rx(hapd->wpa_auth, ethhdr->h_source, buf + sizeof(*ethhdr), 515 len - sizeof(*ethhdr)); 516} 517 518 519static int hostapd_wpa_auth_add_tspec(void *ctx, const u8 *sta_addr, 520 u8 *tspec_ie, size_t tspec_ielen) 521{ 522 struct hostapd_data *hapd = ctx; 523 return hostapd_add_tspec(hapd, sta_addr, tspec_ie, tspec_ielen); 524} 525 526#endif /* CONFIG_IEEE80211R */ 527 528 529int hostapd_setup_wpa(struct hostapd_data *hapd) 530{ 531 struct wpa_auth_config _conf; 532 struct wpa_auth_callbacks cb; 533 const u8 *wpa_ie; 534 size_t wpa_ie_len; 535 536 hostapd_wpa_auth_conf(hapd->conf, hapd->iconf, &_conf); 537 if (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_EAPOL_TX_STATUS) 538 _conf.tx_status = 1; 539 if (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_MLME) 540 _conf.ap_mlme = 1; 541 os_memset(&cb, 0, sizeof(cb)); 542 cb.ctx = hapd; 543 cb.logger = hostapd_wpa_auth_logger; 544 cb.disconnect = hostapd_wpa_auth_disconnect; 545 cb.mic_failure_report = hostapd_wpa_auth_mic_failure_report; 546 cb.set_eapol = hostapd_wpa_auth_set_eapol; 547 cb.get_eapol = hostapd_wpa_auth_get_eapol; 548 cb.get_psk = hostapd_wpa_auth_get_psk; 549 cb.get_msk = hostapd_wpa_auth_get_msk; 550 cb.set_key = hostapd_wpa_auth_set_key; 551 cb.get_seqnum = hostapd_wpa_auth_get_seqnum; 552 cb.send_eapol = hostapd_wpa_auth_send_eapol; 553 cb.for_each_sta = hostapd_wpa_auth_for_each_sta; 554 cb.for_each_auth = hostapd_wpa_auth_for_each_auth; 555 cb.send_ether = hostapd_wpa_auth_send_ether; 556#ifdef CONFIG_IEEE80211R 557 cb.send_ft_action = hostapd_wpa_auth_send_ft_action; 558 cb.add_sta = hostapd_wpa_auth_add_sta; 559 cb.add_tspec = hostapd_wpa_auth_add_tspec; 560#endif /* CONFIG_IEEE80211R */ 561 hapd->wpa_auth = wpa_init(hapd->own_addr, &_conf, &cb); 562 if (hapd->wpa_auth == NULL) { 563 wpa_printf(MSG_ERROR, "WPA initialization failed."); 564 return -1; 565 } 566 567 if (hostapd_set_privacy(hapd, 1)) { 568 wpa_printf(MSG_ERROR, "Could not set PrivacyInvoked " 569 "for interface %s", hapd->conf->iface); 570 return -1; 571 } 572 573 wpa_ie = wpa_auth_get_wpa_ie(hapd->wpa_auth, &wpa_ie_len); 574 if (hostapd_set_generic_elem(hapd, wpa_ie, wpa_ie_len)) { 575 wpa_printf(MSG_ERROR, "Failed to configure WPA IE for " 576 "the kernel driver."); 577 return -1; 578 } 579 580 if (rsn_preauth_iface_init(hapd)) { 581 wpa_printf(MSG_ERROR, "Initialization of RSN " 582 "pre-authentication failed."); 583 return -1; 584 } 585 586#ifdef CONFIG_IEEE80211R 587 if (!hostapd_drv_none(hapd)) { 588 hapd->l2 = l2_packet_init(hapd->conf->bridge[0] ? 589 hapd->conf->bridge : 590 hapd->conf->iface, NULL, ETH_P_RRB, 591 hostapd_rrb_receive, hapd, 1); 592 if (hapd->l2 == NULL && 593 (hapd->driver == NULL || 594 hapd->driver->send_ether == NULL)) { 595 wpa_printf(MSG_ERROR, "Failed to open l2_packet " 596 "interface"); 597 return -1; 598 } 599 } 600#endif /* CONFIG_IEEE80211R */ 601 602 return 0; 603 604} 605 606 607void hostapd_reconfig_wpa(struct hostapd_data *hapd) 608{ 609 struct wpa_auth_config wpa_auth_conf; 610 hostapd_wpa_auth_conf(hapd->conf, hapd->iconf, &wpa_auth_conf); 611 wpa_reconfig(hapd->wpa_auth, &wpa_auth_conf); 612} 613 614 615void hostapd_deinit_wpa(struct hostapd_data *hapd) 616{ 617 ieee80211_tkip_countermeasures_deinit(hapd); 618 rsn_preauth_iface_deinit(hapd); 619 if (hapd->wpa_auth) { 620 wpa_deinit(hapd->wpa_auth); 621 hapd->wpa_auth = NULL; 622 623 if (hostapd_set_privacy(hapd, 0)) { 624 wpa_printf(MSG_DEBUG, "Could not disable " 625 "PrivacyInvoked for interface %s", 626 hapd->conf->iface); 627 } 628 629 if (hostapd_set_generic_elem(hapd, (u8 *) "", 0)) { 630 wpa_printf(MSG_DEBUG, "Could not remove generic " 631 "information element from interface %s", 632 hapd->conf->iface); 633 } 634 } 635 ieee802_1x_deinit(hapd); 636 637#ifdef CONFIG_IEEE80211R 638 l2_packet_deinit(hapd->l2); 639 hapd->l2 = NULL; 640#endif /* CONFIG_IEEE80211R */ 641} 642