Lines Matching refs:hapd

39 static u8 * hostapd_eid_rm_enabled_capab(struct hostapd_data *hapd, u8 *eid,  in hostapd_eid_rm_enabled_capab()  argument
45 if (hapd->conf->radio_measurements[i]) in hostapd_eid_rm_enabled_capab()
54 os_memcpy(eid, hapd->conf->radio_measurements, RRM_CAPABILITIES_IE_LEN); in hostapd_eid_rm_enabled_capab()
60 static u8 * hostapd_eid_bss_load(struct hostapd_data *hapd, u8 *eid, size_t len) in hostapd_eid_bss_load() argument
66 if (hapd->conf->bss_load_test_set) { in hostapd_eid_bss_load()
69 os_memcpy(eid, hapd->conf->bss_load_test, 5); in hostapd_eid_bss_load()
74 if (hapd->conf->bss_load_update_period) { in hostapd_eid_bss_load()
77 WPA_PUT_LE16(eid, hapd->num_sta); in hostapd_eid_bss_load()
79 *eid++ = hapd->iface->channel_utilization; in hostapd_eid_bss_load()
87 static u8 ieee802_11_erp_info(struct hostapd_data *hapd) in ieee802_11_erp_info() argument
91 if (hapd->iface->current_mode == NULL || in ieee802_11_erp_info()
92 hapd->iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G) in ieee802_11_erp_info()
95 if (hapd->iface->olbc) in ieee802_11_erp_info()
97 if (hapd->iface->num_sta_non_erp > 0) { in ieee802_11_erp_info()
101 if (hapd->iface->num_sta_no_short_preamble > 0 || in ieee802_11_erp_info()
102 hapd->iconf->preamble == LONG_PREAMBLE) in ieee802_11_erp_info()
109 static u8 * hostapd_eid_ds_params(struct hostapd_data *hapd, u8 *eid) in hostapd_eid_ds_params() argument
113 *eid++ = hapd->iconf->channel; in hostapd_eid_ds_params()
118 static u8 * hostapd_eid_erp_info(struct hostapd_data *hapd, u8 *eid) in hostapd_eid_erp_info() argument
120 if (hapd->iface->current_mode == NULL || in hostapd_eid_erp_info()
121 hapd->iface->current_mode->mode != HOSTAPD_MODE_IEEE80211G) in hostapd_eid_erp_info()
136 *eid++ = ieee802_11_erp_info(hapd); in hostapd_eid_erp_info()
142 static u8 * hostapd_eid_pwr_constraint(struct hostapd_data *hapd, u8 *eid) in hostapd_eid_pwr_constraint() argument
148 if (hapd->iface->current_mode == NULL || in hostapd_eid_pwr_constraint()
149 hapd->iface->current_mode->mode != HOSTAPD_MODE_IEEE80211A) in hostapd_eid_pwr_constraint()
153 if (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) in hostapd_eid_pwr_constraint()
160 if (!hapd->iconf->ieee80211h && in hostapd_eid_pwr_constraint()
161 hapd->iconf->local_pwr_constraint == -1) in hostapd_eid_pwr_constraint()
165 dfs = hostapd_is_dfs_required(hapd->iface); in hostapd_eid_pwr_constraint()
172 if (dfs == 0 && hapd->iconf->local_pwr_constraint == -1) in hostapd_eid_pwr_constraint()
183 if (hapd->iconf->local_pwr_constraint == -1) in hostapd_eid_pwr_constraint()
204 *pos++ = hapd->iconf->local_pwr_constraint; in hostapd_eid_pwr_constraint()
228 static u8 * hostapd_eid_country(struct hostapd_data *hapd, u8 *eid, in hostapd_eid_country() argument
238 if (!hapd->iconf->ieee80211d || max_len < 6 || in hostapd_eid_country()
239 hapd->iface->current_mode == NULL) in hostapd_eid_country()
244 os_memcpy(pos, hapd->iconf->country, 3); /* e.g., 'US ' */ in hostapd_eid_country()
247 mode = hapd->iface->current_mode; in hostapd_eid_country()
290 static u8 * hostapd_eid_wpa(struct hostapd_data *hapd, u8 *eid, size_t len) in hostapd_eid_wpa() argument
295 ie = wpa_auth_get_wpa_ie(hapd->wpa_auth, &ielen); in hostapd_eid_wpa()
304 static u8 * hostapd_eid_csa(struct hostapd_data *hapd, u8 *eid) in hostapd_eid_csa() argument
307 if (hapd->iface->cs_oper_class && hapd->iconf->ecsa_ie_only) in hostapd_eid_csa()
311 if (!hapd->cs_freq_params.channel) in hostapd_eid_csa()
316 *eid++ = hapd->cs_block_tx; in hostapd_eid_csa()
317 *eid++ = hapd->cs_freq_params.channel; in hostapd_eid_csa()
318 *eid++ = hapd->cs_count; in hostapd_eid_csa()
324 static u8 * hostapd_eid_ecsa(struct hostapd_data *hapd, u8 *eid) in hostapd_eid_ecsa() argument
326 if (!hapd->cs_freq_params.channel || !hapd->iface->cs_oper_class) in hostapd_eid_ecsa()
331 *eid++ = hapd->cs_block_tx; in hostapd_eid_ecsa()
332 *eid++ = hapd->iface->cs_oper_class; in hostapd_eid_ecsa()
333 *eid++ = hapd->cs_freq_params.channel; in hostapd_eid_ecsa()
334 *eid++ = hapd->cs_count; in hostapd_eid_ecsa()
340 static u8 * hostapd_eid_supported_op_classes(struct hostapd_data *hapd, u8 *eid) in hostapd_eid_supported_op_classes() argument
344 if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA) || in hostapd_eid_supported_op_classes()
345 !hapd->iface->freq) in hostapd_eid_supported_op_classes()
348 if (ieee80211_freq_to_channel_ext(hapd->iface->freq, in hostapd_eid_supported_op_classes()
349 hapd->iconf->secondary_channel, in hostapd_eid_supported_op_classes()
350 hapd->iconf->vht_oper_chwidth, in hostapd_eid_supported_op_classes()
368 static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, in hostapd_gen_probe_resp() argument
379 if (hapd->wps_probe_resp_ie) in hostapd_gen_probe_resp()
380 buflen += wpabuf_len(hapd->wps_probe_resp_ie); in hostapd_gen_probe_resp()
383 if (hapd->p2p_probe_resp_ie) in hostapd_gen_probe_resp()
384 buflen += wpabuf_len(hapd->p2p_probe_resp_ie); in hostapd_gen_probe_resp()
387 if (hapd->iface->fst_ies) in hostapd_gen_probe_resp()
388 buflen += wpabuf_len(hapd->iface->fst_ies); in hostapd_gen_probe_resp()
390 if (hapd->conf->vendor_elements) in hostapd_gen_probe_resp()
391 buflen += wpabuf_len(hapd->conf->vendor_elements); in hostapd_gen_probe_resp()
392 if (hapd->conf->vendor_vht) { in hostapd_gen_probe_resp()
398 if (hapd->iconf->ieee80211ax) { in hostapd_gen_probe_resp()
405 buflen += hostapd_mbo_ie_len(hapd); in hostapd_gen_probe_resp()
406 buflen += hostapd_eid_owe_trans_len(hapd); in hostapd_gen_probe_resp()
418 os_memcpy(resp->sa, hapd->own_addr, ETH_ALEN); in hostapd_gen_probe_resp()
420 os_memcpy(resp->bssid, hapd->own_addr, ETH_ALEN); in hostapd_gen_probe_resp()
422 host_to_le16(hapd->iconf->beacon_int); in hostapd_gen_probe_resp()
426 host_to_le16(hostapd_own_capab_info(hapd)); in hostapd_gen_probe_resp()
430 *pos++ = hapd->conf->ssid.ssid_len; in hostapd_gen_probe_resp()
431 os_memcpy(pos, hapd->conf->ssid.ssid, hapd->conf->ssid.ssid_len); in hostapd_gen_probe_resp()
432 pos += hapd->conf->ssid.ssid_len; in hostapd_gen_probe_resp()
435 pos = hostapd_eid_supp_rates(hapd, pos); in hostapd_gen_probe_resp()
438 pos = hostapd_eid_ds_params(hapd, pos); in hostapd_gen_probe_resp()
440 pos = hostapd_eid_country(hapd, pos, epos - pos); in hostapd_gen_probe_resp()
443 pos = hostapd_eid_pwr_constraint(hapd, pos); in hostapd_gen_probe_resp()
446 csa_pos = hostapd_eid_csa(hapd, pos); in hostapd_gen_probe_resp()
448 hapd->cs_c_off_proberesp = csa_pos - (u8 *) resp - 1; in hostapd_gen_probe_resp()
452 pos = hostapd_eid_erp_info(hapd, pos); in hostapd_gen_probe_resp()
455 pos = hostapd_eid_ext_supp_rates(hapd, pos); in hostapd_gen_probe_resp()
458 if (hapd->conf->wpa != WPA_PROTO_WPA) in hostapd_gen_probe_resp()
459 pos = hostapd_eid_wpa(hapd, pos, epos - pos); in hostapd_gen_probe_resp()
461 pos = hostapd_eid_bss_load(hapd, pos, epos - pos); in hostapd_gen_probe_resp()
463 pos = hostapd_eid_rm_enabled_capab(hapd, pos, epos - pos); in hostapd_gen_probe_resp()
466 csa_pos = hostapd_eid_ecsa(hapd, pos); in hostapd_gen_probe_resp()
468 hapd->cs_c_off_ecsa_proberesp = csa_pos - (u8 *) resp - 1; in hostapd_gen_probe_resp()
471 pos = hostapd_eid_supported_op_classes(hapd, pos); in hostapd_gen_probe_resp()
476 pos = hostapd_eid_secondary_channel(hapd, pos); in hostapd_gen_probe_resp()
478 pos = hostapd_eid_ht_capabilities(hapd, pos); in hostapd_gen_probe_resp()
479 pos = hostapd_eid_ht_operation(hapd, pos); in hostapd_gen_probe_resp()
482 pos = hostapd_eid_ext_capab(hapd, pos); in hostapd_gen_probe_resp()
484 pos = hostapd_eid_time_adv(hapd, pos); in hostapd_gen_probe_resp()
485 pos = hostapd_eid_time_zone(hapd, pos); in hostapd_gen_probe_resp()
487 pos = hostapd_eid_interworking(hapd, pos); in hostapd_gen_probe_resp()
488 pos = hostapd_eid_adv_proto(hapd, pos); in hostapd_gen_probe_resp()
489 pos = hostapd_eid_roaming_consortium(hapd, pos); in hostapd_gen_probe_resp()
492 if (hapd->iface->fst_ies) { in hostapd_gen_probe_resp()
493 os_memcpy(pos, wpabuf_head(hapd->iface->fst_ies), in hostapd_gen_probe_resp()
494 wpabuf_len(hapd->iface->fst_ies)); in hostapd_gen_probe_resp()
495 pos += wpabuf_len(hapd->iface->fst_ies); in hostapd_gen_probe_resp()
500 if (hapd->iconf->ieee80211ac && !hapd->conf->disable_11ac) { in hostapd_gen_probe_resp()
501 pos = hostapd_eid_vht_capabilities(hapd, pos, 0); in hostapd_gen_probe_resp()
502 pos = hostapd_eid_vht_operation(hapd, pos); in hostapd_gen_probe_resp()
503 pos = hostapd_eid_txpower_envelope(hapd, pos); in hostapd_gen_probe_resp()
504 pos = hostapd_eid_wb_chsw_wrapper(hapd, pos); in hostapd_gen_probe_resp()
508 pos = hostapd_eid_fils_indic(hapd, pos, 0); in hostapd_gen_probe_resp()
511 if (hapd->iconf->ieee80211ax) { in hostapd_gen_probe_resp()
512 pos = hostapd_eid_he_capab(hapd, pos); in hostapd_gen_probe_resp()
513 pos = hostapd_eid_he_operation(hapd, pos); in hostapd_gen_probe_resp()
514 pos = hostapd_eid_he_mu_edca_parameter_set(hapd, pos); in hostapd_gen_probe_resp()
519 if (hapd->conf->vendor_vht) in hostapd_gen_probe_resp()
520 pos = hostapd_eid_vendor_vht(hapd, pos); in hostapd_gen_probe_resp()
524 if (hapd->conf->wpa == WPA_PROTO_WPA) in hostapd_gen_probe_resp()
525 pos = hostapd_eid_wpa(hapd, pos, epos - pos); in hostapd_gen_probe_resp()
528 pos = hostapd_eid_wmm(hapd, pos); in hostapd_gen_probe_resp()
531 if (hapd->conf->wps_state && hapd->wps_probe_resp_ie) { in hostapd_gen_probe_resp()
532 os_memcpy(pos, wpabuf_head(hapd->wps_probe_resp_ie), in hostapd_gen_probe_resp()
533 wpabuf_len(hapd->wps_probe_resp_ie)); in hostapd_gen_probe_resp()
534 pos += wpabuf_len(hapd->wps_probe_resp_ie); in hostapd_gen_probe_resp()
539 if ((hapd->conf->p2p & P2P_ENABLED) && is_p2p && in hostapd_gen_probe_resp()
540 hapd->p2p_probe_resp_ie) { in hostapd_gen_probe_resp()
541 os_memcpy(pos, wpabuf_head(hapd->p2p_probe_resp_ie), in hostapd_gen_probe_resp()
542 wpabuf_len(hapd->p2p_probe_resp_ie)); in hostapd_gen_probe_resp()
543 pos += wpabuf_len(hapd->p2p_probe_resp_ie); in hostapd_gen_probe_resp()
547 if ((hapd->conf->p2p & (P2P_MANAGE | P2P_ENABLED | P2P_GROUP_OWNER)) == in hostapd_gen_probe_resp()
549 pos = hostapd_eid_p2p_manage(hapd, pos); in hostapd_gen_probe_resp()
553 pos = hostapd_eid_hs20_indication(hapd, pos); in hostapd_gen_probe_resp()
554 pos = hostapd_eid_osen(hapd, pos); in hostapd_gen_probe_resp()
557 pos = hostapd_eid_mbo(hapd, pos, (u8 *) resp + buflen - pos); in hostapd_gen_probe_resp()
558 pos = hostapd_eid_owe_trans(hapd, pos, (u8 *) resp + buflen - pos); in hostapd_gen_probe_resp()
560 if (hapd->conf->vendor_elements) { in hostapd_gen_probe_resp()
561 os_memcpy(pos, wpabuf_head(hapd->conf->vendor_elements), in hostapd_gen_probe_resp()
562 wpabuf_len(hapd->conf->vendor_elements)); in hostapd_gen_probe_resp()
563 pos += wpabuf_len(hapd->conf->vendor_elements); in hostapd_gen_probe_resp()
577 static enum ssid_match_result ssid_match(struct hostapd_data *hapd, in ssid_match() argument
587 if (ssid_len == hapd->conf->ssid.ssid_len && in ssid_match()
588 os_memcmp(ssid, hapd->conf->ssid.ssid, ssid_len) == 0) in ssid_match()
601 if (pos[1] == hapd->conf->ssid.ssid_len && in ssid_match()
602 os_memcmp(pos + 2, hapd->conf->ssid.ssid, pos[1]) == 0) in ssid_match()
693 struct hostapd_data *hapd = NULL; in sta_track_seen_on() local
697 hapd = iface->bss[j]; in sta_track_seen_on()
698 if (os_strcmp(ifname, hapd->conf->iface) == 0) in sta_track_seen_on()
700 hapd = NULL; in sta_track_seen_on()
703 if (hapd && sta_track_get(iface, addr)) in sta_track_seen_on()
704 return hapd; in sta_track_seen_on()
728 void handle_probe_req(struct hostapd_data *hapd, in handle_probe_req() argument
751 if (hapd->iconf->track_sta_max_num) in handle_probe_req()
752 sta_track_add(hapd->iface, mgmt->sa, ssi_signal); in handle_probe_req()
755 ret = ieee802_11_allowed_address(hapd, mgmt->sa, (const u8 *) mgmt, len, in handle_probe_req()
760 wpa_msg(hapd->msg_ctx, MSG_DEBUG, in handle_probe_req()
766 for (i = 0; hapd->probereq_cb && i < hapd->num_probereq_cb; i++) in handle_probe_req()
767 if (hapd->probereq_cb[i].cb(hapd->probereq_cb[i].ctx, in handle_probe_req()
772 if (!hapd->conf->send_probe_response) in handle_probe_req()
799 hapd->iface->current_mode && in handle_probe_req()
800 (hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G || in handle_probe_req()
801 hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211B) && in handle_probe_req()
802 hapd->iconf->channel != elems.ds_params[0]) { in handle_probe_req()
805 hapd->iconf->channel, elems.ds_params[0]); in handle_probe_req()
810 if (hapd->p2p && hapd->p2p_group && elems.wps_ie) { in handle_probe_req()
813 if (wps && !p2p_group_match_dev_type(hapd->p2p_group, wps)) { in handle_probe_req()
823 if (hapd->p2p && hapd->p2p_group && elems.p2p) { in handle_probe_req()
826 if (p2p && !p2p_group_match_dev_id(hapd->p2p_group, p2p)) { in handle_probe_req()
836 if (hapd->conf->ignore_broadcast_ssid && elems.ssid_len == 0 && in handle_probe_req()
844 if ((hapd->conf->p2p & P2P_GROUP_OWNER) && in handle_probe_req()
858 if ((sta = ap_get_sta(hapd, mgmt->sa)) != NULL) { in handle_probe_req()
859 taxonomy_sta_info_probe_req(hapd, sta, ie, ie_len); in handle_probe_req()
860 } else if ((info = sta_track_get(hapd->iface, in handle_probe_req()
862 taxonomy_hostapd_sta_info_probe_req(hapd, info, in handle_probe_req()
868 res = ssid_match(hapd, elems.ssid, elems.ssid_len, in handle_probe_req()
883 if (hapd->conf->interworking && in handle_probe_req()
887 ant != hapd->conf->access_network_type) { in handle_probe_req()
895 if (hapd->conf->interworking && elems.interworking && in handle_probe_req()
903 os_memcmp(hessid, hapd->conf->hessid, ETH_ALEN) != 0) { in handle_probe_req()
914 if ((hapd->conf->p2p & P2P_GROUP_OWNER) && in handle_probe_req()
927 if (hapd->conf->no_probe_resp_if_seen_on && in handle_probe_req()
930 sta_track_seen_on(hapd->iface, mgmt->sa, in handle_probe_req()
931 hapd->conf->no_probe_resp_if_seen_on)) { in handle_probe_req()
934 hapd->conf->iface, MAC2STR(mgmt->sa), in handle_probe_req()
935 hapd->conf->no_probe_resp_if_seen_on); in handle_probe_req()
939 if (hapd->conf->no_probe_resp_if_max_sta && in handle_probe_req()
942 hapd->num_sta >= hapd->conf->max_num_sta && in handle_probe_req()
943 !ap_get_sta(hapd, mgmt->sa)) { in handle_probe_req()
946 hapd->conf->iface, MAC2STR(mgmt->sa)); in handle_probe_req()
951 if (hapd->iconf->ignore_probe_probability > 0.0 && in handle_probe_req()
952 drand48() < hapd->iconf->ignore_probe_probability) { in handle_probe_req()
960 wpa_msg_ctrl(hapd->msg_ctx, MSG_INFO, RX_PROBE_REQUEST "sa=" MACSTR in handle_probe_req()
963 resp = hostapd_gen_probe_resp(hapd, mgmt, elems.p2p != NULL, in handle_probe_req()
976 if (hapd->csa_in_progress) { in handle_probe_req()
977 if (hapd->cs_c_off_proberesp) in handle_probe_req()
979 hapd->cs_c_off_proberesp; in handle_probe_req()
981 if (hapd->cs_c_off_ecsa_proberesp) in handle_probe_req()
983 hapd->cs_c_off_ecsa_proberesp; in handle_probe_req()
986 ret = hostapd_drv_send_mlme_csa(hapd, resp, resp_len, noack, in handle_probe_req()
1001 static u8 * hostapd_probe_resp_offloads(struct hostapd_data *hapd, in hostapd_probe_resp_offloads() argument
1005 if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_PROBE_RESP_OFFLOAD)) in hostapd_probe_resp_offloads()
1009 if (hapd->conf->wps_state && hapd->wps_probe_resp_ie && in hostapd_probe_resp_offloads()
1010 (!(hapd->iface->probe_resp_offloads & in hostapd_probe_resp_offloads()
1018 if ((hapd->conf->p2p & P2P_ENABLED) && hapd->p2p_probe_resp_ie && in hostapd_probe_resp_offloads()
1019 !(hapd->iface->probe_resp_offloads & in hostapd_probe_resp_offloads()
1025 if (hapd->conf->interworking && in hostapd_probe_resp_offloads()
1026 !(hapd->iface->probe_resp_offloads & in hostapd_probe_resp_offloads()
1033 return hostapd_gen_probe_resp(hapd, NULL, 0, resp_len); in hostapd_probe_resp_offloads()
1049 int ieee802_11_build_ap_params(struct hostapd_data *hapd, in ieee802_11_build_ap_params() argument
1066 if (hapd->conf->wps_state && hapd->wps_beacon_ie) in ieee802_11_build_ap_params()
1067 tail_len += wpabuf_len(hapd->wps_beacon_ie); in ieee802_11_build_ap_params()
1070 if (hapd->p2p_beacon_ie) in ieee802_11_build_ap_params()
1071 tail_len += wpabuf_len(hapd->p2p_beacon_ie); in ieee802_11_build_ap_params()
1074 if (hapd->iface->fst_ies) in ieee802_11_build_ap_params()
1075 tail_len += wpabuf_len(hapd->iface->fst_ies); in ieee802_11_build_ap_params()
1077 if (hapd->conf->vendor_elements) in ieee802_11_build_ap_params()
1078 tail_len += wpabuf_len(hapd->conf->vendor_elements); in ieee802_11_build_ap_params()
1081 if (hapd->conf->vendor_vht) { in ieee802_11_build_ap_params()
1088 if (hapd->iconf->ieee80211ax) { in ieee802_11_build_ap_params()
1095 tail_len += hostapd_mbo_ie_len(hapd); in ieee802_11_build_ap_params()
1096 tail_len += hostapd_eid_owe_trans_len(hapd); in ieee802_11_build_ap_params()
1111 os_memcpy(head->sa, hapd->own_addr, ETH_ALEN); in ieee802_11_build_ap_params()
1112 os_memcpy(head->bssid, hapd->own_addr, ETH_ALEN); in ieee802_11_build_ap_params()
1114 host_to_le16(hapd->iconf->beacon_int); in ieee802_11_build_ap_params()
1117 capab_info = hostapd_own_capab_info(hapd); in ieee802_11_build_ap_params()
1123 if (hapd->conf->ignore_broadcast_ssid == 2) { in ieee802_11_build_ap_params()
1125 *pos++ = hapd->conf->ssid.ssid_len; in ieee802_11_build_ap_params()
1126 os_memset(pos, 0, hapd->conf->ssid.ssid_len); in ieee802_11_build_ap_params()
1127 pos += hapd->conf->ssid.ssid_len; in ieee802_11_build_ap_params()
1128 } else if (hapd->conf->ignore_broadcast_ssid) { in ieee802_11_build_ap_params()
1131 *pos++ = hapd->conf->ssid.ssid_len; in ieee802_11_build_ap_params()
1132 os_memcpy(pos, hapd->conf->ssid.ssid, in ieee802_11_build_ap_params()
1133 hapd->conf->ssid.ssid_len); in ieee802_11_build_ap_params()
1134 pos += hapd->conf->ssid.ssid_len; in ieee802_11_build_ap_params()
1138 pos = hostapd_eid_supp_rates(hapd, pos); in ieee802_11_build_ap_params()
1141 pos = hostapd_eid_ds_params(hapd, pos); in ieee802_11_build_ap_params()
1145 tailpos = hostapd_eid_country(hapd, tailpos, in ieee802_11_build_ap_params()
1149 tailpos = hostapd_eid_pwr_constraint(hapd, tailpos); in ieee802_11_build_ap_params()
1152 csa_pos = hostapd_eid_csa(hapd, tailpos); in ieee802_11_build_ap_params()
1154 hapd->cs_c_off_beacon = csa_pos - tail - 1; in ieee802_11_build_ap_params()
1158 tailpos = hostapd_eid_erp_info(hapd, tailpos); in ieee802_11_build_ap_params()
1161 tailpos = hostapd_eid_ext_supp_rates(hapd, tailpos); in ieee802_11_build_ap_params()
1164 if (hapd->conf->wpa != WPA_PROTO_WPA) in ieee802_11_build_ap_params()
1165 tailpos = hostapd_eid_wpa(hapd, tailpos, in ieee802_11_build_ap_params()
1169 tailpos = hostapd_eid_rm_enabled_capab(hapd, tailpos, in ieee802_11_build_ap_params()
1173 tailpos = hostapd_eid_bss_load(hapd, tailpos, in ieee802_11_build_ap_params()
1177 csa_pos = hostapd_eid_ecsa(hapd, tailpos); in ieee802_11_build_ap_params()
1179 hapd->cs_c_off_ecsa_beacon = csa_pos - tail - 1; in ieee802_11_build_ap_params()
1182 tailpos = hostapd_eid_supported_op_classes(hapd, tailpos); in ieee802_11_build_ap_params()
1187 tailpos = hostapd_eid_secondary_channel(hapd, tailpos); in ieee802_11_build_ap_params()
1189 tailpos = hostapd_eid_ht_capabilities(hapd, tailpos); in ieee802_11_build_ap_params()
1190 tailpos = hostapd_eid_ht_operation(hapd, tailpos); in ieee802_11_build_ap_params()
1193 tailpos = hostapd_eid_ext_capab(hapd, tailpos); in ieee802_11_build_ap_params()
1199 tailpos = hostapd_eid_time_adv(hapd, tailpos); in ieee802_11_build_ap_params()
1201 tailpos = hostapd_eid_interworking(hapd, tailpos); in ieee802_11_build_ap_params()
1202 tailpos = hostapd_eid_adv_proto(hapd, tailpos); in ieee802_11_build_ap_params()
1203 tailpos = hostapd_eid_roaming_consortium(hapd, tailpos); in ieee802_11_build_ap_params()
1206 if (hapd->iface->fst_ies) { in ieee802_11_build_ap_params()
1207 os_memcpy(tailpos, wpabuf_head(hapd->iface->fst_ies), in ieee802_11_build_ap_params()
1208 wpabuf_len(hapd->iface->fst_ies)); in ieee802_11_build_ap_params()
1209 tailpos += wpabuf_len(hapd->iface->fst_ies); in ieee802_11_build_ap_params()
1214 if (hapd->iconf->ieee80211ac && !hapd->conf->disable_11ac) { in ieee802_11_build_ap_params()
1215 tailpos = hostapd_eid_vht_capabilities(hapd, tailpos, 0); in ieee802_11_build_ap_params()
1216 tailpos = hostapd_eid_vht_operation(hapd, tailpos); in ieee802_11_build_ap_params()
1217 tailpos = hostapd_eid_txpower_envelope(hapd, tailpos); in ieee802_11_build_ap_params()
1218 tailpos = hostapd_eid_wb_chsw_wrapper(hapd, tailpos); in ieee802_11_build_ap_params()
1222 tailpos = hostapd_eid_fils_indic(hapd, tailpos, 0); in ieee802_11_build_ap_params()
1225 if (hapd->iconf->ieee80211ax) { in ieee802_11_build_ap_params()
1226 tailpos = hostapd_eid_he_capab(hapd, tailpos); in ieee802_11_build_ap_params()
1227 tailpos = hostapd_eid_he_operation(hapd, tailpos); in ieee802_11_build_ap_params()
1228 tailpos = hostapd_eid_he_mu_edca_parameter_set(hapd, tailpos); in ieee802_11_build_ap_params()
1233 if (hapd->conf->vendor_vht) in ieee802_11_build_ap_params()
1234 tailpos = hostapd_eid_vendor_vht(hapd, tailpos); in ieee802_11_build_ap_params()
1238 if (hapd->conf->wpa == WPA_PROTO_WPA) in ieee802_11_build_ap_params()
1239 tailpos = hostapd_eid_wpa(hapd, tailpos, in ieee802_11_build_ap_params()
1244 tailpos = hostapd_eid_wmm(hapd, tailpos); in ieee802_11_build_ap_params()
1247 if (hapd->conf->wps_state && hapd->wps_beacon_ie) { in ieee802_11_build_ap_params()
1248 os_memcpy(tailpos, wpabuf_head(hapd->wps_beacon_ie), in ieee802_11_build_ap_params()
1249 wpabuf_len(hapd->wps_beacon_ie)); in ieee802_11_build_ap_params()
1250 tailpos += wpabuf_len(hapd->wps_beacon_ie); in ieee802_11_build_ap_params()
1255 if ((hapd->conf->p2p & P2P_ENABLED) && hapd->p2p_beacon_ie) { in ieee802_11_build_ap_params()
1256 os_memcpy(tailpos, wpabuf_head(hapd->p2p_beacon_ie), in ieee802_11_build_ap_params()
1257 wpabuf_len(hapd->p2p_beacon_ie)); in ieee802_11_build_ap_params()
1258 tailpos += wpabuf_len(hapd->p2p_beacon_ie); in ieee802_11_build_ap_params()
1262 if ((hapd->conf->p2p & (P2P_MANAGE | P2P_ENABLED | P2P_GROUP_OWNER)) == in ieee802_11_build_ap_params()
1264 tailpos = hostapd_eid_p2p_manage(hapd, tailpos); in ieee802_11_build_ap_params()
1268 tailpos = hostapd_eid_hs20_indication(hapd, tailpos); in ieee802_11_build_ap_params()
1269 tailpos = hostapd_eid_osen(hapd, tailpos); in ieee802_11_build_ap_params()
1272 tailpos = hostapd_eid_mbo(hapd, tailpos, tail + tail_len - tailpos); in ieee802_11_build_ap_params()
1273 tailpos = hostapd_eid_owe_trans(hapd, tailpos, in ieee802_11_build_ap_params()
1276 if (hapd->conf->vendor_elements) { in ieee802_11_build_ap_params()
1277 os_memcpy(tailpos, wpabuf_head(hapd->conf->vendor_elements), in ieee802_11_build_ap_params()
1278 wpabuf_len(hapd->conf->vendor_elements)); in ieee802_11_build_ap_params()
1279 tailpos += wpabuf_len(hapd->conf->vendor_elements); in ieee802_11_build_ap_params()
1284 resp = hostapd_probe_resp_offloads(hapd, &resp_len); in ieee802_11_build_ap_params()
1294 params->dtim_period = hapd->conf->dtim_period; in ieee802_11_build_ap_params()
1295 params->beacon_int = hapd->iconf->beacon_int; in ieee802_11_build_ap_params()
1296 params->basic_rates = hapd->iface->basic_rates; in ieee802_11_build_ap_params()
1297 params->beacon_rate = hapd->iconf->beacon_rate; in ieee802_11_build_ap_params()
1298 params->rate_type = hapd->iconf->rate_type; in ieee802_11_build_ap_params()
1299 params->ssid = hapd->conf->ssid.ssid; in ieee802_11_build_ap_params()
1300 params->ssid_len = hapd->conf->ssid.ssid_len; in ieee802_11_build_ap_params()
1301 if ((hapd->conf->wpa & (WPA_PROTO_WPA | WPA_PROTO_RSN)) == in ieee802_11_build_ap_params()
1303 params->pairwise_ciphers = hapd->conf->wpa_pairwise | in ieee802_11_build_ap_params()
1304 hapd->conf->rsn_pairwise; in ieee802_11_build_ap_params()
1305 else if (hapd->conf->wpa & WPA_PROTO_RSN) in ieee802_11_build_ap_params()
1306 params->pairwise_ciphers = hapd->conf->rsn_pairwise; in ieee802_11_build_ap_params()
1307 else if (hapd->conf->wpa & WPA_PROTO_WPA) in ieee802_11_build_ap_params()
1308 params->pairwise_ciphers = hapd->conf->wpa_pairwise; in ieee802_11_build_ap_params()
1309 params->group_cipher = hapd->conf->wpa_group; in ieee802_11_build_ap_params()
1310 params->key_mgmt_suites = hapd->conf->wpa_key_mgmt; in ieee802_11_build_ap_params()
1311 params->auth_algs = hapd->conf->auth_algs; in ieee802_11_build_ap_params()
1312 params->wpa_version = hapd->conf->wpa; in ieee802_11_build_ap_params()
1313 params->privacy = hapd->conf->ssid.wep.keys_set || hapd->conf->wpa || in ieee802_11_build_ap_params()
1314 (hapd->conf->ieee802_1x && in ieee802_11_build_ap_params()
1315 (hapd->conf->default_wep_key_len || in ieee802_11_build_ap_params()
1316 hapd->conf->individual_wep_key_len)); in ieee802_11_build_ap_params()
1317 switch (hapd->conf->ignore_broadcast_ssid) { in ieee802_11_build_ap_params()
1328 params->isolate = hapd->conf->isolate; in ieee802_11_build_ap_params()
1329 params->smps_mode = hapd->iconf->ht_capab & HT_CAP_INFO_SMPS_MASK; in ieee802_11_build_ap_params()
1331 params->cts_protect = !!(ieee802_11_erp_info(hapd) & in ieee802_11_build_ap_params()
1333 params->preamble = hapd->iface->num_sta_no_short_preamble == 0 && in ieee802_11_build_ap_params()
1334 hapd->iconf->preamble == SHORT_PREAMBLE; in ieee802_11_build_ap_params()
1335 if (hapd->iface->current_mode && in ieee802_11_build_ap_params()
1336 hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G) in ieee802_11_build_ap_params()
1338 hapd->iface->num_sta_no_short_slot_time > 0 ? 0 : 1; in ieee802_11_build_ap_params()
1341 if (!hapd->iconf->ieee80211n || hapd->conf->disable_11n) in ieee802_11_build_ap_params()
1344 params->ht_opmode = hapd->iface->ht_op_mode; in ieee802_11_build_ap_params()
1346 params->interworking = hapd->conf->interworking; in ieee802_11_build_ap_params()
1347 if (hapd->conf->interworking && in ieee802_11_build_ap_params()
1348 !is_zero_ether_addr(hapd->conf->hessid)) in ieee802_11_build_ap_params()
1349 params->hessid = hapd->conf->hessid; in ieee802_11_build_ap_params()
1350 params->access_network_type = hapd->conf->access_network_type; in ieee802_11_build_ap_params()
1351 params->ap_max_inactivity = hapd->conf->ap_max_inactivity; in ieee802_11_build_ap_params()
1353 params->p2p_go_ctwindow = hapd->iconf->p2p_go_ctwindow; in ieee802_11_build_ap_params()
1356 params->disable_dgaf = hapd->conf->disable_dgaf; in ieee802_11_build_ap_params()
1357 if (hapd->conf->osen) { in ieee802_11_build_ap_params()
1362 params->multicast_to_unicast = hapd->conf->multicast_to_unicast; in ieee802_11_build_ap_params()
1363 params->pbss = hapd->conf->pbss; in ieee802_11_build_ap_params()
1365 if (hapd->conf->ftm_responder) { in ieee802_11_build_ap_params()
1366 if (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_FTM_RESPONDER) { in ieee802_11_build_ap_params()
1368 params->lci = hapd->iface->conf->lci; in ieee802_11_build_ap_params()
1369 params->civic = hapd->iface->conf->civic; in ieee802_11_build_ap_params()
1391 int ieee802_11_set_beacon(struct hostapd_data *hapd) in ieee802_11_set_beacon() argument
1395 struct hostapd_iface *iface = hapd->iface; in ieee802_11_set_beacon()
1400 if (hapd->csa_in_progress) { in ieee802_11_set_beacon()
1405 hapd->beacon_set_done = 1; in ieee802_11_set_beacon()
1407 if (ieee802_11_build_ap_params(hapd, &params) < 0) in ieee802_11_set_beacon()
1410 if (hostapd_build_ap_extra_ies(hapd, &beacon, &proberesp, &assocresp) < in ieee802_11_set_beacon()
1417 params.reenable = hapd->reenable_beacon; in ieee802_11_set_beacon()
1418 hapd->reenable_beacon = 0; in ieee802_11_set_beacon()
1431 res = hostapd_drv_set_ap(hapd, &params); in ieee802_11_set_beacon()
1432 hostapd_free_ap_extra_ies(hapd, beacon, proberesp, assocresp); in ieee802_11_set_beacon()