2 * hostapd / WPA authenticator glue code
3 * Copyright (c) 2002-2012, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
9 #include "utils/includes.h"
11 #include "utils/common.h"
12 #include "utils/eloop.h"
13 #include "utils/list.h"
14 #include "common/ieee802_11_defs.h"
15 #include "common/sae.h"
16 #include "common/wpa_ctrl.h"
17 #include "crypto/sha1.h"
18 #include "eapol_auth/eapol_auth_sm.h"
19 #include "eapol_auth/eapol_auth_sm_i.h"
20 #include "eap_server/eap.h"
21 #include "l2_packet/l2_packet.h"
22 #include "eth_p_oui.h"
24 #include "ieee802_1x.h"
25 #include "preauth_auth.h"
27 #include "tkip_countermeasures.h"
28 #include "ap_drv_ops.h"
29 #include "ap_config.h"
30 #include "ieee802_11.h"
31 #include "pmksa_cache_auth.h"
33 #include "wpa_auth_glue.h"
36 static void hostapd_wpa_auth_conf(struct hostapd_bss_config
*conf
,
37 struct hostapd_config
*iconf
,
38 struct wpa_auth_config
*wconf
)
40 os_memset(wconf
, 0, sizeof(*wconf
));
41 wconf
->wpa
= conf
->wpa
;
42 wconf
->wpa_key_mgmt
= conf
->wpa_key_mgmt
;
43 wconf
->wpa_pairwise
= conf
->wpa_pairwise
;
44 wconf
->wpa_group
= conf
->wpa_group
;
45 wconf
->wpa_group_rekey
= conf
->wpa_group_rekey
;
46 wconf
->wpa_strict_rekey
= conf
->wpa_strict_rekey
;
47 wconf
->wpa_gmk_rekey
= conf
->wpa_gmk_rekey
;
48 wconf
->wpa_ptk_rekey
= conf
->wpa_ptk_rekey
;
49 wconf
->wpa_group_update_count
= conf
->wpa_group_update_count
;
50 wconf
->wpa_disable_eapol_key_retries
=
51 conf
->wpa_disable_eapol_key_retries
;
52 wconf
->wpa_pairwise_update_count
= conf
->wpa_pairwise_update_count
;
53 wconf
->rsn_pairwise
= conf
->rsn_pairwise
;
54 wconf
->rsn_preauth
= conf
->rsn_preauth
;
55 wconf
->eapol_version
= conf
->eapol_version
;
57 if (wconf
->eapol_version
> 2)
58 wconf
->eapol_version
= 2;
59 #endif /* CONFIG_MACSEC */
60 wconf
->wmm_enabled
= conf
->wmm_enabled
;
61 wconf
->wmm_uapsd
= conf
->wmm_uapsd
;
62 wconf
->disable_pmksa_caching
= conf
->disable_pmksa_caching
;
64 wconf
->ocv
= conf
->ocv
;
65 #endif /* CONFIG_OCV */
66 wconf
->okc
= conf
->okc
;
67 wconf
->ieee80211w
= conf
->ieee80211w
;
68 wconf
->group_mgmt_cipher
= conf
->group_mgmt_cipher
;
69 wconf
->sae_require_mfp
= conf
->sae_require_mfp
;
70 #ifdef CONFIG_IEEE80211R_AP
71 wconf
->ssid_len
= conf
->ssid
.ssid_len
;
72 if (wconf
->ssid_len
> SSID_MAX_LEN
)
73 wconf
->ssid_len
= SSID_MAX_LEN
;
74 os_memcpy(wconf
->ssid
, conf
->ssid
.ssid
, wconf
->ssid_len
);
75 os_memcpy(wconf
->mobility_domain
, conf
->mobility_domain
,
76 MOBILITY_DOMAIN_ID_LEN
);
77 if (conf
->nas_identifier
&&
78 os_strlen(conf
->nas_identifier
) <= FT_R0KH_ID_MAX_LEN
) {
79 wconf
->r0_key_holder_len
= os_strlen(conf
->nas_identifier
);
80 os_memcpy(wconf
->r0_key_holder
, conf
->nas_identifier
,
81 wconf
->r0_key_holder_len
);
83 os_memcpy(wconf
->r1_key_holder
, conf
->r1_key_holder
, FT_R1KH_ID_LEN
);
84 wconf
->r0_key_lifetime
= conf
->r0_key_lifetime
;
85 wconf
->r1_max_key_lifetime
= conf
->r1_max_key_lifetime
;
86 wconf
->reassociation_deadline
= conf
->reassociation_deadline
;
87 wconf
->rkh_pos_timeout
= conf
->rkh_pos_timeout
;
88 wconf
->rkh_neg_timeout
= conf
->rkh_neg_timeout
;
89 wconf
->rkh_pull_timeout
= conf
->rkh_pull_timeout
;
90 wconf
->rkh_pull_retries
= conf
->rkh_pull_retries
;
91 wconf
->r0kh_list
= &conf
->r0kh_list
;
92 wconf
->r1kh_list
= &conf
->r1kh_list
;
93 wconf
->pmk_r1_push
= conf
->pmk_r1_push
;
94 wconf
->ft_over_ds
= conf
->ft_over_ds
;
95 wconf
->ft_psk_generate_local
= conf
->ft_psk_generate_local
;
96 #endif /* CONFIG_IEEE80211R_AP */
98 wconf
->disable_gtk
= conf
->disable_dgaf
;
100 wconf
->disable_gtk
= 1;
101 wconf
->wpa
= WPA_PROTO_OSEN
;
102 wconf
->wpa_key_mgmt
= WPA_KEY_MGMT_OSEN
;
103 wconf
->wpa_pairwise
= 0;
104 wconf
->wpa_group
= WPA_CIPHER_CCMP
;
105 wconf
->rsn_pairwise
= WPA_CIPHER_CCMP
;
106 wconf
->rsn_preauth
= 0;
107 wconf
->disable_pmksa_caching
= 1;
108 wconf
->ieee80211w
= 1;
110 #endif /* CONFIG_HS20 */
111 #ifdef CONFIG_TESTING_OPTIONS
112 wconf
->corrupt_gtk_rekey_mic_probability
=
113 iconf
->corrupt_gtk_rekey_mic_probability
;
114 if (conf
->own_ie_override
&&
115 wpabuf_len(conf
->own_ie_override
) <= MAX_OWN_IE_OVERRIDE
) {
116 wconf
->own_ie_override_len
= wpabuf_len(conf
->own_ie_override
);
117 os_memcpy(wconf
->own_ie_override
,
118 wpabuf_head(conf
->own_ie_override
),
119 wconf
->own_ie_override_len
);
121 #endif /* CONFIG_TESTING_OPTIONS */
123 os_memcpy(wconf
->ip_addr_go
, conf
->ip_addr_go
, 4);
124 os_memcpy(wconf
->ip_addr_mask
, conf
->ip_addr_mask
, 4);
125 os_memcpy(wconf
->ip_addr_start
, conf
->ip_addr_start
, 4);
126 os_memcpy(wconf
->ip_addr_end
, conf
->ip_addr_end
, 4);
127 #endif /* CONFIG_P2P */
129 wconf
->fils_cache_id_set
= conf
->fils_cache_id_set
;
130 os_memcpy(wconf
->fils_cache_id
, conf
->fils_cache_id
,
132 #endif /* CONFIG_FILS */
136 static void hostapd_wpa_auth_logger(void *ctx
, const u8
*addr
,
137 logger_level level
, const char *txt
)
139 #ifndef CONFIG_NO_HOSTAPD_LOGGER
140 struct hostapd_data
*hapd
= ctx
;
145 hlevel
= HOSTAPD_LEVEL_WARNING
;
148 hlevel
= HOSTAPD_LEVEL_INFO
;
152 hlevel
= HOSTAPD_LEVEL_DEBUG
;
156 hostapd_logger(hapd
, addr
, HOSTAPD_MODULE_WPA
, hlevel
, "%s", txt
);
157 #endif /* CONFIG_NO_HOSTAPD_LOGGER */
161 static void hostapd_wpa_auth_disconnect(void *ctx
, const u8
*addr
,
164 struct hostapd_data
*hapd
= ctx
;
165 wpa_printf(MSG_DEBUG
, "%s: WPA authenticator requests disconnect: "
166 "STA " MACSTR
" reason %d",
167 __func__
, MAC2STR(addr
), reason
);
168 ap_sta_disconnect(hapd
, NULL
, addr
, reason
);
172 static int hostapd_wpa_auth_mic_failure_report(void *ctx
, const u8
*addr
)
174 struct hostapd_data
*hapd
= ctx
;
175 return michael_mic_failure(hapd
, addr
, 0);
179 static void hostapd_wpa_auth_psk_failure_report(void *ctx
, const u8
*addr
)
181 struct hostapd_data
*hapd
= ctx
;
182 wpa_msg(hapd
->msg_ctx
, MSG_INFO
, AP_STA_POSSIBLE_PSK_MISMATCH MACSTR
,
187 static void hostapd_wpa_auth_set_eapol(void *ctx
, const u8
*addr
,
188 wpa_eapol_variable var
, int value
)
190 struct hostapd_data
*hapd
= ctx
;
191 struct sta_info
*sta
= ap_get_sta(hapd
, addr
);
195 case WPA_EAPOL_portEnabled
:
196 ieee802_1x_notify_port_enabled(sta
->eapol_sm
, value
);
198 case WPA_EAPOL_portValid
:
199 ieee802_1x_notify_port_valid(sta
->eapol_sm
, value
);
201 case WPA_EAPOL_authorized
:
202 ieee802_1x_set_sta_authorized(hapd
, sta
, value
);
204 case WPA_EAPOL_portControl_Auto
:
206 sta
->eapol_sm
->portControl
= Auto
;
208 case WPA_EAPOL_keyRun
:
210 sta
->eapol_sm
->keyRun
= value
? TRUE
: FALSE
;
212 case WPA_EAPOL_keyAvailable
:
214 sta
->eapol_sm
->eap_if
->eapKeyAvailable
=
215 value
? TRUE
: FALSE
;
217 case WPA_EAPOL_keyDone
:
219 sta
->eapol_sm
->keyDone
= value
? TRUE
: FALSE
;
221 case WPA_EAPOL_inc_EapolFramesTx
:
223 sta
->eapol_sm
->dot1xAuthEapolFramesTx
++;
229 static int hostapd_wpa_auth_get_eapol(void *ctx
, const u8
*addr
,
230 wpa_eapol_variable var
)
232 struct hostapd_data
*hapd
= ctx
;
233 struct sta_info
*sta
= ap_get_sta(hapd
, addr
);
234 if (sta
== NULL
|| sta
->eapol_sm
== NULL
)
237 case WPA_EAPOL_keyRun
:
238 return sta
->eapol_sm
->keyRun
;
239 case WPA_EAPOL_keyAvailable
:
240 return sta
->eapol_sm
->eap_if
->eapKeyAvailable
;
247 static const u8
* hostapd_wpa_auth_get_psk(void *ctx
, const u8
*addr
,
248 const u8
*p2p_dev_addr
,
249 const u8
*prev_psk
, size_t *psk_len
,
252 struct hostapd_data
*hapd
= ctx
;
253 struct sta_info
*sta
= ap_get_sta(hapd
, addr
);
262 if (sta
&& sta
->auth_alg
== WLAN_AUTH_SAE
) {
263 if (!sta
->sae
|| prev_psk
)
265 return sta
->sae
->pmk
;
267 if (sta
&& wpa_auth_uses_sae(sta
->wpa_sm
)) {
268 wpa_printf(MSG_DEBUG
,
269 "No PSK for STA trying to use SAE with PMKSA caching");
272 #endif /* CONFIG_SAE */
275 if ((hapd
->conf
->wpa_key_mgmt
& WPA_KEY_MGMT_OWE
) &&
276 sta
&& sta
->owe_pmk
) {
278 *psk_len
= sta
->owe_pmk_len
;
281 if ((hapd
->conf
->wpa_key_mgmt
& WPA_KEY_MGMT_OWE
) && sta
) {
282 struct rsn_pmksa_cache_entry
*sa
;
284 sa
= wpa_auth_sta_get_pmksa(sta
->wpa_sm
);
285 if (sa
&& sa
->akmp
== WPA_KEY_MGMT_OWE
) {
287 *psk_len
= sa
->pmk_len
;
291 #endif /* CONFIG_OWE */
293 psk
= hostapd_get_psk(hapd
->conf
, addr
, p2p_dev_addr
, prev_psk
,
296 * This is about to iterate over all psks, prev_psk gives the last
297 * returned psk which should not be returned again.
298 * logic list (all hostapd_get_psk; all sta->psk)
300 if (sta
&& sta
->psk
&& !psk
) {
301 struct hostapd_sta_wpa_psk_short
*pos
;
306 for (pos
= sta
->psk
; pos
; pos
= pos
->next
) {
307 if (pos
->is_passphrase
) {
308 pbkdf2_sha1(pos
->passphrase
,
309 hapd
->conf
->ssid
.ssid
,
310 hapd
->conf
->ssid
.ssid_len
, 4096,
312 pos
->is_passphrase
= 0;
314 if (pos
->psk
== prev_psk
) {
315 psk
= pos
->next
? pos
->next
->psk
: NULL
;
324 static int hostapd_wpa_auth_get_msk(void *ctx
, const u8
*addr
, u8
*msk
,
327 struct hostapd_data
*hapd
= ctx
;
330 struct sta_info
*sta
;
332 sta
= ap_get_sta(hapd
, addr
);
334 wpa_printf(MSG_DEBUG
, "AUTH_GET_MSK: Cannot find STA");
338 key
= ieee802_1x_get_key(sta
->eapol_sm
, &keylen
);
340 wpa_printf(MSG_DEBUG
, "AUTH_GET_MSK: Key is null, eapol_sm: %p",
347 os_memcpy(msk
, key
, keylen
);
354 static int hostapd_wpa_auth_set_key(void *ctx
, int vlan_id
, enum wpa_alg alg
,
355 const u8
*addr
, int idx
, u8
*key
,
358 struct hostapd_data
*hapd
= ctx
;
359 const char *ifname
= hapd
->conf
->iface
;
362 ifname
= hostapd_get_vlan_id_ifname(hapd
->conf
->vlan
, vlan_id
);
367 #ifdef CONFIG_TESTING_OPTIONS
368 if (addr
&& !is_broadcast_ether_addr(addr
)) {
369 struct sta_info
*sta
;
371 sta
= ap_get_sta(hapd
, addr
);
373 sta
->last_tk_alg
= alg
;
374 sta
->last_tk_key_idx
= idx
;
376 os_memcpy(sta
->last_tk
, key
, key_len
);
377 sta
->last_tk_len
= key_len
;
379 } else if (alg
== WPA_ALG_IGTK
||
380 alg
== WPA_ALG_BIP_GMAC_128
||
381 alg
== WPA_ALG_BIP_GMAC_256
||
382 alg
== WPA_ALG_BIP_CMAC_256
) {
383 hapd
->last_igtk_alg
= alg
;
384 hapd
->last_igtk_key_idx
= idx
;
386 os_memcpy(hapd
->last_igtk
, key
, key_len
);
387 hapd
->last_igtk_len
= key_len
;
389 hapd
->last_gtk_alg
= alg
;
390 hapd
->last_gtk_key_idx
= idx
;
392 os_memcpy(hapd
->last_gtk
, key
, key_len
);
393 hapd
->last_gtk_len
= key_len
;
395 #endif /* CONFIG_TESTING_OPTIONS */
396 return hostapd_drv_set_key(ifname
, hapd
, alg
, addr
, idx
, 1, NULL
, 0,
401 static int hostapd_wpa_auth_get_seqnum(void *ctx
, const u8
*addr
, int idx
,
404 struct hostapd_data
*hapd
= ctx
;
405 return hostapd_get_seqnum(hapd
->conf
->iface
, hapd
, addr
, idx
, seq
);
409 static int hostapd_wpa_auth_send_eapol(void *ctx
, const u8
*addr
,
410 const u8
*data
, size_t data_len
,
413 struct hostapd_data
*hapd
= ctx
;
414 struct sta_info
*sta
;
417 #ifdef CONFIG_TESTING_OPTIONS
418 if (hapd
->ext_eapol_frame_io
) {
419 size_t hex_len
= 2 * data_len
+ 1;
420 char *hex
= os_malloc(hex_len
);
424 wpa_snprintf_hex(hex
, hex_len
, data
, data_len
);
425 wpa_msg(hapd
->msg_ctx
, MSG_INFO
, "EAPOL-TX " MACSTR
" %s",
430 #endif /* CONFIG_TESTING_OPTIONS */
432 sta
= ap_get_sta(hapd
, addr
);
434 flags
= hostapd_sta_flags_to_drv(sta
->flags
);
436 return hostapd_drv_hapd_send_eapol(hapd
, addr
, data
, data_len
,
441 static int hostapd_wpa_auth_for_each_sta(
442 void *ctx
, int (*cb
)(struct wpa_state_machine
*sm
, void *ctx
),
445 struct hostapd_data
*hapd
= ctx
;
446 struct sta_info
*sta
;
448 for (sta
= hapd
->sta_list
; sta
; sta
= sta
->next
) {
449 if (sta
->wpa_sm
&& cb(sta
->wpa_sm
, cb_ctx
))
456 struct wpa_auth_iface_iter_data
{
457 int (*cb
)(struct wpa_authenticator
*sm
, void *ctx
);
461 static int wpa_auth_iface_iter(struct hostapd_iface
*iface
, void *ctx
)
463 struct wpa_auth_iface_iter_data
*data
= ctx
;
465 for (i
= 0; i
< iface
->num_bss
; i
++) {
466 if (iface
->bss
[i
]->wpa_auth
&&
467 data
->cb(iface
->bss
[i
]->wpa_auth
, data
->cb_ctx
))
474 static int hostapd_wpa_auth_for_each_auth(
475 void *ctx
, int (*cb
)(struct wpa_authenticator
*sm
, void *ctx
),
478 struct hostapd_data
*hapd
= ctx
;
479 struct wpa_auth_iface_iter_data data
;
480 if (hapd
->iface
->interfaces
== NULL
||
481 hapd
->iface
->interfaces
->for_each_interface
== NULL
)
484 data
.cb_ctx
= cb_ctx
;
485 return hapd
->iface
->interfaces
->for_each_interface(
486 hapd
->iface
->interfaces
, wpa_auth_iface_iter
, &data
);
490 #ifdef CONFIG_IEEE80211R_AP
492 struct wpa_ft_rrb_rx_later_data
{
496 /* followed by data_len octets of data */
499 static void hostapd_wpa_ft_rrb_rx_later(void *eloop_ctx
, void *timeout_ctx
)
501 struct hostapd_data
*hapd
= eloop_ctx
;
502 struct wpa_ft_rrb_rx_later_data
*data
, *n
;
504 dl_list_for_each_safe(data
, n
, &hapd
->l2_queue
,
505 struct wpa_ft_rrb_rx_later_data
, list
) {
506 if (hapd
->wpa_auth
) {
507 wpa_ft_rrb_rx(hapd
->wpa_auth
, data
->addr
,
508 (const u8
*) (data
+ 1),
511 dl_list_del(&data
->list
);
517 struct wpa_auth_ft_iface_iter_data
{
518 struct hostapd_data
*src_hapd
;
525 static int hostapd_wpa_auth_ft_iter(struct hostapd_iface
*iface
, void *ctx
)
527 struct wpa_auth_ft_iface_iter_data
*idata
= ctx
;
528 struct wpa_ft_rrb_rx_later_data
*data
;
529 struct hostapd_data
*hapd
;
532 for (j
= 0; j
< iface
->num_bss
; j
++) {
533 hapd
= iface
->bss
[j
];
534 if (hapd
== idata
->src_hapd
||
536 os_memcmp(hapd
->own_addr
, idata
->dst
, ETH_ALEN
) != 0)
539 wpa_printf(MSG_DEBUG
,
540 "FT: Send RRB data directly to locally managed BSS "
541 MACSTR
"@%s -> " MACSTR
"@%s",
542 MAC2STR(idata
->src_hapd
->own_addr
),
543 idata
->src_hapd
->conf
->iface
,
544 MAC2STR(hapd
->own_addr
), hapd
->conf
->iface
);
546 /* Defer wpa_ft_rrb_rx() until next eloop step as this is
547 * when it would be triggered when reading from a socket.
549 * hapd0:send -> hapd1:recv -> hapd1:send -> hapd0:recv,
550 * that is calling hapd0:recv handler from within
551 * hapd0:send directly.
553 data
= os_zalloc(sizeof(*data
) + idata
->data_len
);
557 os_memcpy(data
->addr
, idata
->src_hapd
->own_addr
, ETH_ALEN
);
558 os_memcpy(data
+ 1, idata
->data
, idata
->data_len
);
559 data
->data_len
= idata
->data_len
;
561 dl_list_add(&hapd
->l2_queue
, &data
->list
);
563 if (!eloop_is_timeout_registered(hostapd_wpa_ft_rrb_rx_later
,
565 eloop_register_timeout(0, 0,
566 hostapd_wpa_ft_rrb_rx_later
,
575 #endif /* CONFIG_IEEE80211R_AP */
578 static int hostapd_wpa_auth_send_ether(void *ctx
, const u8
*dst
, u16 proto
,
579 const u8
*data
, size_t data_len
)
581 struct hostapd_data
*hapd
= ctx
;
582 struct l2_ethhdr
*buf
;
585 #ifdef CONFIG_TESTING_OPTIONS
586 if (hapd
->ext_eapol_frame_io
&& proto
== ETH_P_EAPOL
) {
587 size_t hex_len
= 2 * data_len
+ 1;
588 char *hex
= os_malloc(hex_len
);
592 wpa_snprintf_hex(hex
, hex_len
, data
, data_len
);
593 wpa_msg(hapd
->msg_ctx
, MSG_INFO
, "EAPOL-TX " MACSTR
" %s",
598 #endif /* CONFIG_TESTING_OPTIONS */
600 #ifdef CONFIG_IEEE80211R_AP
601 if (proto
== ETH_P_RRB
&& hapd
->iface
->interfaces
&&
602 hapd
->iface
->interfaces
->for_each_interface
) {
604 struct wpa_auth_ft_iface_iter_data idata
;
605 idata
.src_hapd
= hapd
;
608 idata
.data_len
= data_len
;
609 res
= hapd
->iface
->interfaces
->for_each_interface(
610 hapd
->iface
->interfaces
, hostapd_wpa_auth_ft_iter
,
615 #endif /* CONFIG_IEEE80211R_AP */
617 if (hapd
->driver
&& hapd
->driver
->send_ether
)
618 return hapd
->driver
->send_ether(hapd
->drv_priv
, dst
,
619 hapd
->own_addr
, proto
,
621 if (hapd
->l2
== NULL
)
624 buf
= os_malloc(sizeof(*buf
) + data_len
);
627 os_memcpy(buf
->h_dest
, dst
, ETH_ALEN
);
628 os_memcpy(buf
->h_source
, hapd
->own_addr
, ETH_ALEN
);
629 buf
->h_proto
= host_to_be16(proto
);
630 os_memcpy(buf
+ 1, data
, data_len
);
631 ret
= l2_packet_send(hapd
->l2
, dst
, proto
, (u8
*) buf
,
632 sizeof(*buf
) + data_len
);
638 #ifdef CONFIG_ETH_P_OUI
639 static struct eth_p_oui_ctx
* hostapd_wpa_get_oui(struct hostapd_data
*hapd
,
642 switch (oui_suffix
) {
643 #ifdef CONFIG_IEEE80211R_AP
644 case FT_PACKET_R0KH_R1KH_PULL
:
645 return hapd
->oui_pull
;
646 case FT_PACKET_R0KH_R1KH_RESP
:
647 return hapd
->oui_resp
;
648 case FT_PACKET_R0KH_R1KH_PUSH
:
649 return hapd
->oui_push
;
650 case FT_PACKET_R0KH_R1KH_SEQ_REQ
:
651 return hapd
->oui_sreq
;
652 case FT_PACKET_R0KH_R1KH_SEQ_RESP
:
653 return hapd
->oui_sresp
;
654 #endif /* CONFIG_IEEE80211R_AP */
659 #endif /* CONFIG_ETH_P_OUI */
662 #ifdef CONFIG_IEEE80211R_AP
664 struct oui_deliver_later_data
{
666 u8 src_addr
[ETH_ALEN
];
667 u8 dst_addr
[ETH_ALEN
];
670 /* followed by data_len octets of data */
673 static void hostapd_oui_deliver_later(void *eloop_ctx
, void *timeout_ctx
)
675 struct hostapd_data
*hapd
= eloop_ctx
;
676 struct oui_deliver_later_data
*data
, *n
;
677 struct eth_p_oui_ctx
*oui_ctx
;
679 dl_list_for_each_safe(data
, n
, &hapd
->l2_oui_queue
,
680 struct oui_deliver_later_data
, list
) {
681 oui_ctx
= hostapd_wpa_get_oui(hapd
, data
->oui_suffix
);
682 if (hapd
->wpa_auth
&& oui_ctx
) {
683 eth_p_oui_deliver(oui_ctx
, data
->src_addr
,
685 (const u8
*) (data
+ 1),
688 dl_list_del(&data
->list
);
694 struct wpa_auth_oui_iface_iter_data
{
695 struct hostapd_data
*src_hapd
;
702 static int hostapd_wpa_auth_oui_iter(struct hostapd_iface
*iface
, void *ctx
)
704 struct wpa_auth_oui_iface_iter_data
*idata
= ctx
;
705 struct oui_deliver_later_data
*data
;
706 struct hostapd_data
*hapd
;
709 for (j
= 0; j
< iface
->num_bss
; j
++) {
710 hapd
= iface
->bss
[j
];
711 if (hapd
== idata
->src_hapd
)
713 if (!is_multicast_ether_addr(idata
->dst_addr
) &&
714 os_memcmp(hapd
->own_addr
, idata
->dst_addr
, ETH_ALEN
) != 0)
717 /* defer eth_p_oui_deliver until next eloop step as this is
718 * when it would be triggerd from reading from sock
720 * hapd0:send -> hapd1:recv -> hapd1:send -> hapd0:recv,
721 * that is calling hapd0:recv handler from within
722 * hapd0:send directly.
724 data
= os_zalloc(sizeof(*data
) + idata
->data_len
);
728 os_memcpy(data
->src_addr
, idata
->src_hapd
->own_addr
, ETH_ALEN
);
729 os_memcpy(data
->dst_addr
, idata
->dst_addr
, ETH_ALEN
);
730 os_memcpy(data
+ 1, idata
->data
, idata
->data_len
);
731 data
->data_len
= idata
->data_len
;
732 data
->oui_suffix
= idata
->oui_suffix
;
734 dl_list_add(&hapd
->l2_oui_queue
, &data
->list
);
736 if (!eloop_is_timeout_registered(hostapd_oui_deliver_later
,
738 eloop_register_timeout(0, 0,
739 hostapd_oui_deliver_later
,
748 #endif /* CONFIG_IEEE80211R_AP */
751 static int hostapd_wpa_auth_send_oui(void *ctx
, const u8
*dst
, u8 oui_suffix
,
752 const u8
*data
, size_t data_len
)
754 #ifdef CONFIG_ETH_P_OUI
755 struct hostapd_data
*hapd
= ctx
;
756 struct eth_p_oui_ctx
*oui_ctx
;
758 #ifdef CONFIG_IEEE80211R_AP
759 if (hapd
->iface
->interfaces
&&
760 hapd
->iface
->interfaces
->for_each_interface
) {
761 struct wpa_auth_oui_iface_iter_data idata
;
764 idata
.src_hapd
= hapd
;
765 idata
.dst_addr
= dst
;
767 idata
.data_len
= data_len
;
768 idata
.oui_suffix
= oui_suffix
;
769 res
= hapd
->iface
->interfaces
->for_each_interface(
770 hapd
->iface
->interfaces
, hostapd_wpa_auth_oui_iter
,
775 #endif /* CONFIG_IEEE80211R_AP */
777 oui_ctx
= hostapd_wpa_get_oui(hapd
, oui_suffix
);
781 return eth_p_oui_send(oui_ctx
, hapd
->own_addr
, dst
, data
, data_len
);
782 #else /* CONFIG_ETH_P_OUI */
784 #endif /* CONFIG_ETH_P_OUI */
788 static int hostapd_channel_info(void *ctx
, struct wpa_channel_info
*ci
)
790 struct hostapd_data
*hapd
= ctx
;
792 return hostapd_drv_channel_info(hapd
, ci
);
796 static int hostapd_wpa_auth_update_vlan(void *ctx
, const u8
*addr
, int vlan_id
)
798 #ifndef CONFIG_NO_VLAN
799 struct hostapd_data
*hapd
= ctx
;
800 struct sta_info
*sta
;
801 struct vlan_description vlan_desc
;
803 sta
= ap_get_sta(hapd
, addr
);
807 os_memset(&vlan_desc
, 0, sizeof(vlan_desc
));
808 vlan_desc
.notempty
= 1;
809 vlan_desc
.untagged
= vlan_id
;
810 if (!hostapd_vlan_valid(hapd
->conf
->vlan
, &vlan_desc
)) {
811 wpa_printf(MSG_INFO
, "Invalid VLAN ID %d in wpa_psk_file",
816 if (ap_sta_set_vlan(hapd
, sta
, &vlan_desc
) < 0) {
818 "Failed to assign VLAN ID %d from wpa_psk_file to "
819 MACSTR
, vlan_id
, MAC2STR(sta
->addr
));
824 "Assigned VLAN ID %d from wpa_psk_file to " MACSTR
,
825 vlan_id
, MAC2STR(sta
->addr
));
826 if ((sta
->flags
& WLAN_STA_ASSOC
) &&
827 ap_sta_bind_vlan(hapd
, sta
) < 0)
829 #endif /* CONFIG_NO_VLAN */
836 static int hostapd_get_sta_tx_params(void *ctx
, const u8
*addr
,
837 int ap_max_chanwidth
, int ap_seg1_idx
,
838 int *bandwidth
, int *seg1_idx
)
840 struct hostapd_data
*hapd
= ctx
;
841 struct sta_info
*sta
;
843 sta
= ap_get_sta(hapd
, addr
);
845 hostapd_wpa_auth_logger(hapd
, addr
, LOGGER_INFO
,
846 "Failed to get STA info to validate received OCI");
850 return get_tx_parameters(sta
, ap_max_chanwidth
, ap_seg1_idx
, bandwidth
,
853 #endif /* CONFIG_OCV */
856 #ifdef CONFIG_IEEE80211R_AP
858 static int hostapd_wpa_auth_send_ft_action(void *ctx
, const u8
*dst
,
859 const u8
*data
, size_t data_len
)
861 struct hostapd_data
*hapd
= ctx
;
863 struct ieee80211_mgmt
*m
;
865 struct sta_info
*sta
;
867 sta
= ap_get_sta(hapd
, dst
);
868 if (sta
== NULL
|| sta
->wpa_sm
== NULL
)
871 m
= os_zalloc(sizeof(*m
) + data_len
);
874 mlen
= ((u8
*) &m
->u
- (u8
*) m
) + data_len
;
875 m
->frame_control
= IEEE80211_FC(WLAN_FC_TYPE_MGMT
,
876 WLAN_FC_STYPE_ACTION
);
877 os_memcpy(m
->da
, dst
, ETH_ALEN
);
878 os_memcpy(m
->sa
, hapd
->own_addr
, ETH_ALEN
);
879 os_memcpy(m
->bssid
, hapd
->own_addr
, ETH_ALEN
);
880 os_memcpy(&m
->u
, data
, data_len
);
882 res
= hostapd_drv_send_mlme(hapd
, (u8
*) m
, mlen
, 0);
888 static struct wpa_state_machine
*
889 hostapd_wpa_auth_add_sta(void *ctx
, const u8
*sta_addr
)
891 struct hostapd_data
*hapd
= ctx
;
892 struct sta_info
*sta
;
894 wpa_printf(MSG_DEBUG
, "Add station entry for " MACSTR
895 " based on WPA authenticator callback",
897 if (hostapd_add_sta_node(hapd
, sta_addr
, WLAN_AUTH_FT
) < 0)
900 sta
= ap_sta_add(hapd
, sta_addr
);
903 if (hapd
->driver
&& hapd
->driver
->add_sta_node
)
904 sta
->added_unassoc
= 1;
907 sta
->auth_alg
= WLAN_AUTH_FT
;
911 sta
->wpa_sm
= wpa_auth_sta_init(hapd
->wpa_auth
, sta
->addr
, NULL
);
912 if (sta
->wpa_sm
== NULL
) {
913 ap_free_sta(hapd
, sta
);
916 sta
->auth_alg
= WLAN_AUTH_FT
;
922 static int hostapd_wpa_auth_set_vlan(void *ctx
, const u8
*sta_addr
,
923 struct vlan_description
*vlan
)
925 struct hostapd_data
*hapd
= ctx
;
926 struct sta_info
*sta
;
928 sta
= ap_get_sta(hapd
, sta_addr
);
929 if (!sta
|| !sta
->wpa_sm
)
932 if (vlan
->notempty
&&
933 !hostapd_vlan_valid(hapd
->conf
->vlan
, vlan
)) {
934 hostapd_logger(hapd
, sta
->addr
, HOSTAPD_MODULE_IEEE80211
,
936 "Invalid VLAN %d%s received from FT",
937 vlan
->untagged
, vlan
->tagged
[0] ? "+" : "");
941 if (ap_sta_set_vlan(hapd
, sta
, vlan
) < 0)
943 /* Configure wpa_group for GTK but ignore error due to driver not
944 * knowing this STA. */
945 ap_sta_bind_vlan(hapd
, sta
);
948 hostapd_logger(hapd
, sta
->addr
, HOSTAPD_MODULE_IEEE80211
,
949 HOSTAPD_LEVEL_INFO
, "VLAN ID %d", sta
->vlan_id
);
955 static int hostapd_wpa_auth_get_vlan(void *ctx
, const u8
*sta_addr
,
956 struct vlan_description
*vlan
)
958 struct hostapd_data
*hapd
= ctx
;
959 struct sta_info
*sta
;
961 sta
= ap_get_sta(hapd
, sta_addr
);
966 *vlan
= *sta
->vlan_desc
;
968 os_memset(vlan
, 0, sizeof(*vlan
));
975 hostapd_wpa_auth_set_identity(void *ctx
, const u8
*sta_addr
,
976 const u8
*identity
, size_t identity_len
)
978 struct hostapd_data
*hapd
= ctx
;
979 struct sta_info
*sta
;
981 sta
= ap_get_sta(hapd
, sta_addr
);
985 os_free(sta
->identity
);
986 sta
->identity
= NULL
;
989 os_free(sta
->eapol_sm
->identity
);
990 sta
->eapol_sm
->identity
= NULL
;
991 sta
->eapol_sm
->identity_len
= 0;
997 /* sta->identity is NULL terminated */
998 sta
->identity
= os_zalloc(identity_len
+ 1);
1001 os_memcpy(sta
->identity
, identity
, identity_len
);
1003 if (sta
->eapol_sm
) {
1004 sta
->eapol_sm
->identity
= os_zalloc(identity_len
);
1005 if (!sta
->eapol_sm
->identity
)
1007 os_memcpy(sta
->eapol_sm
->identity
, identity
, identity_len
);
1008 sta
->eapol_sm
->identity_len
= identity_len
;
1016 hostapd_wpa_auth_get_identity(void *ctx
, const u8
*sta_addr
, const u8
**buf
)
1018 struct hostapd_data
*hapd
= ctx
;
1019 struct sta_info
*sta
;
1023 sta
= ap_get_sta(hapd
, sta_addr
);
1027 *buf
= ieee802_1x_get_identity(sta
->eapol_sm
, &len
);
1031 if (!sta
->identity
) {
1036 identity
= sta
->identity
;
1037 len
= os_strlen(identity
);
1038 *buf
= (u8
*) identity
;
1045 hostapd_wpa_auth_set_radius_cui(void *ctx
, const u8
*sta_addr
,
1046 const u8
*radius_cui
, size_t radius_cui_len
)
1048 struct hostapd_data
*hapd
= ctx
;
1049 struct sta_info
*sta
;
1051 sta
= ap_get_sta(hapd
, sta_addr
);
1055 os_free(sta
->radius_cui
);
1056 sta
->radius_cui
= NULL
;
1058 if (sta
->eapol_sm
) {
1059 wpabuf_free(sta
->eapol_sm
->radius_cui
);
1060 sta
->eapol_sm
->radius_cui
= NULL
;
1066 /* sta->radius_cui is NULL terminated */
1067 sta
->radius_cui
= os_zalloc(radius_cui_len
+ 1);
1068 if (!sta
->radius_cui
)
1070 os_memcpy(sta
->radius_cui
, radius_cui
, radius_cui_len
);
1072 if (sta
->eapol_sm
) {
1073 sta
->eapol_sm
->radius_cui
= wpabuf_alloc_copy(radius_cui
,
1075 if (!sta
->eapol_sm
->radius_cui
)
1084 hostapd_wpa_auth_get_radius_cui(void *ctx
, const u8
*sta_addr
, const u8
**buf
)
1086 struct hostapd_data
*hapd
= ctx
;
1087 struct sta_info
*sta
;
1092 sta
= ap_get_sta(hapd
, sta_addr
);
1096 b
= ieee802_1x_get_radius_cui(sta
->eapol_sm
);
1098 len
= wpabuf_len(b
);
1099 *buf
= wpabuf_head(b
);
1103 if (!sta
->radius_cui
) {
1108 radius_cui
= sta
->radius_cui
;
1109 len
= os_strlen(radius_cui
);
1110 *buf
= (u8
*) radius_cui
;
1116 static void hostapd_wpa_auth_set_session_timeout(void *ctx
, const u8
*sta_addr
,
1117 int session_timeout
)
1119 struct hostapd_data
*hapd
= ctx
;
1120 struct sta_info
*sta
;
1122 sta
= ap_get_sta(hapd
, sta_addr
);
1126 if (session_timeout
) {
1127 os_get_reltime(&sta
->session_timeout
);
1128 sta
->session_timeout
.sec
+= session_timeout
;
1129 sta
->session_timeout_set
= 1;
1130 ap_sta_session_timeout(hapd
, sta
, session_timeout
);
1132 sta
->session_timeout_set
= 0;
1133 ap_sta_no_session_timeout(hapd
, sta
);
1138 static int hostapd_wpa_auth_get_session_timeout(void *ctx
, const u8
*sta_addr
)
1140 struct hostapd_data
*hapd
= ctx
;
1141 struct sta_info
*sta
;
1142 struct os_reltime now
, remaining
;
1144 sta
= ap_get_sta(hapd
, sta_addr
);
1145 if (!sta
|| !sta
->session_timeout_set
)
1148 os_get_reltime(&now
);
1149 if (os_reltime_before(&sta
->session_timeout
, &now
)) {
1150 /* already expired, return >0 as timeout was set */
1154 os_reltime_sub(&sta
->session_timeout
, &now
, &remaining
);
1156 return (remaining
.sec
> 0) ? remaining
.sec
: 1;
1160 static void hostapd_rrb_receive(void *ctx
, const u8
*src_addr
, const u8
*buf
,
1163 struct hostapd_data
*hapd
= ctx
;
1164 struct l2_ethhdr
*ethhdr
;
1165 if (len
< sizeof(*ethhdr
))
1167 ethhdr
= (struct l2_ethhdr
*) buf
;
1168 wpa_printf(MSG_DEBUG
, "FT: RRB received packet " MACSTR
" -> "
1169 MACSTR
, MAC2STR(ethhdr
->h_source
), MAC2STR(ethhdr
->h_dest
));
1170 if (!is_multicast_ether_addr(ethhdr
->h_dest
) &&
1171 os_memcmp(hapd
->own_addr
, ethhdr
->h_dest
, ETH_ALEN
) != 0)
1173 wpa_ft_rrb_rx(hapd
->wpa_auth
, ethhdr
->h_source
, buf
+ sizeof(*ethhdr
),
1174 len
- sizeof(*ethhdr
));
1178 static void hostapd_rrb_oui_receive(void *ctx
, const u8
*src_addr
,
1179 const u8
*dst_addr
, u8 oui_suffix
,
1180 const u8
*buf
, size_t len
)
1182 struct hostapd_data
*hapd
= ctx
;
1184 wpa_printf(MSG_DEBUG
, "FT: RRB received packet " MACSTR
" -> "
1185 MACSTR
, MAC2STR(src_addr
), MAC2STR(dst_addr
));
1186 if (!is_multicast_ether_addr(dst_addr
) &&
1187 os_memcmp(hapd
->own_addr
, dst_addr
, ETH_ALEN
) != 0)
1189 wpa_ft_rrb_oui_rx(hapd
->wpa_auth
, src_addr
, dst_addr
, oui_suffix
, buf
,
1194 static int hostapd_wpa_auth_add_tspec(void *ctx
, const u8
*sta_addr
,
1195 u8
*tspec_ie
, size_t tspec_ielen
)
1197 struct hostapd_data
*hapd
= ctx
;
1198 return hostapd_add_tspec(hapd
, sta_addr
, tspec_ie
, tspec_ielen
);
1203 static int hostapd_wpa_register_ft_oui(struct hostapd_data
*hapd
,
1204 const char *ft_iface
)
1206 hapd
->oui_pull
= eth_p_oui_register(hapd
, ft_iface
,
1207 FT_PACKET_R0KH_R1KH_PULL
,
1208 hostapd_rrb_oui_receive
, hapd
);
1209 if (!hapd
->oui_pull
)
1212 hapd
->oui_resp
= eth_p_oui_register(hapd
, ft_iface
,
1213 FT_PACKET_R0KH_R1KH_RESP
,
1214 hostapd_rrb_oui_receive
, hapd
);
1215 if (!hapd
->oui_resp
)
1218 hapd
->oui_push
= eth_p_oui_register(hapd
, ft_iface
,
1219 FT_PACKET_R0KH_R1KH_PUSH
,
1220 hostapd_rrb_oui_receive
, hapd
);
1221 if (!hapd
->oui_push
)
1224 hapd
->oui_sreq
= eth_p_oui_register(hapd
, ft_iface
,
1225 FT_PACKET_R0KH_R1KH_SEQ_REQ
,
1226 hostapd_rrb_oui_receive
, hapd
);
1227 if (!hapd
->oui_sreq
)
1230 hapd
->oui_sresp
= eth_p_oui_register(hapd
, ft_iface
,
1231 FT_PACKET_R0KH_R1KH_SEQ_RESP
,
1232 hostapd_rrb_oui_receive
, hapd
);
1233 if (!hapd
->oui_sresp
)
1240 static void hostapd_wpa_unregister_ft_oui(struct hostapd_data
*hapd
)
1242 eth_p_oui_unregister(hapd
->oui_pull
);
1243 hapd
->oui_pull
= NULL
;
1244 eth_p_oui_unregister(hapd
->oui_resp
);
1245 hapd
->oui_resp
= NULL
;
1246 eth_p_oui_unregister(hapd
->oui_push
);
1247 hapd
->oui_push
= NULL
;
1248 eth_p_oui_unregister(hapd
->oui_sreq
);
1249 hapd
->oui_sreq
= NULL
;
1250 eth_p_oui_unregister(hapd
->oui_sresp
);
1251 hapd
->oui_sresp
= NULL
;
1253 #endif /* CONFIG_IEEE80211R_AP */
1256 int hostapd_setup_wpa(struct hostapd_data
*hapd
)
1258 struct wpa_auth_config _conf
;
1259 static const struct wpa_auth_callbacks cb
= {
1260 .logger
= hostapd_wpa_auth_logger
,
1261 .disconnect
= hostapd_wpa_auth_disconnect
,
1262 .mic_failure_report
= hostapd_wpa_auth_mic_failure_report
,
1263 .psk_failure_report
= hostapd_wpa_auth_psk_failure_report
,
1264 .set_eapol
= hostapd_wpa_auth_set_eapol
,
1265 .get_eapol
= hostapd_wpa_auth_get_eapol
,
1266 .get_psk
= hostapd_wpa_auth_get_psk
,
1267 .get_msk
= hostapd_wpa_auth_get_msk
,
1268 .set_key
= hostapd_wpa_auth_set_key
,
1269 .get_seqnum
= hostapd_wpa_auth_get_seqnum
,
1270 .send_eapol
= hostapd_wpa_auth_send_eapol
,
1271 .for_each_sta
= hostapd_wpa_auth_for_each_sta
,
1272 .for_each_auth
= hostapd_wpa_auth_for_each_auth
,
1273 .send_ether
= hostapd_wpa_auth_send_ether
,
1274 .send_oui
= hostapd_wpa_auth_send_oui
,
1275 .channel_info
= hostapd_channel_info
,
1276 .update_vlan
= hostapd_wpa_auth_update_vlan
,
1278 .get_sta_tx_params
= hostapd_get_sta_tx_params
,
1279 #endif /* CONFIG_OCV */
1280 #ifdef CONFIG_IEEE80211R_AP
1281 .send_ft_action
= hostapd_wpa_auth_send_ft_action
,
1282 .add_sta
= hostapd_wpa_auth_add_sta
,
1283 .add_tspec
= hostapd_wpa_auth_add_tspec
,
1284 .set_vlan
= hostapd_wpa_auth_set_vlan
,
1285 .get_vlan
= hostapd_wpa_auth_get_vlan
,
1286 .set_identity
= hostapd_wpa_auth_set_identity
,
1287 .get_identity
= hostapd_wpa_auth_get_identity
,
1288 .set_radius_cui
= hostapd_wpa_auth_set_radius_cui
,
1289 .get_radius_cui
= hostapd_wpa_auth_get_radius_cui
,
1290 .set_session_timeout
= hostapd_wpa_auth_set_session_timeout
,
1291 .get_session_timeout
= hostapd_wpa_auth_get_session_timeout
,
1292 #endif /* CONFIG_IEEE80211R_AP */
1297 hostapd_wpa_auth_conf(hapd
->conf
, hapd
->iconf
, &_conf
);
1298 if (hapd
->iface
->drv_flags
& WPA_DRIVER_FLAGS_EAPOL_TX_STATUS
)
1299 _conf
.tx_status
= 1;
1300 if (hapd
->iface
->drv_flags
& WPA_DRIVER_FLAGS_AP_MLME
)
1302 hapd
->wpa_auth
= wpa_init(hapd
->own_addr
, &_conf
, &cb
, hapd
);
1303 if (hapd
->wpa_auth
== NULL
) {
1304 wpa_printf(MSG_ERROR
, "WPA initialization failed.");
1308 if (hostapd_set_privacy(hapd
, 1)) {
1309 wpa_printf(MSG_ERROR
, "Could not set PrivacyInvoked "
1310 "for interface %s", hapd
->conf
->iface
);
1314 wpa_ie
= wpa_auth_get_wpa_ie(hapd
->wpa_auth
, &wpa_ie_len
);
1315 if (hostapd_set_generic_elem(hapd
, wpa_ie
, wpa_ie_len
)) {
1316 wpa_printf(MSG_ERROR
, "Failed to configure WPA IE for "
1317 "the kernel driver.");
1321 if (rsn_preauth_iface_init(hapd
)) {
1322 wpa_printf(MSG_ERROR
, "Initialization of RSN "
1323 "pre-authentication failed.");
1327 #ifdef CONFIG_IEEE80211R_AP
1328 if (!hostapd_drv_none(hapd
) &&
1329 wpa_key_mgmt_ft(hapd
->conf
->wpa_key_mgmt
)) {
1330 const char *ft_iface
;
1332 ft_iface
= hapd
->conf
->bridge
[0] ? hapd
->conf
->bridge
:
1334 hapd
->l2
= l2_packet_init(ft_iface
, NULL
, ETH_P_RRB
,
1335 hostapd_rrb_receive
, hapd
, 1);
1336 if (hapd
->l2
== NULL
&&
1337 (hapd
->driver
== NULL
||
1338 hapd
->driver
->send_ether
== NULL
)) {
1339 wpa_printf(MSG_ERROR
, "Failed to open l2_packet "
1344 if (hostapd_wpa_register_ft_oui(hapd
, ft_iface
)) {
1345 wpa_printf(MSG_ERROR
,
1346 "Failed to open ETH_P_OUI interface");
1350 #endif /* CONFIG_IEEE80211R_AP */
1357 void hostapd_reconfig_wpa(struct hostapd_data
*hapd
)
1359 struct wpa_auth_config wpa_auth_conf
;
1360 hostapd_wpa_auth_conf(hapd
->conf
, hapd
->iconf
, &wpa_auth_conf
);
1361 wpa_reconfig(hapd
->wpa_auth
, &wpa_auth_conf
);
1365 void hostapd_deinit_wpa(struct hostapd_data
*hapd
)
1367 ieee80211_tkip_countermeasures_deinit(hapd
);
1368 rsn_preauth_iface_deinit(hapd
);
1369 if (hapd
->wpa_auth
) {
1370 wpa_deinit(hapd
->wpa_auth
);
1371 hapd
->wpa_auth
= NULL
;
1373 if (hapd
->drv_priv
&& hostapd_set_privacy(hapd
, 0)) {
1374 wpa_printf(MSG_DEBUG
, "Could not disable "
1375 "PrivacyInvoked for interface %s",
1379 if (hapd
->drv_priv
&&
1380 hostapd_set_generic_elem(hapd
, (u8
*) "", 0)) {
1381 wpa_printf(MSG_DEBUG
, "Could not remove generic "
1382 "information element from interface %s",
1386 ieee802_1x_deinit(hapd
);
1388 #ifdef CONFIG_IEEE80211R_AP
1389 eloop_cancel_timeout(hostapd_wpa_ft_rrb_rx_later
, hapd
, ELOOP_ALL_CTX
);
1390 hostapd_wpa_ft_rrb_rx_later(hapd
, NULL
); /* flush without delivering */
1391 eloop_cancel_timeout(hostapd_oui_deliver_later
, hapd
, ELOOP_ALL_CTX
);
1392 hostapd_oui_deliver_later(hapd
, NULL
); /* flush without delivering */
1393 l2_packet_deinit(hapd
->l2
);
1395 hostapd_wpa_unregister_ft_oui(hapd
);
1396 #endif /* CONFIG_IEEE80211R_AP */