Add preliminary IEEE 802.11n support into hostapd
[wpasupplicant] / hostapd / sta_info.c
1 /*
2  * hostapd / Station table
3  * Copyright (c) 2002-2007, 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
15 #include "includes.h"
16
17 #include "hostapd.h"
18 #include "sta_info.h"
19 #include "eloop.h"
20 #include "accounting.h"
21 #include "ieee802_1x.h"
22 #include "ieee802_11.h"
23 #include "radius/radius.h"
24 #include "wpa.h"
25 #include "preauth.h"
26 #include "radius/radius_client.h"
27 #include "driver.h"
28 #include "beacon.h"
29 #include "hw_features.h"
30 #include "mlme.h"
31 #include "vlan_init.h"
32
33 static int ap_sta_in_other_bss(struct hostapd_data *hapd,
34                                struct sta_info *sta, u32 flags);
35 static void ap_handle_session_timer(void *eloop_ctx, void *timeout_ctx);
36
37 int ap_for_each_sta(struct hostapd_data *hapd,
38                     int (*cb)(struct hostapd_data *hapd, struct sta_info *sta,
39                               void *ctx),
40                     void *ctx)
41 {
42         struct sta_info *sta;
43
44         for (sta = hapd->sta_list; sta; sta = sta->next) {
45                 if (cb(hapd, sta, ctx))
46                         return 1;
47         }
48
49         return 0;
50 }
51
52
53 struct sta_info * ap_get_sta(struct hostapd_data *hapd, const u8 *sta)
54 {
55         struct sta_info *s;
56
57         s = hapd->sta_hash[STA_HASH(sta)];
58         while (s != NULL && os_memcmp(s->addr, sta, 6) != 0)
59                 s = s->hnext;
60         return s;
61 }
62
63
64 static void ap_sta_list_del(struct hostapd_data *hapd, struct sta_info *sta)
65 {
66         struct sta_info *tmp;
67
68         if (hapd->sta_list == sta) {
69                 hapd->sta_list = sta->next;
70                 return;
71         }
72
73         tmp = hapd->sta_list;
74         while (tmp != NULL && tmp->next != sta)
75                 tmp = tmp->next;
76         if (tmp == NULL) {
77                 wpa_printf(MSG_DEBUG, "Could not remove STA " MACSTR " from "
78                            "list.", MAC2STR(sta->addr));
79         } else
80                 tmp->next = sta->next;
81 }
82
83
84 void ap_sta_hash_add(struct hostapd_data *hapd, struct sta_info *sta)
85 {
86         sta->hnext = hapd->sta_hash[STA_HASH(sta->addr)];
87         hapd->sta_hash[STA_HASH(sta->addr)] = sta;
88 }
89
90
91 static void ap_sta_hash_del(struct hostapd_data *hapd, struct sta_info *sta)
92 {
93         struct sta_info *s;
94
95         s = hapd->sta_hash[STA_HASH(sta->addr)];
96         if (s == NULL) return;
97         if (os_memcmp(s->addr, sta->addr, 6) == 0) {
98                 hapd->sta_hash[STA_HASH(sta->addr)] = s->hnext;
99                 return;
100         }
101
102         while (s->hnext != NULL &&
103                os_memcmp(s->hnext->addr, sta->addr, ETH_ALEN) != 0)
104                 s = s->hnext;
105         if (s->hnext != NULL)
106                 s->hnext = s->hnext->hnext;
107         else
108                 wpa_printf(MSG_DEBUG, "AP: could not remove STA " MACSTR
109                            " from hash table", MAC2STR(sta->addr));
110 }
111
112
113 void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
114 {
115         int set_beacon = 0;
116
117         accounting_sta_stop(hapd, sta);
118
119         if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC) &&
120             !(sta->flags & WLAN_STA_PREAUTH))
121                 hostapd_sta_remove(hapd, sta->addr);
122
123         ap_sta_hash_del(hapd, sta);
124         ap_sta_list_del(hapd, sta);
125
126         if (sta->aid > 0)
127                 hapd->sta_aid[sta->aid - 1] = NULL;
128
129         hapd->num_sta--;
130         if (sta->nonerp_set) {
131                 sta->nonerp_set = 0;
132                 hapd->iface->num_sta_non_erp--;
133                 if (hapd->iface->num_sta_non_erp == 0)
134                         set_beacon++;
135         }
136
137         if (sta->no_short_slot_time_set) {
138                 sta->no_short_slot_time_set = 0;
139                 hapd->iface->num_sta_no_short_slot_time--;
140                 if (hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G
141                     && hapd->iface->num_sta_no_short_slot_time == 0)
142                         set_beacon++;
143         }
144
145         if (sta->no_short_preamble_set) {
146                 sta->no_short_preamble_set = 0;
147                 hapd->iface->num_sta_no_short_preamble--;
148                 if (hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G
149                     && hapd->iface->num_sta_no_short_preamble == 0)
150                         set_beacon++;
151         }
152
153 #ifdef CONFIG_IEEE80211N
154         if (sta->flags & WLAN_STA_HT) {
155                 if ((sta->ht_capabilities.data.capabilities_info &
156                      HT_CAP_INFO_GREEN_FIELD) == 0)
157                         hapd->iface->num_sta_ht_no_gf--;
158                 if ((sta->ht_capabilities.data.capabilities_info &
159                      HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET) == 0)
160                         hapd->iface->num_sta_ht_20mhz--;
161         } else
162                 hapd->iface->num_sta_no_ht--;
163
164         if (hostapd_ht_operation_update(hapd->iface) > 0)
165                 set_beacon++;
166 #endif /* CONFIG_IEEE80211N */
167
168         if (set_beacon)
169                 ieee802_11_set_beacons(hapd->iface);
170
171         eloop_cancel_timeout(ap_handle_timer, hapd, sta);
172         eloop_cancel_timeout(ap_handle_session_timer, hapd, sta);
173
174         ieee802_1x_free_station(sta);
175         wpa_auth_sta_deinit(sta->wpa_sm);
176         rsn_preauth_free_station(hapd, sta);
177         radius_client_flush_auth(hapd->radius, sta->addr);
178
179         os_free(sta->last_assoc_req);
180         os_free(sta->challenge);
181         os_free(sta);
182 }
183
184
185 void hostapd_free_stas(struct hostapd_data *hapd)
186 {
187         struct sta_info *sta, *prev;
188
189         sta = hapd->sta_list;
190
191         while (sta) {
192                 prev = sta;
193                 if (sta->flags & WLAN_STA_AUTH) {
194                         mlme_deauthenticate_indication(
195                                 hapd, sta, WLAN_REASON_UNSPECIFIED);
196                 }
197                 sta = sta->next;
198                 wpa_printf(MSG_DEBUG, "Removing station " MACSTR,
199                            MAC2STR(prev->addr));
200                 ap_free_sta(hapd, prev);
201         }
202 }
203
204
205 void ap_handle_timer(void *eloop_ctx, void *timeout_ctx)
206 {
207         struct hostapd_data *hapd = eloop_ctx;
208         struct sta_info *sta = timeout_ctx;
209         unsigned long next_time = 0;
210
211         if (sta->timeout_next == STA_REMOVE) {
212                 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
213                                HOSTAPD_LEVEL_INFO, "deauthenticated due to "
214                                "local deauth request");
215                 ap_free_sta(hapd, sta);
216                 return;
217         }
218
219         if ((sta->flags & WLAN_STA_ASSOC) &&
220             (sta->timeout_next == STA_NULLFUNC ||
221              sta->timeout_next == STA_DISASSOC)) {
222                 int inactive_sec;
223                 wpa_printf(MSG_DEBUG, "Checking STA " MACSTR " inactivity:",
224                            MAC2STR(sta->addr));
225                 inactive_sec = hostapd_get_inact_sec(hapd, sta->addr);
226                 if (inactive_sec == -1) {
227                         wpa_printf(MSG_DEBUG, "Could not get station info "
228                                    "from kernel driver for " MACSTR ".",
229                                    MAC2STR(sta->addr));
230                 } else if (inactive_sec < hapd->conf->ap_max_inactivity &&
231                            sta->flags & WLAN_STA_ASSOC) {
232                         /* station activity detected; reset timeout state */
233                         wpa_printf(MSG_DEBUG, "  Station has been active");
234                         sta->timeout_next = STA_NULLFUNC;
235                         next_time = hapd->conf->ap_max_inactivity -
236                                 inactive_sec;
237                 }
238         }
239
240         if ((sta->flags & WLAN_STA_ASSOC) &&
241             sta->timeout_next == STA_DISASSOC &&
242             !(sta->flags & WLAN_STA_PENDING_POLL)) {
243                 wpa_printf(MSG_DEBUG, "  Station has ACKed data poll");
244                 /* data nullfunc frame poll did not produce TX errors; assume
245                  * station ACKed it */
246                 sta->timeout_next = STA_NULLFUNC;
247                 next_time = hapd->conf->ap_max_inactivity;
248         }
249
250         if (next_time) {
251                 eloop_register_timeout(next_time, 0, ap_handle_timer, hapd,
252                                        sta);
253                 return;
254         }
255
256         if (sta->timeout_next == STA_NULLFUNC &&
257             (sta->flags & WLAN_STA_ASSOC)) {
258                 /* send data frame to poll STA and check whether this frame
259                  * is ACKed */
260                 struct ieee80211_hdr hdr;
261
262                 wpa_printf(MSG_DEBUG, "  Polling STA with data frame");
263                 sta->flags |= WLAN_STA_PENDING_POLL;
264
265 #ifndef CONFIG_NATIVE_WINDOWS
266                 /* FIX: WLAN_FC_STYPE_NULLFUNC would be more appropriate, but
267                  * it is apparently not retried so TX Exc events are not
268                  * received for it */
269                 os_memset(&hdr, 0, sizeof(hdr));
270                 hdr.frame_control =
271                         IEEE80211_FC(WLAN_FC_TYPE_DATA, WLAN_FC_STYPE_DATA);
272                 hdr.frame_control |= host_to_le16(BIT(1));
273                 hdr.frame_control |= host_to_le16(WLAN_FC_FROMDS);
274                 os_memcpy(hdr.IEEE80211_DA_FROMDS, sta->addr, ETH_ALEN);
275                 os_memcpy(hdr.IEEE80211_BSSID_FROMDS, hapd->own_addr,
276                           ETH_ALEN);
277                 os_memcpy(hdr.IEEE80211_SA_FROMDS, hapd->own_addr, ETH_ALEN);
278
279                 if (hostapd_send_mgmt_frame(hapd, &hdr, sizeof(hdr), 0) < 0)
280                         perror("ap_handle_timer: send");
281 #endif /* CONFIG_NATIVE_WINDOWS */
282         } else if (sta->timeout_next != STA_REMOVE) {
283                 int deauth = sta->timeout_next == STA_DEAUTH;
284
285                 wpa_printf(MSG_DEBUG, "Sending %s info to STA " MACSTR,
286                            deauth ? "deauthentication" : "disassociation",
287                            MAC2STR(sta->addr));
288
289                 if (deauth) {
290                         hostapd_sta_deauth(hapd, sta->addr,
291                                            WLAN_REASON_PREV_AUTH_NOT_VALID);
292                 } else {
293                         hostapd_sta_disassoc(
294                                 hapd, sta->addr,
295                                 WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY);
296                 }
297         }
298
299         switch (sta->timeout_next) {
300         case STA_NULLFUNC:
301                 sta->timeout_next = STA_DISASSOC;
302                 eloop_register_timeout(AP_DISASSOC_DELAY, 0, ap_handle_timer,
303                                        hapd, sta);
304                 break;
305         case STA_DISASSOC:
306                 sta->flags &= ~WLAN_STA_ASSOC;
307                 ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);
308                 if (!sta->acct_terminate_cause)
309                         sta->acct_terminate_cause =
310                                 RADIUS_ACCT_TERMINATE_CAUSE_IDLE_TIMEOUT;
311                 accounting_sta_stop(hapd, sta);
312                 ieee802_1x_free_station(sta);
313                 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
314                                HOSTAPD_LEVEL_INFO, "disassociated due to "
315                                "inactivity");
316                 sta->timeout_next = STA_DEAUTH;
317                 eloop_register_timeout(AP_DEAUTH_DELAY, 0, ap_handle_timer,
318                                        hapd, sta);
319                 mlme_disassociate_indication(
320                         hapd, sta, WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY);
321                 break;
322         case STA_DEAUTH:
323         case STA_REMOVE:
324                 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
325                                HOSTAPD_LEVEL_INFO, "deauthenticated due to "
326                                "inactivity");
327                 if (!sta->acct_terminate_cause)
328                         sta->acct_terminate_cause =
329                                 RADIUS_ACCT_TERMINATE_CAUSE_IDLE_TIMEOUT;
330                 mlme_deauthenticate_indication(
331                         hapd, sta,
332                         WLAN_REASON_PREV_AUTH_NOT_VALID);
333                 ap_free_sta(hapd, sta);
334                 break;
335         }
336 }
337
338
339 static void ap_handle_session_timer(void *eloop_ctx, void *timeout_ctx)
340 {
341         struct hostapd_data *hapd = eloop_ctx;
342         struct sta_info *sta = timeout_ctx;
343         u8 addr[ETH_ALEN];
344
345         if (!(sta->flags & WLAN_STA_AUTH))
346                 return;
347
348         mlme_deauthenticate_indication(hapd, sta,
349                                        WLAN_REASON_PREV_AUTH_NOT_VALID);
350         hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
351                        HOSTAPD_LEVEL_INFO, "deauthenticated due to "
352                        "session timeout");
353         sta->acct_terminate_cause =
354                 RADIUS_ACCT_TERMINATE_CAUSE_SESSION_TIMEOUT;
355         os_memcpy(addr, sta->addr, ETH_ALEN);
356         ap_free_sta(hapd, sta);
357         hostapd_sta_deauth(hapd, addr, WLAN_REASON_PREV_AUTH_NOT_VALID);
358 }
359
360
361 void ap_sta_session_timeout(struct hostapd_data *hapd, struct sta_info *sta,
362                             u32 session_timeout)
363 {
364         hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
365                        HOSTAPD_LEVEL_DEBUG, "setting session timeout to %d "
366                        "seconds", session_timeout);
367         eloop_cancel_timeout(ap_handle_session_timer, hapd, sta);
368         eloop_register_timeout(session_timeout, 0, ap_handle_session_timer,
369                                hapd, sta);
370 }
371
372
373 void ap_sta_no_session_timeout(struct hostapd_data *hapd, struct sta_info *sta)
374 {
375         eloop_cancel_timeout(ap_handle_session_timer, hapd, sta);
376 }
377
378
379 struct sta_info * ap_sta_add(struct hostapd_data *hapd, const u8 *addr)
380 {
381         struct sta_info *sta;
382
383         sta = ap_get_sta(hapd, addr);
384         if (sta)
385                 return sta;
386
387         wpa_printf(MSG_DEBUG, "  New STA");
388         if (hapd->num_sta >= hapd->conf->max_num_sta) {
389                 /* FIX: might try to remove some old STAs first? */
390                 wpa_printf(MSG_DEBUG, "no more room for new STAs (%d/%d)",
391                            hapd->num_sta, hapd->conf->max_num_sta);
392                 return NULL;
393         }
394
395         sta = os_zalloc(sizeof(struct sta_info));
396         if (sta == NULL) {
397                 wpa_printf(MSG_ERROR, "malloc failed");
398                 return NULL;
399         }
400         sta->acct_interim_interval = hapd->conf->radius->acct_interim_interval;
401
402         /* initialize STA info data */
403         eloop_register_timeout(hapd->conf->ap_max_inactivity, 0,
404                                ap_handle_timer, hapd, sta);
405         os_memcpy(sta->addr, addr, ETH_ALEN);
406         sta->next = hapd->sta_list;
407         hapd->sta_list = sta;
408         hapd->num_sta++;
409         ap_sta_hash_add(hapd, sta);
410         sta->ssid = &hapd->conf->ssid;
411
412         return sta;
413 }
414
415
416 static int ap_sta_remove(struct hostapd_data *hapd, struct sta_info *sta)
417 {
418         ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);
419
420         wpa_printf(MSG_DEBUG, "Removing STA " MACSTR " from kernel driver",
421                    MAC2STR(sta->addr));
422         if (hostapd_sta_remove(hapd, sta->addr) &&
423             sta->flags & WLAN_STA_ASSOC) {
424                 wpa_printf(MSG_DEBUG, "Could not remove station " MACSTR
425                            " from kernel driver.", MAC2STR(sta->addr));
426                 return -1;
427         }
428         return 0;
429 }
430
431
432 static int ap_sta_in_other_bss(struct hostapd_data *hapd,
433                                struct sta_info *sta, u32 flags)
434 {
435         struct hostapd_iface *iface = hapd->iface;
436         size_t i;
437
438         for (i = 0; i < iface->num_bss; i++) {
439                 struct hostapd_data *bss = iface->bss[i];
440                 struct sta_info *sta2;
441                 /* bss should always be set during operation, but it may be
442                  * NULL during reconfiguration. Assume the STA is not
443                  * associated to another BSS in that case to avoid NULL pointer
444                  * dereferences. */
445                 if (bss == hapd || bss == NULL)
446                         continue;
447                 sta2 = ap_get_sta(bss, sta->addr);
448                 if (sta2 && ((sta2->flags & flags) == flags))
449                         return 1;
450         }
451
452         return 0;
453 }
454
455
456 void ap_sta_disassociate(struct hostapd_data *hapd, struct sta_info *sta,
457                          u16 reason)
458 {
459         wpa_printf(MSG_DEBUG, "%s: disassociate STA " MACSTR,
460                    hapd->conf->iface, MAC2STR(sta->addr));
461         sta->flags &= ~WLAN_STA_ASSOC;
462         if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC))
463                 ap_sta_remove(hapd, sta);
464         sta->timeout_next = STA_DEAUTH;
465         eloop_cancel_timeout(ap_handle_timer, hapd, sta);
466         eloop_register_timeout(AP_MAX_INACTIVITY_AFTER_DISASSOC, 0,
467                                ap_handle_timer, hapd, sta);
468         accounting_sta_stop(hapd, sta);
469         ieee802_1x_free_station(sta);
470
471         mlme_disassociate_indication(hapd, sta, reason);
472 }
473
474
475 void ap_sta_deauthenticate(struct hostapd_data *hapd, struct sta_info *sta,
476                            u16 reason)
477 {
478         wpa_printf(MSG_DEBUG, "%s: deauthenticate STA " MACSTR,
479                    hapd->conf->iface, MAC2STR(sta->addr));
480         sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC);
481         if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC))
482                 ap_sta_remove(hapd, sta);
483         sta->timeout_next = STA_REMOVE;
484         eloop_cancel_timeout(ap_handle_timer, hapd, sta);
485         eloop_register_timeout(AP_MAX_INACTIVITY_AFTER_DEAUTH, 0,
486                                ap_handle_timer, hapd, sta);
487         accounting_sta_stop(hapd, sta);
488         ieee802_1x_free_station(sta);
489
490         mlme_deauthenticate_indication(hapd, sta, reason);
491 }
492
493
494 int ap_sta_bind_vlan(struct hostapd_data *hapd, struct sta_info *sta,
495                      int old_vlanid)
496 {
497         const char *iface;
498         struct hostapd_vlan *vlan = NULL;
499
500         /*
501          * Do not proceed furthur if the vlan id remains same. We do not want
502          * duplicate dynamic vlan entries.
503          */
504         if (sta->vlan_id == old_vlanid)
505                 return 0;
506
507         /*
508          * During 1x reauth, if the vlan id changes, then remove the old id and
509          * proceed furthur to add the new one.
510          */
511         if (old_vlanid > 0)
512                 vlan_remove_dynamic(hapd, old_vlanid);
513
514         iface = hapd->conf->iface;
515         if (sta->ssid->vlan[0])
516                 iface = sta->ssid->vlan;
517
518         if (sta->ssid->dynamic_vlan == DYNAMIC_VLAN_DISABLED)
519                 sta->vlan_id = 0;
520         else if (sta->vlan_id > 0) {
521                 vlan = hapd->conf->vlan;
522                 while (vlan) {
523                         if (vlan->vlan_id == sta->vlan_id ||
524                             vlan->vlan_id == VLAN_ID_WILDCARD) {
525                                 iface = vlan->ifname;
526                                 break;
527                         }
528                         vlan = vlan->next;
529                 }
530         }
531
532         if (sta->vlan_id > 0 && vlan == NULL) {
533                 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
534                                HOSTAPD_LEVEL_DEBUG, "could not find VLAN for "
535                                "binding station to (vlan_id=%d)",
536                                sta->vlan_id);
537                 return -1;
538         } else if (sta->vlan_id > 0 && vlan->vlan_id == VLAN_ID_WILDCARD) {
539                 vlan = vlan_add_dynamic(hapd, vlan, sta->vlan_id);
540                 if (vlan == NULL) {
541                         hostapd_logger(hapd, sta->addr,
542                                        HOSTAPD_MODULE_IEEE80211,
543                                        HOSTAPD_LEVEL_DEBUG, "could not add "
544                                        "dynamic VLAN interface for vlan_id=%d",
545                                        sta->vlan_id);
546                         return -1;
547                 }
548
549                 iface = vlan->ifname;
550                 if (vlan_setup_encryption_dyn(hapd, sta->ssid, iface) != 0) {
551                         hostapd_logger(hapd, sta->addr,
552                                        HOSTAPD_MODULE_IEEE80211,
553                                        HOSTAPD_LEVEL_DEBUG, "could not "
554                                        "configure encryption for dynamic VLAN "
555                                        "interface for vlan_id=%d",
556                                        sta->vlan_id);
557                 }
558
559                 hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
560                                HOSTAPD_LEVEL_DEBUG, "added new dynamic VLAN "
561                                "interface '%s'", iface);
562         } else if (vlan && vlan->vlan_id == sta->vlan_id) {
563                 if (sta->vlan_id > 0) {
564                         vlan->dynamic_vlan++;
565                         hostapd_logger(hapd, sta->addr,
566                                        HOSTAPD_MODULE_IEEE80211,
567                                        HOSTAPD_LEVEL_DEBUG, "updated existing "
568                                        "dynamic VLAN interface '%s'", iface);
569                 }
570
571                 /*
572                  * Update encryption configuration for statically generated
573                  * VLAN interface. This is only used for static WEP
574                  * configuration for the case where hostapd did not yet know
575                  * which keys are to be used when the interface was added.
576                  */
577                 if (vlan_setup_encryption_dyn(hapd, sta->ssid, iface) != 0) {
578                         hostapd_logger(hapd, sta->addr,
579                                        HOSTAPD_MODULE_IEEE80211,
580                                        HOSTAPD_LEVEL_DEBUG, "could not "
581                                        "configure encryption for VLAN "
582                                        "interface for vlan_id=%d",
583                                        sta->vlan_id);
584                 }
585         }
586
587         hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
588                        HOSTAPD_LEVEL_DEBUG, "binding station to interface "
589                        "'%s'", iface);
590
591         if (wpa_auth_sta_set_vlan(sta->wpa_sm, sta->vlan_id) < 0)
592                 wpa_printf(MSG_INFO, "Failed to update VLAN-ID for WPA");
593
594         return hostapd_set_sta_vlan(iface, hapd, sta->addr, sta->vlan_id);
595 }