2 * hostapd / Initialization and configuration
3 * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
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.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
15 #include "utils/includes.h"
17 #include "utils/common.h"
18 #include "utils/eloop.h"
19 #include "common/ieee802_11_defs.h"
20 #include "radius/radius_client.h"
21 #include "drivers/driver.h"
25 #include "accounting.h"
29 #include "ieee802_1x.h"
30 #include "ieee802_11_auth.h"
31 #include "vlan_init.h"
33 #include "wps_hostapd.h"
34 #include "hw_features.h"
35 #include "wpa_auth_glue.h"
36 #include "ap_drv_ops.h"
37 #include "ap_config.h"
40 static int hostapd_flush_old_stations(struct hostapd_data *hapd);
41 static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd);
43 extern int wpa_debug_level;
46 int hostapd_reload_config(struct hostapd_iface *iface)
48 struct hostapd_data *hapd = iface->bss[0];
49 struct hostapd_config *newconf, *oldconf;
52 if (iface->config_read_cb == NULL)
54 newconf = iface->config_read_cb(iface->config_fname);
59 * Deauthenticate all stations since the new configuration may not
60 * allow them to use the BSS anymore.
62 for (j = 0; j < iface->num_bss; j++)
63 hostapd_flush_old_stations(iface->bss[j]);
65 #ifndef CONFIG_NO_RADIUS
66 /* TODO: update dynamic data based on changed configuration
67 * items (e.g., open/close sockets, etc.) */
68 radius_client_flush(hapd->radius, 0);
69 #endif /* CONFIG_NO_RADIUS */
71 oldconf = hapd->iconf;
72 hapd->iconf = newconf;
73 hapd->conf = &newconf->bss[0];
74 iface->conf = newconf;
76 if (hostapd_setup_wpa_psk(hapd->conf)) {
77 wpa_printf(MSG_ERROR, "Failed to re-configure WPA PSK "
78 "after reloading configuration");
81 if (hapd->conf->ieee802_1x || hapd->conf->wpa)
82 hapd->drv.set_drv_ieee8021x(hapd, hapd->conf->iface, 1);
84 hapd->drv.set_drv_ieee8021x(hapd, hapd->conf->iface, 0);
86 if (hapd->conf->wpa && hapd->wpa_auth == NULL)
87 hostapd_setup_wpa(hapd);
88 else if (hapd->conf->wpa) {
91 hostapd_reconfig_wpa(hapd);
92 wpa_ie = wpa_auth_get_wpa_ie(hapd->wpa_auth, &wpa_ie_len);
93 if (hostapd_set_generic_elem(hapd, wpa_ie, wpa_ie_len))
94 wpa_printf(MSG_ERROR, "Failed to configure WPA IE for "
95 "the kernel driver.");
96 } else if (hapd->wpa_auth) {
97 wpa_deinit(hapd->wpa_auth);
98 hapd->wpa_auth = NULL;
99 hostapd_set_privacy(hapd, 0);
100 hostapd_setup_encryption(hapd->conf->iface, hapd);
101 hostapd_set_generic_elem(hapd, (u8 *) "", 0);
104 ieee802_11_set_beacon(hapd);
105 hostapd_update_wps(hapd);
107 if (hapd->conf->ssid.ssid_set &&
108 hostapd_set_ssid(hapd, (u8 *) hapd->conf->ssid.ssid,
109 hapd->conf->ssid.ssid_len)) {
110 wpa_printf(MSG_ERROR, "Could not set SSID for kernel driver");
111 /* try to continue */
114 hostapd_config_free(oldconf);
116 wpa_printf(MSG_DEBUG, "Reconfigured interface %s", hapd->conf->iface);
122 static void hostapd_broadcast_key_clear_iface(struct hostapd_data *hapd,
127 for (i = 0; i < NUM_WEP_KEYS; i++) {
128 if (hapd->drv.set_key(ifname, hapd, WPA_ALG_NONE, NULL, i,
129 i == 0 ? 1 : 0, NULL, 0, NULL, 0)) {
130 wpa_printf(MSG_DEBUG, "Failed to clear default "
131 "encryption keys (ifname=%s keyidx=%d)",
135 #ifdef CONFIG_IEEE80211W
136 if (hapd->conf->ieee80211w) {
137 for (i = NUM_WEP_KEYS; i < NUM_WEP_KEYS + 2; i++) {
138 if (hapd->drv.set_key(ifname, hapd, WPA_ALG_NONE, NULL,
139 i, i == 0 ? 1 : 0, NULL, 0,
141 wpa_printf(MSG_DEBUG, "Failed to clear "
142 "default mgmt encryption keys "
143 "(ifname=%s keyidx=%d)", ifname, i);
147 #endif /* CONFIG_IEEE80211W */
151 static int hostapd_broadcast_wep_clear(struct hostapd_data *hapd)
153 hostapd_broadcast_key_clear_iface(hapd, hapd->conf->iface);
158 static int hostapd_broadcast_wep_set(struct hostapd_data *hapd)
161 struct hostapd_ssid *ssid = &hapd->conf->ssid;
164 if (ssid->wep.default_len &&
165 hapd->drv.set_key(hapd->conf->iface,
166 hapd, WPA_ALG_WEP, NULL, idx,
167 idx == ssid->wep.idx,
168 NULL, 0, ssid->wep.key[idx],
169 ssid->wep.len[idx])) {
170 wpa_printf(MSG_WARNING, "Could not set WEP encryption.");
174 if (ssid->dyn_vlan_keys) {
176 for (i = 0; i <= ssid->max_dyn_vlan_keys; i++) {
178 struct hostapd_wep_keys *key = ssid->dyn_vlan_keys[i];
181 ifname = hostapd_get_vlan_id_ifname(hapd->conf->vlan,
187 if (hapd->drv.set_key(ifname, hapd, WPA_ALG_WEP, NULL,
188 idx, idx == key->idx, NULL, 0,
189 key->key[idx], key->len[idx])) {
190 wpa_printf(MSG_WARNING, "Could not set "
191 "dynamic VLAN WEP encryption.");
201 * hostapd_cleanup - Per-BSS cleanup (deinitialization)
202 * @hapd: Pointer to BSS data
204 * This function is used to free all per-BSS data structures and resources.
205 * This gets called in a loop for each BSS between calls to
206 * hostapd_cleanup_iface_pre() and hostapd_cleanup_iface() when an interface
207 * is deinitialized. Most of the modules that are initialized in
208 * hostapd_setup_bss() are deinitialized here.
210 static void hostapd_cleanup(struct hostapd_data *hapd)
212 if (hapd->iface->ctrl_iface_deinit)
213 hapd->iface->ctrl_iface_deinit(hapd);
215 iapp_deinit(hapd->iapp);
217 accounting_deinit(hapd);
218 hostapd_deinit_wpa(hapd);
220 hostapd_acl_deinit(hapd);
221 #ifndef CONFIG_NO_RADIUS
222 radius_client_deinit(hapd->radius);
224 #endif /* CONFIG_NO_RADIUS */
226 hostapd_deinit_wps(hapd);
228 authsrv_deinit(hapd);
230 if (hapd->interface_added &&
231 hostapd_if_remove(hapd, WPA_IF_AP_BSS, hapd->conf->iface)) {
232 wpa_printf(MSG_WARNING, "Failed to remove BSS interface %s",
236 os_free(hapd->probereq_cb);
237 hapd->probereq_cb = NULL;
242 * hostapd_cleanup_iface_pre - Preliminary per-interface cleanup
243 * @iface: Pointer to interface data
245 * This function is called before per-BSS data structures are deinitialized
246 * with hostapd_cleanup().
248 static void hostapd_cleanup_iface_pre(struct hostapd_iface *iface)
254 * hostapd_cleanup_iface - Complete per-interface cleanup
255 * @iface: Pointer to interface data
257 * This function is called after per-BSS data structures are deinitialized
258 * with hostapd_cleanup().
260 static void hostapd_cleanup_iface(struct hostapd_iface *iface)
262 hostapd_free_hw_features(iface->hw_features, iface->num_hw_features);
263 iface->hw_features = NULL;
264 os_free(iface->current_rates);
265 iface->current_rates = NULL;
266 ap_list_deinit(iface);
267 hostapd_config_free(iface->conf);
270 os_free(iface->config_fname);
276 static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd)
280 hostapd_broadcast_wep_set(hapd);
282 if (hapd->conf->ssid.wep.default_len) {
283 hostapd_set_privacy(hapd, 1);
287 for (i = 0; i < 4; i++) {
288 if (hapd->conf->ssid.wep.key[i] &&
289 hapd->drv.set_key(iface, hapd, WPA_ALG_WEP, NULL, i,
290 i == hapd->conf->ssid.wep.idx, NULL, 0,
291 hapd->conf->ssid.wep.key[i],
292 hapd->conf->ssid.wep.len[i])) {
293 wpa_printf(MSG_WARNING, "Could not set WEP "
297 if (hapd->conf->ssid.wep.key[i] &&
298 i == hapd->conf->ssid.wep.idx)
299 hostapd_set_privacy(hapd, 1);
306 static int hostapd_flush_old_stations(struct hostapd_data *hapd)
310 if (hostapd_drv_none(hapd) || hapd->drv_priv == NULL)
313 wpa_printf(MSG_DEBUG, "Flushing old station entries");
314 if (hostapd_flush(hapd)) {
315 wpa_printf(MSG_WARNING, "Could not connect to kernel driver.");
318 wpa_printf(MSG_DEBUG, "Deauthenticate all stations");
320 /* New Prism2.5/3 STA firmware versions seem to have issues with this
321 * broadcast deauth frame. This gets the firmware in odd state where
322 * nothing works correctly, so let's skip sending this for the hostap
324 if (hapd->driver && os_strcmp(hapd->driver->name, "hostap") != 0) {
326 os_memset(addr, 0xff, ETH_ALEN);
327 hapd->drv.sta_deauth(hapd, addr,
328 WLAN_REASON_PREV_AUTH_NOT_VALID);
336 * hostapd_validate_bssid_configuration - Validate BSSID configuration
337 * @iface: Pointer to interface data
338 * Returns: 0 on success, -1 on failure
340 * This function is used to validate that the configured BSSIDs are valid.
342 static int hostapd_validate_bssid_configuration(struct hostapd_iface *iface)
344 u8 mask[ETH_ALEN] = { 0 };
345 struct hostapd_data *hapd = iface->bss[0];
346 unsigned int i = iface->conf->num_bss, bits = 0, j;
350 if (hostapd_drv_none(hapd))
353 /* Generate BSSID mask that is large enough to cover the BSSIDs. */
355 /* Determine the bits necessary to cover the number of BSSIDs. */
356 for (i--; i; i >>= 1)
359 /* Determine the bits necessary to any configured BSSIDs,
360 if they are higher than the number of BSSIDs. */
361 for (j = 0; j < iface->conf->num_bss; j++) {
362 if (hostapd_mac_comp_empty(iface->conf->bss[j].bssid) == 0) {
368 for (i = 0; i < ETH_ALEN; i++) {
370 iface->conf->bss[j].bssid[i] ^
378 for (i = 0; i < ETH_ALEN && mask[i] == 0; i++)
384 while (mask[i] != 0) {
394 wpa_printf(MSG_ERROR, "Too many bits in the BSSID mask (%u)",
399 os_memset(mask, 0xff, ETH_ALEN);
401 for (i = 5; i > 5 - j; i--)
408 wpa_printf(MSG_DEBUG, "BSS count %lu, BSSID mask " MACSTR " (%d bits)",
409 (unsigned long) iface->conf->num_bss, MAC2STR(mask), bits);
411 res = hostapd_valid_bss_mask(hapd, hapd->own_addr, mask);
416 wpa_printf(MSG_ERROR, "Driver did not accept BSSID mask "
417 MACSTR " for start address " MACSTR ".",
418 MAC2STR(mask), MAC2STR(hapd->own_addr));
425 for (i = 0; i < ETH_ALEN; i++) {
426 if ((hapd->own_addr[i] & mask[i]) != hapd->own_addr[i]) {
427 wpa_printf(MSG_ERROR, "Invalid BSSID mask " MACSTR
428 " for start address " MACSTR ".",
429 MAC2STR(mask), MAC2STR(hapd->own_addr));
430 wpa_printf(MSG_ERROR, "Start address must be the "
431 "first address in the block (i.e., addr "
432 "AND mask == addr).");
441 static int mac_in_conf(struct hostapd_config *conf, const void *a)
445 for (i = 0; i < conf->num_bss; i++) {
446 if (hostapd_mac_comp(conf->bss[i].bssid, a) == 0) {
458 * hostapd_setup_bss - Per-BSS setup (initialization)
459 * @hapd: Pointer to BSS data
460 * @first: Whether this BSS is the first BSS of an interface
462 * This function is used to initialize all per-BSS data structures and
463 * resources. This gets called in a loop for each BSS when an interface is
464 * initialized. Most of the modules that are initialized here will be
465 * deinitialized in hostapd_cleanup().
467 static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
469 struct hostapd_bss_config *conf = hapd->conf;
470 u8 ssid[HOSTAPD_MAX_SSID_LEN + 1];
471 int ssid_len, set_ssid;
472 char force_ifname[IFNAMSIZ];
473 u8 if_addr[ETH_ALEN];
476 if (hostapd_mac_comp_empty(hapd->conf->bssid) == 0) {
477 /* Allocate the next available BSSID. */
479 inc_byte_array(hapd->own_addr, ETH_ALEN);
480 } while (mac_in_conf(hapd->iconf, hapd->own_addr));
482 /* Allocate the configured BSSID. */
483 os_memcpy(hapd->own_addr, hapd->conf->bssid, ETH_ALEN);
485 if (hostapd_mac_comp(hapd->own_addr,
486 hapd->iface->bss[0]->own_addr) ==
488 wpa_printf(MSG_ERROR, "BSS '%s' may not have "
489 "BSSID set to the MAC address of "
490 "the radio", hapd->conf->iface);
495 hapd->interface_added = 1;
496 if (hostapd_if_add(hapd->iface->bss[0], WPA_IF_AP_BSS,
497 hapd->conf->iface, hapd->own_addr, hapd,
498 &hapd->drv_priv, force_ifname, if_addr)) {
499 wpa_printf(MSG_ERROR, "Failed to add BSS (BSSID="
500 MACSTR ")", MAC2STR(hapd->own_addr));
505 hostapd_flush_old_stations(hapd);
506 hostapd_set_privacy(hapd, 0);
508 hostapd_broadcast_wep_clear(hapd);
509 if (hostapd_setup_encryption(hapd->conf->iface, hapd))
513 * Fetch the SSID from the system and use it or,
514 * if one was specified in the config file, verify they
517 ssid_len = hostapd_get_ssid(hapd, ssid, sizeof(ssid));
519 wpa_printf(MSG_ERROR, "Could not read SSID from system");
522 if (conf->ssid.ssid_set) {
524 * If SSID is specified in the config file and it differs
525 * from what is being used then force installation of the
528 set_ssid = (conf->ssid.ssid_len != (size_t) ssid_len ||
529 os_memcmp(conf->ssid.ssid, ssid, ssid_len) != 0);
532 * No SSID in the config file; just use the one we got
536 conf->ssid.ssid_len = ssid_len;
537 os_memcpy(conf->ssid.ssid, ssid, conf->ssid.ssid_len);
538 conf->ssid.ssid[conf->ssid.ssid_len] = '\0';
541 if (!hostapd_drv_none(hapd)) {
542 wpa_printf(MSG_ERROR, "Using interface %s with hwaddr " MACSTR
544 hapd->conf->iface, MAC2STR(hapd->own_addr),
545 hapd->conf->ssid.ssid);
548 if (hostapd_setup_wpa_psk(conf)) {
549 wpa_printf(MSG_ERROR, "WPA-PSK setup failed.");
553 /* Set SSID for the kernel driver (to be used in beacon and probe
554 * response frames) */
555 if (set_ssid && hostapd_set_ssid(hapd, (u8 *) conf->ssid.ssid,
556 conf->ssid.ssid_len)) {
557 wpa_printf(MSG_ERROR, "Could not set SSID for kernel driver");
561 if (wpa_debug_level == MSG_MSGDUMP)
562 conf->radius->msg_dumps = 1;
563 #ifndef CONFIG_NO_RADIUS
564 hapd->radius = radius_client_init(hapd, conf->radius);
565 if (hapd->radius == NULL) {
566 wpa_printf(MSG_ERROR, "RADIUS client initialization failed.");
569 #endif /* CONFIG_NO_RADIUS */
571 if (hostapd_acl_init(hapd)) {
572 wpa_printf(MSG_ERROR, "ACL initialization failed.");
575 if (hostapd_init_wps(hapd, conf))
578 if (authsrv_init(hapd) < 0)
581 if (ieee802_1x_init(hapd)) {
582 wpa_printf(MSG_ERROR, "IEEE 802.1X initialization failed.");
586 if (hapd->conf->wpa && hostapd_setup_wpa(hapd))
589 if (accounting_init(hapd)) {
590 wpa_printf(MSG_ERROR, "Accounting initialization failed.");
594 if (hapd->conf->ieee802_11f &&
595 (hapd->iapp = iapp_init(hapd, hapd->conf->iapp_iface)) == NULL) {
596 wpa_printf(MSG_ERROR, "IEEE 802.11F (IAPP) initialization "
601 if (hapd->iface->ctrl_iface_init &&
602 hapd->iface->ctrl_iface_init(hapd)) {
603 wpa_printf(MSG_ERROR, "Failed to setup control interface");
607 if (!hostapd_drv_none(hapd) && vlan_init(hapd)) {
608 wpa_printf(MSG_ERROR, "VLAN initialization failed.");
612 ieee802_11_set_beacon(hapd);
618 static void hostapd_tx_queue_params(struct hostapd_iface *iface)
620 struct hostapd_data *hapd = iface->bss[0];
622 struct hostapd_tx_queue_params *p;
624 for (i = 0; i < NUM_TX_QUEUES; i++) {
625 p = &iface->conf->tx_queue[i];
630 if (hostapd_set_tx_queue_params(hapd, i, p->aifs, p->cwmin,
631 p->cwmax, p->burst)) {
632 wpa_printf(MSG_DEBUG, "Failed to set TX queue "
633 "parameters for queue %d.", i);
634 /* Continue anyway */
640 static int setup_interface(struct hostapd_iface *iface)
642 struct hostapd_data *hapd = iface->bss[0];
647 * Make sure that all BSSes get configured with a pointer to the same
650 for (i = 1; i < iface->num_bss; i++) {
651 iface->bss[i]->driver = hapd->driver;
652 iface->bss[i]->drv_priv = hapd->drv_priv;
655 if (hostapd_validate_bssid_configuration(iface))
658 if (hapd->iconf->country[0] && hapd->iconf->country[1]) {
659 os_memcpy(country, hapd->iconf->country, 3);
661 if (hostapd_set_country(hapd, country) < 0) {
662 wpa_printf(MSG_ERROR, "Failed to set country code");
667 if (hostapd_get_hw_features(iface)) {
668 /* Not all drivers support this yet, so continue without hw
671 int ret = hostapd_select_hw_mode(iface);
673 wpa_printf(MSG_ERROR, "Could not select hw_mode and "
674 "channel. (%d)", ret);
677 ret = hostapd_check_ht_capab(iface);
681 wpa_printf(MSG_DEBUG, "Interface initialization will "
682 "be completed in a callback");
686 return hostapd_setup_interface_complete(iface, 0);
690 int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err)
692 struct hostapd_data *hapd = iface->bss[0];
697 wpa_printf(MSG_ERROR, "Interface initialization failed");
702 wpa_printf(MSG_DEBUG, "Completing interface initialization");
703 if (hapd->iconf->channel) {
704 iface->freq = hostapd_hw_get_freq(hapd, hapd->iconf->channel);
705 wpa_printf(MSG_DEBUG, "Mode: %s Channel: %d "
707 hostapd_hw_mode_txt(hapd->iconf->hw_mode),
708 hapd->iconf->channel, iface->freq);
710 if (hostapd_set_freq(hapd, hapd->iconf->hw_mode, iface->freq,
711 hapd->iconf->channel,
712 hapd->iconf->ieee80211n,
713 hapd->iconf->secondary_channel)) {
714 wpa_printf(MSG_ERROR, "Could not set channel for "
720 if (hapd->iconf->rts_threshold > -1 &&
721 hostapd_set_rts(hapd, hapd->iconf->rts_threshold)) {
722 wpa_printf(MSG_ERROR, "Could not set RTS threshold for "
727 if (hapd->iconf->fragm_threshold > -1 &&
728 hostapd_set_frag(hapd, hapd->iconf->fragm_threshold)) {
729 wpa_printf(MSG_ERROR, "Could not set fragmentation threshold "
730 "for kernel driver");
734 prev_addr = hapd->own_addr;
736 for (j = 0; j < iface->num_bss; j++) {
737 hapd = iface->bss[j];
739 os_memcpy(hapd->own_addr, prev_addr, ETH_ALEN);
740 if (hostapd_setup_bss(hapd, j == 0))
742 if (hostapd_mac_comp_empty(hapd->conf->bssid) == 0)
743 prev_addr = hapd->own_addr;
746 hostapd_tx_queue_params(iface);
750 if (hostapd_driver_commit(hapd) < 0) {
751 wpa_printf(MSG_ERROR, "%s: Failed to commit driver "
752 "configuration", __func__);
756 wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
757 iface->bss[0]->conf->iface);
764 * hostapd_setup_interface - Setup of an interface
765 * @iface: Pointer to interface data.
766 * Returns: 0 on success, -1 on failure
768 * Initializes the driver interface, validates the configuration,
769 * and sets driver parameters based on the configuration.
770 * Flushes old stations, sets the channel, encryption,
771 * beacons, and WDS links based on the configuration.
773 int hostapd_setup_interface(struct hostapd_iface *iface)
777 ret = setup_interface(iface);
779 wpa_printf(MSG_ERROR, "%s: Unable to setup interface.",
780 iface->bss[0]->conf->iface);
789 * hostapd_alloc_bss_data - Allocate and initialize per-BSS data
790 * @hapd_iface: Pointer to interface data
791 * @conf: Pointer to per-interface configuration
792 * @bss: Pointer to per-BSS configuration for this BSS
793 * Returns: Pointer to allocated BSS data
795 * This function is used to allocate per-BSS data structure. This data will be
796 * freed after hostapd_cleanup() is called for it during interface
799 struct hostapd_data *
800 hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
801 struct hostapd_config *conf,
802 struct hostapd_bss_config *bss)
804 struct hostapd_data *hapd;
806 hapd = os_zalloc(sizeof(*hapd));
810 hostapd_set_driver_ops(&hapd->drv);
811 hapd->new_assoc_sta_cb = hostapd_new_assoc_sta;
814 hapd->iface = hapd_iface;
815 hapd->driver = hapd->iconf->driver;
821 void hostapd_interface_deinit(struct hostapd_iface *iface)
828 hostapd_cleanup_iface_pre(iface);
829 for (j = 0; j < iface->num_bss; j++) {
830 struct hostapd_data *hapd = iface->bss[j];
831 hostapd_free_stas(hapd);
832 hostapd_flush_old_stations(hapd);
833 hostapd_cleanup(hapd);
838 void hostapd_interface_free(struct hostapd_iface *iface)
841 for (j = 0; j < iface->num_bss; j++)
842 os_free(iface->bss[j]);
843 hostapd_cleanup_iface(iface);
848 * hostapd_new_assoc_sta - Notify that a new station associated with the AP
849 * @hapd: Pointer to BSS data
850 * @sta: Pointer to the associated STA data
851 * @reassoc: 1 to indicate this was a re-association; 0 = first association
853 * This function will be called whenever a station associates with the AP. It
854 * can be called from ieee802_11.c for drivers that export MLME to hostapd and
855 * from drv_callbacks.c based on driver events for drivers that take care of
856 * management frames (IEEE 802.11 authentication and association) internally.
858 void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
861 if (hapd->tkip_countermeasures) {
862 hapd->drv.sta_deauth(hapd, sta->addr,
863 WLAN_REASON_MICHAEL_MIC_FAILURE);
867 hostapd_prune_associations(hapd, sta->addr);
869 /* IEEE 802.11F (IAPP) */
870 if (hapd->conf->ieee802_11f)
871 iapp_new_station(hapd->iapp, sta);
873 /* Start accounting here, if IEEE 802.1X and WPA are not used.
874 * IEEE 802.1X/WPA code will start accounting after the station has
875 * been authorized. */
876 if (!hapd->conf->ieee802_1x && !hapd->conf->wpa)
877 accounting_sta_start(hapd, sta);
879 /* Start IEEE 802.1X authentication process for new stations */
880 ieee802_1x_new_station(hapd, sta);
882 if (sta->auth_alg != WLAN_AUTH_FT &&
883 !(sta->flags & (WLAN_STA_WPS | WLAN_STA_MAYBE_WPS)))
884 wpa_auth_sm_event(sta->wpa_sm, WPA_REAUTH);
886 wpa_auth_sta_associated(hapd->wpa_auth, sta->wpa_sm);