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