sta_info.c 16 KB

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