IEEE 802.11u: Add configuration and advertisement for Interworking
[mech_eap.git] / src / ap / beacon.c
1 /*
2  * hostapd / IEEE 802.11 Management: Beacon and Probe Request/Response
3  * Copyright (c) 2002-2004, Instant802 Networks, Inc.
4  * Copyright (c) 2005-2006, Devicescape Software, Inc.
5  * Copyright (c) 2008-2009, Jouni Malinen <j@w1.fi>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  *
11  * Alternatively, this software may be distributed under the terms of BSD
12  * license.
13  *
14  * See README and COPYING for more details.
15  */
16
17 #include "utils/includes.h"
18
19 #ifndef CONFIG_NATIVE_WINDOWS
20
21 #include "utils/common.h"
22 #include "common/ieee802_11_defs.h"
23 #include "common/ieee802_11_common.h"
24 #include "drivers/driver.h"
25 #include "wps/wps_defs.h"
26 #include "p2p/p2p.h"
27 #include "hostapd.h"
28 #include "ieee802_11.h"
29 #include "wpa_auth.h"
30 #include "wmm.h"
31 #include "ap_config.h"
32 #include "sta_info.h"
33 #include "p2p_hostapd.h"
34 #include "ap_drv_ops.h"
35 #include "beacon.h"
36
37
38 static u8 ieee802_11_erp_info(struct hostapd_data *hapd)
39 {
40         u8 erp = 0;
41
42         if (hapd->iface->current_mode == NULL ||
43             hapd->iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G)
44                 return 0;
45
46         switch (hapd->iconf->cts_protection_type) {
47         case CTS_PROTECTION_FORCE_ENABLED:
48                 erp |= ERP_INFO_NON_ERP_PRESENT | ERP_INFO_USE_PROTECTION;
49                 break;
50         case CTS_PROTECTION_FORCE_DISABLED:
51                 erp = 0;
52                 break;
53         case CTS_PROTECTION_AUTOMATIC:
54                 if (hapd->iface->olbc)
55                         erp |= ERP_INFO_USE_PROTECTION;
56                 /* continue */
57         case CTS_PROTECTION_AUTOMATIC_NO_OLBC:
58                 if (hapd->iface->num_sta_non_erp > 0) {
59                         erp |= ERP_INFO_NON_ERP_PRESENT |
60                                 ERP_INFO_USE_PROTECTION;
61                 }
62                 break;
63         }
64         if (hapd->iface->num_sta_no_short_preamble > 0 ||
65             hapd->iconf->preamble == LONG_PREAMBLE)
66                 erp |= ERP_INFO_BARKER_PREAMBLE_MODE;
67
68         return erp;
69 }
70
71
72 static u8 * hostapd_eid_ds_params(struct hostapd_data *hapd, u8 *eid)
73 {
74         *eid++ = WLAN_EID_DS_PARAMS;
75         *eid++ = 1;
76         *eid++ = hapd->iconf->channel;
77         return eid;
78 }
79
80
81 static u8 * hostapd_eid_erp_info(struct hostapd_data *hapd, u8 *eid)
82 {
83         if (hapd->iface->current_mode == NULL ||
84             hapd->iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G)
85                 return eid;
86
87         /* Set NonERP_present and use_protection bits if there
88          * are any associated NonERP stations. */
89         /* TODO: use_protection bit can be set to zero even if
90          * there are NonERP stations present. This optimization
91          * might be useful if NonERP stations are "quiet".
92          * See 802.11g/D6 E-1 for recommended practice.
93          * In addition, Non ERP present might be set, if AP detects Non ERP
94          * operation on other APs. */
95
96         /* Add ERP Information element */
97         *eid++ = WLAN_EID_ERP_INFO;
98         *eid++ = 1;
99         *eid++ = ieee802_11_erp_info(hapd);
100
101         return eid;
102 }
103
104
105 static u8 * hostapd_eid_country_add(u8 *pos, u8 *end, int chan_spacing,
106                                     struct hostapd_channel_data *start,
107                                     struct hostapd_channel_data *prev)
108 {
109         if (end - pos < 3)
110                 return pos;
111
112         /* first channel number */
113         *pos++ = start->chan;
114         /* number of channels */
115         *pos++ = (prev->chan - start->chan) / chan_spacing + 1;
116         /* maximum transmit power level */
117         *pos++ = start->max_tx_power;
118
119         return pos;
120 }
121
122
123 static u8 * hostapd_eid_country(struct hostapd_data *hapd, u8 *eid,
124                                 int max_len)
125 {
126         u8 *pos = eid;
127         u8 *end = eid + max_len;
128         int i;
129         struct hostapd_hw_modes *mode;
130         struct hostapd_channel_data *start, *prev;
131         int chan_spacing = 1;
132
133         if (!hapd->iconf->ieee80211d || max_len < 6 ||
134             hapd->iface->current_mode == NULL)
135                 return eid;
136
137         *pos++ = WLAN_EID_COUNTRY;
138         pos++; /* length will be set later */
139         os_memcpy(pos, hapd->iconf->country, 3); /* e.g., 'US ' */
140         pos += 3;
141
142         mode = hapd->iface->current_mode;
143         if (mode->mode == HOSTAPD_MODE_IEEE80211A)
144                 chan_spacing = 4;
145
146         start = prev = NULL;
147         for (i = 0; i < mode->num_channels; i++) {
148                 struct hostapd_channel_data *chan = &mode->channels[i];
149                 if (chan->flag & HOSTAPD_CHAN_DISABLED)
150                         continue;
151                 if (start && prev &&
152                     prev->chan + chan_spacing == chan->chan &&
153                     start->max_tx_power == chan->max_tx_power) {
154                         prev = chan;
155                         continue; /* can use same entry */
156                 }
157
158                 if (start) {
159                         pos = hostapd_eid_country_add(pos, end, chan_spacing,
160                                                       start, prev);
161                         start = NULL;
162                 }
163
164                 /* Start new group */
165                 start = prev = chan;
166         }
167
168         if (start) {
169                 pos = hostapd_eid_country_add(pos, end, chan_spacing,
170                                               start, prev);
171         }
172
173         if ((pos - eid) & 1) {
174                 if (end - pos < 1)
175                         return eid;
176                 *pos++ = 0; /* pad for 16-bit alignment */
177         }
178
179         eid[1] = (pos - eid) - 2;
180
181         return pos;
182 }
183
184
185 static u8 * hostapd_eid_wpa(struct hostapd_data *hapd, u8 *eid, size_t len,
186                             struct sta_info *sta)
187 {
188         const u8 *ie;
189         size_t ielen;
190
191         ie = wpa_auth_get_wpa_ie(hapd->wpa_auth, &ielen);
192         if (ie == NULL || ielen > len)
193                 return eid;
194
195         os_memcpy(eid, ie, ielen);
196         return eid + ielen;
197 }
198
199
200 static u8 * hostapd_eid_interworking(struct hostapd_data *hapd, u8 *eid)
201 {
202         u8 *pos = eid;
203 #ifdef CONFIG_INTERWORKING
204         u8 *len;
205
206         if (!hapd->conf->interworking)
207                 return eid;
208
209         *pos++ = WLAN_EID_INTERWORKING;
210         len = pos++;
211
212         *pos = hapd->conf->access_network_type;
213         if (hapd->conf->internet)
214                 *pos |= INTERWORKING_ANO_INTERNET;
215         if (hapd->conf->asra)
216                 *pos |= INTERWORKING_ANO_ASRA;
217         if (hapd->conf->esr)
218                 *pos |= INTERWORKING_ANO_ESR;
219         if (hapd->conf->uesa)
220                 *pos |= INTERWORKING_ANO_UESA;
221         pos++;
222
223         if (hapd->conf->venue_info_set) {
224                 *pos++ = hapd->conf->venue_group;
225                 *pos++ = hapd->conf->venue_type;
226         }
227
228         if (!is_zero_ether_addr(hapd->conf->hessid)) {
229                 os_memcpy(pos, hapd->conf->hessid, ETH_ALEN);
230                 pos += ETH_ALEN;
231         }
232
233         *len = pos - len - 1;
234 #endif /* CONFIG_INTERWORKING */
235
236         return pos;
237 }
238
239
240 void handle_probe_req(struct hostapd_data *hapd,
241                       const struct ieee80211_mgmt *mgmt, size_t len)
242 {
243         struct ieee80211_mgmt *resp;
244         struct ieee802_11_elems elems;
245         char *ssid;
246         u8 *pos, *epos;
247         const u8 *ie;
248         size_t ssid_len, ie_len;
249         struct sta_info *sta = NULL;
250         size_t buflen;
251         size_t i;
252
253         ie = mgmt->u.probe_req.variable;
254         if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.probe_req))
255                 return;
256         ie_len = len - (IEEE80211_HDRLEN + sizeof(mgmt->u.probe_req));
257
258         for (i = 0; hapd->probereq_cb && i < hapd->num_probereq_cb; i++)
259                 if (hapd->probereq_cb[i].cb(hapd->probereq_cb[i].ctx,
260                                             mgmt->sa, mgmt->da, mgmt->bssid,
261                                             ie, ie_len) > 0)
262                         return;
263
264         if (!hapd->iconf->send_probe_response)
265                 return;
266
267         if (ieee802_11_parse_elems(ie, ie_len, &elems, 0) == ParseFailed) {
268                 wpa_printf(MSG_DEBUG, "Could not parse ProbeReq from " MACSTR,
269                            MAC2STR(mgmt->sa));
270                 return;
271         }
272
273         ssid = NULL;
274         ssid_len = 0;
275
276         if ((!elems.ssid || !elems.supp_rates)) {
277                 wpa_printf(MSG_DEBUG, "STA " MACSTR " sent probe request "
278                            "without SSID or supported rates element",
279                            MAC2STR(mgmt->sa));
280                 return;
281         }
282
283 #ifdef CONFIG_P2P
284         if (hapd->p2p && elems.wps_ie) {
285                 struct wpabuf *wps;
286                 wps = ieee802_11_vendor_ie_concat(ie, ie_len, WPS_DEV_OUI_WFA);
287                 if (wps && !p2p_group_match_dev_type(hapd->p2p_group, wps)) {
288                         wpa_printf(MSG_MSGDUMP, "P2P: Ignore Probe Request "
289                                    "due to mismatch with Requested Device "
290                                    "Type");
291                         wpabuf_free(wps);
292                         return;
293                 }
294                 wpabuf_free(wps);
295         }
296 #endif /* CONFIG_P2P */
297
298         if (hapd->conf->ignore_broadcast_ssid && elems.ssid_len == 0) {
299                 wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR " for "
300                            "broadcast SSID ignored", MAC2STR(mgmt->sa));
301                 return;
302         }
303
304         sta = ap_get_sta(hapd, mgmt->sa);
305
306 #ifdef CONFIG_P2P
307         if ((hapd->conf->p2p & P2P_GROUP_OWNER) &&
308             elems.ssid_len == P2P_WILDCARD_SSID_LEN &&
309             os_memcmp(elems.ssid, P2P_WILDCARD_SSID,
310                       P2P_WILDCARD_SSID_LEN) == 0) {
311                 /* Process P2P Wildcard SSID like Wildcard SSID */
312                 elems.ssid_len = 0;
313         }
314 #endif /* CONFIG_P2P */
315
316         if (elems.ssid_len == 0 ||
317             (elems.ssid_len == hapd->conf->ssid.ssid_len &&
318              os_memcmp(elems.ssid, hapd->conf->ssid.ssid, elems.ssid_len) ==
319              0)) {
320                 ssid = hapd->conf->ssid.ssid;
321                 ssid_len = hapd->conf->ssid.ssid_len;
322                 if (sta)
323                         sta->ssid_probe = &hapd->conf->ssid;
324         }
325
326         if (!ssid) {
327                 if (!(mgmt->da[0] & 0x01)) {
328                         char ssid_txt[33];
329                         ieee802_11_print_ssid(ssid_txt, elems.ssid,
330                                               elems.ssid_len);
331                         wpa_printf(MSG_MSGDUMP, "Probe Request from " MACSTR
332                                    " for foreign SSID '%s' (DA " MACSTR ")",
333                                    MAC2STR(mgmt->sa), ssid_txt,
334                                    MAC2STR(mgmt->da));
335                 }
336                 return;
337         }
338
339         /* TODO: verify that supp_rates contains at least one matching rate
340          * with AP configuration */
341 #define MAX_PROBERESP_LEN 768
342         buflen = MAX_PROBERESP_LEN;
343 #ifdef CONFIG_WPS
344         if (hapd->wps_probe_resp_ie)
345                 buflen += wpabuf_len(hapd->wps_probe_resp_ie);
346 #endif /* CONFIG_WPS */
347 #ifdef CONFIG_P2P
348         if (hapd->p2p_probe_resp_ie)
349                 buflen += wpabuf_len(hapd->p2p_probe_resp_ie);
350 #endif /* CONFIG_P2P */
351         resp = os_zalloc(buflen);
352         if (resp == NULL)
353                 return;
354         epos = ((u8 *) resp) + MAX_PROBERESP_LEN;
355
356         resp->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
357                                            WLAN_FC_STYPE_PROBE_RESP);
358         os_memcpy(resp->da, mgmt->sa, ETH_ALEN);
359         os_memcpy(resp->sa, hapd->own_addr, ETH_ALEN);
360
361         os_memcpy(resp->bssid, hapd->own_addr, ETH_ALEN);
362         resp->u.probe_resp.beacon_int =
363                 host_to_le16(hapd->iconf->beacon_int);
364
365         /* hardware or low-level driver will setup seq_ctrl and timestamp */
366         resp->u.probe_resp.capab_info =
367                 host_to_le16(hostapd_own_capab_info(hapd, sta, 1));
368
369         pos = resp->u.probe_resp.variable;
370         *pos++ = WLAN_EID_SSID;
371         *pos++ = ssid_len;
372         os_memcpy(pos, ssid, ssid_len);
373         pos += ssid_len;
374
375         /* Supported rates */
376         pos = hostapd_eid_supp_rates(hapd, pos);
377
378         /* DS Params */
379         pos = hostapd_eid_ds_params(hapd, pos);
380
381         pos = hostapd_eid_country(hapd, pos, epos - pos);
382
383         /* ERP Information element */
384         pos = hostapd_eid_erp_info(hapd, pos);
385
386         /* Extended supported rates */
387         pos = hostapd_eid_ext_supp_rates(hapd, pos);
388
389         /* RSN, MDIE, WPA */
390         pos = hostapd_eid_wpa(hapd, pos, epos - pos, sta);
391
392 #ifdef CONFIG_IEEE80211N
393         pos = hostapd_eid_ht_capabilities(hapd, pos);
394         pos = hostapd_eid_ht_operation(hapd, pos);
395 #endif /* CONFIG_IEEE80211N */
396
397         pos = hostapd_eid_ext_capab(hapd, pos);
398
399         pos = hostapd_eid_interworking(hapd, pos);
400
401         /* Wi-Fi Alliance WMM */
402         pos = hostapd_eid_wmm(hapd, pos);
403
404 #ifdef CONFIG_WPS
405         if (hapd->conf->wps_state && hapd->wps_probe_resp_ie) {
406                 os_memcpy(pos, wpabuf_head(hapd->wps_probe_resp_ie),
407                           wpabuf_len(hapd->wps_probe_resp_ie));
408                 pos += wpabuf_len(hapd->wps_probe_resp_ie);
409         }
410 #endif /* CONFIG_WPS */
411
412 #ifdef CONFIG_P2P
413         if ((hapd->conf->p2p & P2P_ENABLED) && elems.p2p &&
414             hapd->p2p_probe_resp_ie) {
415                 os_memcpy(pos, wpabuf_head(hapd->p2p_probe_resp_ie),
416                           wpabuf_len(hapd->p2p_probe_resp_ie));
417                 pos += wpabuf_len(hapd->p2p_probe_resp_ie);
418         }
419 #endif /* CONFIG_P2P */
420 #ifdef CONFIG_P2P_MANAGER
421         if ((hapd->conf->p2p & (P2P_MANAGE | P2P_ENABLED | P2P_GROUP_OWNER)) ==
422             P2P_MANAGE)
423                 pos = hostapd_eid_p2p_manage(hapd, pos);
424 #endif /* CONFIG_P2P_MANAGER */
425
426         if (hostapd_drv_send_mlme(hapd, resp, pos - (u8 *) resp) < 0)
427                 perror("handle_probe_req: send");
428
429         os_free(resp);
430
431         wpa_printf(MSG_EXCESSIVE, "STA " MACSTR " sent probe request for %s "
432                    "SSID", MAC2STR(mgmt->sa),
433                    elems.ssid_len == 0 ? "broadcast" : "our");
434 }
435
436
437 void ieee802_11_set_beacon(struct hostapd_data *hapd)
438 {
439         struct ieee80211_mgmt *head;
440         u8 *pos, *tail, *tailpos;
441         u16 capab_info;
442         size_t head_len, tail_len;
443         struct wpa_driver_ap_params params;
444         struct wpabuf *beacon, *proberesp, *assocresp;
445
446 #ifdef CONFIG_P2P
447         if ((hapd->conf->p2p & (P2P_ENABLED | P2P_GROUP_OWNER)) == P2P_ENABLED)
448                 goto no_beacon;
449 #endif /* CONFIG_P2P */
450         hapd->beacon_set_done = 1;
451
452 #define BEACON_HEAD_BUF_SIZE 256
453 #define BEACON_TAIL_BUF_SIZE 512
454         head = os_zalloc(BEACON_HEAD_BUF_SIZE);
455         tail_len = BEACON_TAIL_BUF_SIZE;
456 #ifdef CONFIG_WPS
457         if (hapd->conf->wps_state && hapd->wps_beacon_ie)
458                 tail_len += wpabuf_len(hapd->wps_beacon_ie);
459 #endif /* CONFIG_WPS */
460 #ifdef CONFIG_P2P
461         if (hapd->p2p_beacon_ie)
462                 tail_len += wpabuf_len(hapd->p2p_beacon_ie);
463 #endif /* CONFIG_P2P */
464         tailpos = tail = os_malloc(tail_len);
465         if (head == NULL || tail == NULL) {
466                 wpa_printf(MSG_ERROR, "Failed to set beacon data");
467                 os_free(head);
468                 os_free(tail);
469                 return;
470         }
471
472         head->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
473                                            WLAN_FC_STYPE_BEACON);
474         head->duration = host_to_le16(0);
475         os_memset(head->da, 0xff, ETH_ALEN);
476
477         os_memcpy(head->sa, hapd->own_addr, ETH_ALEN);
478         os_memcpy(head->bssid, hapd->own_addr, ETH_ALEN);
479         head->u.beacon.beacon_int =
480                 host_to_le16(hapd->iconf->beacon_int);
481
482         /* hardware or low-level driver will setup seq_ctrl and timestamp */
483         capab_info = hostapd_own_capab_info(hapd, NULL, 0);
484         head->u.beacon.capab_info = host_to_le16(capab_info);
485         pos = &head->u.beacon.variable[0];
486
487         /* SSID */
488         *pos++ = WLAN_EID_SSID;
489         if (hapd->conf->ignore_broadcast_ssid == 2) {
490                 /* clear the data, but keep the correct length of the SSID */
491                 *pos++ = hapd->conf->ssid.ssid_len;
492                 os_memset(pos, 0, hapd->conf->ssid.ssid_len);
493                 pos += hapd->conf->ssid.ssid_len;
494         } else if (hapd->conf->ignore_broadcast_ssid) {
495                 *pos++ = 0; /* empty SSID */
496         } else {
497                 *pos++ = hapd->conf->ssid.ssid_len;
498                 os_memcpy(pos, hapd->conf->ssid.ssid,
499                           hapd->conf->ssid.ssid_len);
500                 pos += hapd->conf->ssid.ssid_len;
501         }
502
503         /* Supported rates */
504         pos = hostapd_eid_supp_rates(hapd, pos);
505
506         /* DS Params */
507         pos = hostapd_eid_ds_params(hapd, pos);
508
509         head_len = pos - (u8 *) head;
510
511         tailpos = hostapd_eid_country(hapd, tailpos,
512                                       tail + BEACON_TAIL_BUF_SIZE - tailpos);
513
514         /* ERP Information element */
515         tailpos = hostapd_eid_erp_info(hapd, tailpos);
516
517         /* Extended supported rates */
518         tailpos = hostapd_eid_ext_supp_rates(hapd, tailpos);
519
520         /* RSN, MDIE, WPA */
521         tailpos = hostapd_eid_wpa(hapd, tailpos, tail + BEACON_TAIL_BUF_SIZE -
522                                   tailpos, NULL);
523
524 #ifdef CONFIG_IEEE80211N
525         tailpos = hostapd_eid_ht_capabilities(hapd, tailpos);
526         tailpos = hostapd_eid_ht_operation(hapd, tailpos);
527 #endif /* CONFIG_IEEE80211N */
528
529         tailpos = hostapd_eid_ext_capab(hapd, tailpos);
530
531         tailpos = hostapd_eid_interworking(hapd, tailpos);
532
533         /* Wi-Fi Alliance WMM */
534         tailpos = hostapd_eid_wmm(hapd, tailpos);
535
536 #ifdef CONFIG_WPS
537         if (hapd->conf->wps_state && hapd->wps_beacon_ie) {
538                 os_memcpy(tailpos, wpabuf_head(hapd->wps_beacon_ie),
539                           wpabuf_len(hapd->wps_beacon_ie));
540                 tailpos += wpabuf_len(hapd->wps_beacon_ie);
541         }
542 #endif /* CONFIG_WPS */
543
544 #ifdef CONFIG_P2P
545         if ((hapd->conf->p2p & P2P_ENABLED) && hapd->p2p_beacon_ie) {
546                 os_memcpy(tailpos, wpabuf_head(hapd->p2p_beacon_ie),
547                           wpabuf_len(hapd->p2p_beacon_ie));
548                 tailpos += wpabuf_len(hapd->p2p_beacon_ie);
549         }
550 #endif /* CONFIG_P2P */
551 #ifdef CONFIG_P2P_MANAGER
552         if ((hapd->conf->p2p & (P2P_MANAGE | P2P_ENABLED | P2P_GROUP_OWNER)) ==
553             P2P_MANAGE)
554                 tailpos = hostapd_eid_p2p_manage(hapd, tailpos);
555 #endif /* CONFIG_P2P_MANAGER */
556
557         tail_len = tailpos > tail ? tailpos - tail : 0;
558
559         os_memset(&params, 0, sizeof(params));
560         params.head = (u8 *) head;
561         params.head_len = head_len;
562         params.tail = tail;
563         params.tail_len = tail_len;
564         params.dtim_period = hapd->conf->dtim_period;
565         params.beacon_int = hapd->iconf->beacon_int;
566         params.ssid = (u8 *) hapd->conf->ssid.ssid;
567         params.ssid_len = hapd->conf->ssid.ssid_len;
568         params.pairwise_ciphers = hapd->conf->rsn_pairwise ?
569                 hapd->conf->rsn_pairwise : hapd->conf->wpa_pairwise;
570         params.group_cipher = hapd->conf->wpa_group;
571         params.key_mgmt_suites = hapd->conf->wpa_key_mgmt;
572         params.auth_algs = hapd->conf->auth_algs;
573         params.wpa_version = hapd->conf->wpa;
574         params.privacy = hapd->conf->ssid.wep.keys_set || hapd->conf->wpa ||
575                 (hapd->conf->ieee802_1x &&
576                  (hapd->conf->default_wep_key_len ||
577                   hapd->conf->individual_wep_key_len));
578         switch (hapd->conf->ignore_broadcast_ssid) {
579         case 0:
580                 params.hide_ssid = NO_SSID_HIDING;
581                 break;
582         case 1:
583                 params.hide_ssid = HIDDEN_SSID_ZERO_LEN;
584                 break;
585         case 2:
586                 params.hide_ssid = HIDDEN_SSID_ZERO_CONTENTS;
587                 break;
588         }
589         hostapd_build_ap_extra_ies(hapd, &beacon, &proberesp, &assocresp);
590         params.beacon_ies = beacon;
591         params.proberesp_ies = proberesp;
592         params.assocresp_ies = assocresp;
593         if (hostapd_drv_set_ap(hapd, &params))
594                 wpa_printf(MSG_ERROR, "Failed to set beacon parameters");
595         hostapd_free_ap_extra_ies(hapd, beacon, proberesp, assocresp);
596
597         os_free(tail);
598         os_free(head);
599
600 #ifdef CONFIG_P2P
601 no_beacon:
602 #endif /* CONFIG_P2P */
603         hostapd_set_bss_params(hapd, !!(ieee802_11_erp_info(hapd) &
604                                         ERP_INFO_USE_PROTECTION));
605 }
606
607
608 void ieee802_11_set_beacons(struct hostapd_iface *iface)
609 {
610         size_t i;
611         for (i = 0; i < iface->num_bss; i++)
612                 ieee802_11_set_beacon(iface->bss[i]);
613 }
614
615 #endif /* CONFIG_NATIVE_WINDOWS */