Lines Matching defs:hapd
68 int hostapd_build_ap_extra_ies(struct hostapd_data *hapd,
80 pos = hostapd_eid_rm_enabled_capab(hapd, pos, sizeof(buf));
87 pos = hostapd_eid_time_adv(hapd, pos);
90 pos = hostapd_eid_time_zone(hapd, pos);
95 pos = hostapd_eid_ext_capab(hapd, pos, false);
98 pos = hostapd_eid_interworking(hapd, pos);
99 pos = hostapd_eid_adv_proto(hapd, pos);
100 pos = hostapd_eid_roaming_consortium(hapd, pos);
106 if (add_buf(&beacon, hapd->iface->fst_ies) < 0 ||
107 add_buf(&proberesp, hapd->iface->fst_ies) < 0 ||
108 add_buf(&assocresp, hapd->iface->fst_ies) < 0)
113 pos = hostapd_eid_fils_indic(hapd, buf, 0);
119 pos = hostapd_eid_rsnxe(hapd, buf, sizeof(buf));
123 if (add_buf(&beacon, hapd->wps_beacon_ie) < 0 ||
124 add_buf(&proberesp, hapd->wps_probe_resp_ie) < 0)
128 if (add_buf(&beacon, hapd->p2p_beacon_ie) < 0 ||
129 add_buf(&proberesp, hapd->p2p_probe_resp_ie) < 0)
134 if (hapd->conf->p2p & P2P_MANAGE) {
138 p = hostapd_eid_p2p_manage(hapd, start);
145 p = hostapd_eid_p2p_manage(hapd, start);
152 if (hapd->conf->wps_state) {
160 if (hapd->conf->p2p & P2P_MANAGE) {
164 p = hostapd_eid_p2p_manage(hapd, start);
171 if (hapd->p2p_group) {
173 a = p2p_group_assoc_resp_ie(hapd->p2p_group, P2P_SC_SUCCESS);
180 pos = hostapd_eid_hs20_indication(hapd, buf);
185 pos = hostapd_eid_osen(hapd, buf);
192 if (hapd->conf->mbo_enabled ||
193 OCE_STA_CFON_ENABLED(hapd) || OCE_AP_ENABLED(hapd)) {
194 pos = hostapd_eid_mbo(hapd, buf, sizeof(buf));
203 pos = hostapd_eid_owe_trans(hapd, buf, sizeof(buf));
209 add_buf(&beacon, hapd->conf->vendor_elements);
210 add_buf(&proberesp, hapd->conf->vendor_elements);
212 add_buf(&proberesp, hapd->conf->presp_elements);
214 add_buf(&assocresp, hapd->conf->assocresp_elements);
230 void hostapd_free_ap_extra_ies(struct hostapd_data *hapd,
241 int hostapd_reset_ap_wps_ie(struct hostapd_data *hapd)
243 if (hapd->driver == NULL || hapd->driver->set_ap_wps_ie == NULL)
246 return hapd->driver->set_ap_wps_ie(hapd->drv_priv, NULL, NULL, NULL);
250 int hostapd_set_ap_wps_ie(struct hostapd_data *hapd)
255 if (hapd->driver == NULL || hapd->driver->set_ap_wps_ie == NULL)
258 if (hostapd_build_ap_extra_ies(hapd, &beacon, &proberesp, &assocresp) <
262 ret = hapd->driver->set_ap_wps_ie(hapd->drv_priv, beacon, proberesp,
265 hostapd_free_ap_extra_ies(hapd, beacon, proberesp, assocresp);
271 bool hostapd_sta_is_link_sta(struct hostapd_data *hapd,
275 if (ap_sta_is_mld(hapd, sta) &&
276 sta->mld_assoc_link_id != hapd->mld_link_id)
284 int hostapd_set_authorized(struct hostapd_data *hapd,
293 if (hostapd_sta_is_link_sta(hapd, sta)) {
301 return hostapd_sta_set_flags(hapd, sta->addr,
307 return hostapd_sta_set_flags(hapd, sta->addr,
313 int hostapd_set_sta_flags(struct hostapd_data *hapd, struct sta_info *sta)
328 if (hostapd_sta_is_link_sta(hapd, sta)) {
337 return hostapd_sta_set_flags(hapd, sta->addr, total_flags,
342 int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd, const char *ifname,
350 params.wpa = hapd->conf->wpa;
351 params.ieee802_1x = hapd->conf->ieee802_1x;
352 params.wpa_group = hapd->conf->wpa_group;
353 if ((hapd->conf->wpa & (WPA_PROTO_WPA | WPA_PROTO_RSN)) ==
355 params.wpa_pairwise = hapd->conf->wpa_pairwise |
356 hapd->conf->rsn_pairwise;
357 else if (hapd->conf->wpa & WPA_PROTO_RSN)
358 params.wpa_pairwise = hapd->conf->rsn_pairwise;
359 else if (hapd->conf->wpa & WPA_PROTO_WPA)
360 params.wpa_pairwise = hapd->conf->wpa_pairwise;
361 params.wpa_key_mgmt = hapd->conf->wpa_key_mgmt;
362 params.rsn_preauth = hapd->conf->rsn_preauth;
363 params.ieee80211w = hapd->conf->ieee80211w;
365 return hostapd_set_ieee8021x(hapd, ¶ms);
369 int hostapd_vlan_if_add(struct hostapd_data *hapd, const char *ifname)
373 return hostapd_if_add(hapd, WPA_IF_AP_VLAN, ifname, hapd->own_addr,
378 int hostapd_vlan_if_remove(struct hostapd_data *hapd, const char *ifname)
380 return hostapd_if_remove(hapd, WPA_IF_AP_VLAN, ifname);
384 int hostapd_set_wds_sta(struct hostapd_data *hapd, char *ifname_wds,
389 if (hapd->driver == NULL || hapd->driver->set_wds_sta == NULL)
391 if (hapd->conf->wds_bridge[0])
392 bridge = hapd->conf->wds_bridge;
393 else if (hapd->conf->bridge[0])
394 bridge = hapd->conf->bridge;
395 return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val,
400 int hostapd_add_sta_node(struct hostapd_data *hapd, const u8 *addr,
403 if (hapd->driver == NULL || hapd->driver->add_sta_node == NULL)
405 return hapd->driver->add_sta_node(hapd->drv_priv, addr, auth_alg);
409 int hostapd_sta_auth(struct hostapd_data *hapd, const u8 *addr,
417 if (hapd->driver == NULL || hapd->driver->sta_auth == NULL)
423 sta = ap_get_sta(hapd, addr);
442 params.own_addr = hapd->own_addr;
449 return hapd->driver->sta_auth(hapd->drv_priv, ¶ms);
453 int hostapd_sta_assoc(struct hostapd_data *hapd, const u8 *addr,
456 if (hapd->driver == NULL || hapd->driver->sta_assoc == NULL)
458 return hapd->driver->sta_assoc(hapd->drv_priv, hapd->own_addr, addr,
463 int hostapd_sta_add(struct hostapd_data *hapd,
479 if (hapd->driver == NULL)
481 if (hapd->driver->sta_add == NULL)
511 if (hapd->conf->mld_ap) {
512 params.mld_link_id = hapd->mld_link_id;
518 return hapd->driver->sta_add(hapd->drv_priv, ¶ms);
522 int hostapd_add_tspec(struct hostapd_data *hapd, const u8 *addr,
525 if (hapd->driver == NULL || hapd->driver->add_tspec == NULL)
527 return hapd->driver->add_tspec(hapd->drv_priv, addr, tspec_ie,
532 int hostapd_set_privacy(struct hostapd_data *hapd, int enabled)
534 if (hapd->driver == NULL || hapd->driver->set_privacy == NULL)
536 return hapd->driver->set_privacy(hapd->drv_priv, enabled);
540 int hostapd_set_generic_elem(struct hostapd_data *hapd, const u8 *elem,
543 if (hapd->driver == NULL || hapd->driver->set_generic_elem == NULL)
545 return hapd->driver->set_generic_elem(hapd->drv_priv, elem, elem_len);
549 int hostapd_get_ssid(struct hostapd_data *hapd, u8 *buf, size_t len)
551 if (hapd->driver == NULL || hapd->driver->hapd_get_ssid == NULL)
553 return hapd->driver->hapd_get_ssid(hapd->drv_priv, buf, len);
557 int hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len)
559 if (hapd->driver == NULL || hapd->driver->hapd_set_ssid == NULL)
561 return hapd->driver->hapd_set_ssid(hapd->drv_priv, buf, len);
565 int hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type,
570 if (hapd->driver == NULL || hapd->driver->if_add == NULL)
572 return hapd->driver->if_add(hapd->drv_priv, type, ifname, addr,
579 int hostapd_if_link_remove(struct hostapd_data *hapd,
583 if (!hapd->driver || !hapd->drv_priv || !hapd->driver->link_remove)
586 return hapd->driver->link_remove(hapd->drv_priv, type, ifname,
587 hapd->mld_link_id);
592 int hostapd_if_remove(struct hostapd_data *hapd, enum wpa_driver_if_type type,
595 if (hapd->driver == NULL || hapd->drv_priv == NULL ||
596 hapd->driver->if_remove == NULL)
600 if (hapd->conf->mld_ap)
601 return hostapd_if_link_remove(hapd, type, ifname,
602 hapd->mld_link_id);
605 return hapd->driver->if_remove(hapd->drv_priv, type, ifname);
609 int hostapd_set_ieee8021x(struct hostapd_data *hapd,
612 if (hapd->driver == NULL || hapd->driver->set_ieee8021x == NULL)
614 return hapd->driver->set_ieee8021x(hapd->drv_priv, params);
618 int hostapd_get_seqnum(const char *ifname, struct hostapd_data *hapd,
621 if (hapd->driver == NULL || hapd->driver->get_seqnum == NULL)
623 return hapd->driver->get_seqnum(ifname, hapd->drv_priv, addr, idx,
628 int hostapd_flush(struct hostapd_data *hapd)
632 if (hapd->driver == NULL || hapd->driver->flush == NULL)
636 if (hapd->conf && hapd->conf->mld_ap)
637 link_id = hapd->mld_link_id;
640 return hapd->driver->flush(hapd->drv_priv, link_id);
644 int hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode,
652 struct hostapd_hw_modes *cmode = hapd->iface->current_mode;
664 NULL, hostapd_get_punct_bitmap(hapd)))
667 if (hapd->driver == NULL)
669 if (hapd->driver->set_freq == NULL)
675 if (hapd->conf->mld_ap) {
676 data.link_id = hapd->mld_link_id;
682 return hapd->driver->set_freq(hapd->drv_priv, &data);
685 int hostapd_set_rts(struct hostapd_data *hapd, int rts)
687 if (hapd->driver == NULL || hapd->driver->set_rts == NULL)
689 return hapd->driver->set_rts(hapd->drv_priv, rts);
693 int hostapd_set_frag(struct hostapd_data *hapd, int frag)
695 if (hapd->driver == NULL || hapd->driver->set_frag == NULL)
697 return hapd->driver->set_frag(hapd->drv_priv, frag);
701 int hostapd_sta_set_flags(struct hostapd_data *hapd, u8 *addr,
704 if (!hapd->driver || !hapd->drv_priv || !hapd->driver->sta_set_flags)
706 return hapd->driver->sta_set_flags(hapd->drv_priv, addr, total_flags,
711 int hostapd_sta_set_airtime_weight(struct hostapd_data *hapd, const u8 *addr,
714 if (!hapd->driver || !hapd->driver->sta_set_airtime_weight)
716 return hapd->driver->sta_set_airtime_weight(hapd->drv_priv, addr,
721 int hostapd_set_country(struct hostapd_data *hapd, const char *country)
723 if (hapd->driver == NULL ||
724 hapd->driver->set_country == NULL)
726 return hapd->driver->set_country(hapd->drv_priv, country);
730 int hostapd_set_tx_queue_params(struct hostapd_data *hapd, int queue, int aifs,
735 if (hapd->driver == NULL || hapd->driver->set_tx_queue_params == NULL)
739 if (hapd->conf->mld_ap)
740 link_id = hapd->mld_link_id;
743 return hapd->driver->set_tx_queue_params(hapd->drv_priv, queue, aifs,
750 hostapd_get_hw_feature_data(struct hostapd_data *hapd, u16 *num_modes,
753 if (!hapd->driver || !hapd->driver->get_hw_feature_data ||
754 !hapd->drv_priv)
756 return hapd->driver->get_hw_feature_data(hapd->drv_priv, num_modes,
761 int hostapd_driver_commit(struct hostapd_data *hapd)
763 if (hapd->driver == NULL || hapd->driver->commit == NULL)
765 return hapd->driver->commit(hapd->drv_priv);
769 int hostapd_drv_none(struct hostapd_data *hapd)
771 return hapd->driver && os_strcmp(hapd->driver->name, "none") == 0;
775 bool hostapd_drv_nl80211(struct hostapd_data *hapd)
777 return hapd->driver && os_strcmp(hapd->driver->name, "nl80211") == 0;
781 int hostapd_driver_scan(struct hostapd_data *hapd,
784 if (hapd->driver && hapd->driver->scan2)
785 return hapd->driver->scan2(hapd->drv_priv, params);
791 struct hostapd_data *hapd)
793 if (hapd->driver && hapd->driver->get_scan_results)
794 return hapd->driver->get_scan_results(hapd->drv_priv, NULL);
795 if (hapd->driver && hapd->driver->get_scan_results2)
796 return hapd->driver->get_scan_results2(hapd->drv_priv);
801 int hostapd_driver_set_noa(struct hostapd_data *hapd, u8 count, int start,
804 if (hapd->driver && hapd->driver->set_noa)
805 return hapd->driver->set_noa(hapd->drv_priv, count, start,
811 int hostapd_drv_set_key(const char *ifname, struct hostapd_data *hapd,
819 if (hapd->driver == NULL || hapd->driver->set_key == NULL)
837 if (hapd->conf->mld_ap && !(key_flag & KEY_FLAG_PAIRWISE))
838 params.link_id = hapd->mld_link_id;
841 return hapd->driver->set_key(hapd->drv_priv, ¶ms);
845 int hostapd_drv_send_mlme(struct hostapd_data *hapd,
853 if (hapd->conf->mld_ap)
854 link_id = hapd->mld_link_id;
857 if (!hapd->driver || !hapd->driver->send_mlme || !hapd->drv_priv)
859 return hapd->driver->send_mlme(hapd->drv_priv, msg, len, noack, 0,
865 int hostapd_drv_sta_deauth(struct hostapd_data *hapd,
869 const u8 *own_addr = hapd->own_addr;
872 if (hapd->conf->mld_ap) {
873 struct sta_info *sta = ap_get_sta(hapd, addr);
875 link_id = hapd->mld_link_id;
876 if (ap_sta_is_mld(hapd, sta))
877 own_addr = hapd->mld->mld_addr;
881 if (!hapd->driver || !hapd->driver->sta_deauth || !hapd->drv_priv)
883 return hapd->driver->sta_deauth(hapd->drv_priv, own_addr, addr,
888 int hostapd_drv_sta_disassoc(struct hostapd_data *hapd,
891 const u8 *own_addr = hapd->own_addr;
894 if (hapd->conf->mld_ap) {
895 struct sta_info *sta = ap_get_sta(hapd, addr);
897 if (ap_sta_is_mld(hapd, sta))
898 own_addr = hapd->mld->mld_addr;
902 if (!hapd->driver || !hapd->driver->sta_disassoc || !hapd->drv_priv)
904 return hapd->driver->sta_disassoc(hapd->drv_priv, own_addr, addr,
909 int hostapd_drv_wnm_oper(struct hostapd_data *hapd, enum wnm_oper oper,
912 if (hapd->driver == NULL || hapd->driver->wnm_oper == NULL)
914 return hapd->driver->wnm_oper(hapd->drv_priv, oper, peer, buf,
919 static int hapd_drv_send_action(struct hostapd_data *hapd, unsigned int freq,
923 const u8 *own_addr = hapd->own_addr;
930 if (!hapd->driver || !hapd->driver->send_action || !hapd->drv_priv)
932 bssid = hapd->own_addr;
939 sta = ap_get_sta(hapd, dst);
952 } else if (hapd->conf->mld_ap) {
953 sta = ap_get_sta(hapd, dst);
955 if (ap_sta_is_mld(hapd, sta)) {
956 own_addr = hapd->mld->mld_addr;
962 return hapd->driver->send_action(hapd->drv_priv, freq, wait, dst,
967 int hostapd_drv_send_action(struct hostapd_data *hapd, unsigned int freq,
971 return hapd_drv_send_action(hapd, freq, wait, dst, data, len, false);
975 int hostapd_drv_send_action_addr3_ap(struct hostapd_data *hapd,
980 return hapd_drv_send_action(hapd, freq, wait, dst, data, len, true);
992 struct hostapd_data *hapd = iface->bss[0];
997 if (!hapd->driver || !hapd->driver->start_dfs_cac || !cmode)
1015 hostapd_get_punct_bitmap(hapd))) {
1021 res = hapd->driver->start_dfs_cac(hapd->drv_priv, &data);
1034 int hostapd_drv_set_qos_map(struct hostapd_data *hapd,
1037 if (!hapd->driver || !hapd->driver->set_qos_map || !hapd->drv_priv ||
1038 !(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_QOS_MAPPING))
1040 return hapd->driver->set_qos_map(hapd->drv_priv, qos_map_set,
1045 void hostapd_get_hw_mode_any_channels(struct hostapd_data *hapd,
1057 (hapd->iface->conf->acs_freq_list.num &&
1059 &hapd->iface->conf->acs_freq_list,
1063 (!hapd->iface->conf->acs_freq_list_present &&
1064 hapd->iface->conf->acs_ch_list.num &&
1066 &hapd->iface->conf->acs_ch_list,
1070 ((hapd->iface->conf->acs_exclude_6ghz_non_psc &&
1072 (!hapd->iface->conf->ieee80211ax &&
1073 !hapd->iface->conf->ieee80211be)))
1076 !(hapd->iface->conf->acs_exclude_dfs &&
1078 !(chan->max_tx_power < hapd->iface->conf->min_tx_power))
1085 hapd->iface->is_no_ir = is_no_ir;
1091 struct hostapd_data *hapd = iface->bss[0];
1093 if (!hapd->driver || !hapd->driver->get_ext_capab)
1096 hapd->driver->get_ext_capab(hapd->drv_priv, WPA_IF_AP_BSS,
1105 struct hostapd_data *hapd = iface->bss[0];
1107 if (!hapd->driver || !hapd->driver->get_mld_capab)
1110 hapd->driver->get_mld_capab(hapd->drv_priv, WPA_IF_AP_BSS,
1118 * @hapd: BSS data for the device initiating ACS
1121 int hostapd_drv_do_acs(struct hostapd_data *hapd)
1129 if (hapd->driver == NULL || hapd->driver->do_acs == NULL)
1133 params.hw_mode = hapd->iface->conf->hw_mode;
1136 if (hapd->conf->mld_ap && hapd->iconf->ieee80211be &&
1137 !hapd->conf->disable_11be)
1138 params.link_id = hapd->mld_link_id;
1145 if (hapd->iface->conf->acs_freq_list_present)
1146 acs_ch_list_all = !hapd->iface->conf->acs_freq_list.num;
1148 acs_ch_list_all = !hapd->iface->conf->acs_ch_list.num;
1150 if (hapd->iface->current_mode)
1151 selected_mode = hapd->iface->current_mode->mode;
1155 for (i = 0; i < hapd->iface->num_hw_features; i++) {
1156 mode = &hapd->iface->hw_features[i];
1160 hostapd_get_hw_mode_any_channels(hapd, mode, acs_ch_list_all,
1164 if (!freq_list && hapd->iface->is_no_ir) {
1171 params.edmg_enabled = hapd->iface->conf->enable_edmg;
1173 params.ht_enabled = !!(hapd->iface->conf->ieee80211n);
1174 params.ht40_enabled = !!(hapd->iface->conf->ht_capab &
1176 params.vht_enabled = !!(hapd->iface->conf->ieee80211ac);
1177 params.eht_enabled = !!(hapd->iface->conf->ieee80211be);
1179 if (hapd->iface->conf->ieee80211n && params.ht40_enabled)
1184 if ((hapd->iface->conf->ieee80211be ||
1185 hapd->iface->conf->ieee80211ax ||
1186 hapd->iface->conf->ieee80211ac) &&
1190 oper_chwidth = hostapd_get_oper_chwidth(hapd->iface->conf);
1200 if (hapd->iface->conf->op_class)
1202 hapd->iface->conf->op_class);
1203 ret = hapd->driver->do_acs(hapd->drv_priv, ¶ms);
1210 int hostapd_drv_update_dh_ie(struct hostapd_data *hapd, const u8 *peer,
1213 if (!hapd->driver || !hapd->driver->update_dh_ie || !hapd->drv_priv)
1215 return hapd->driver->update_dh_ie(hapd->drv_priv, peer, reason_code,
1220 int hostapd_drv_dpp_listen(struct hostapd_data *hapd, bool enable)
1222 if (!hapd->driver || !hapd->driver->dpp_listen || !hapd->drv_priv)
1224 return hapd->driver->dpp_listen(hapd->drv_priv, enable);
1229 int hostapd_drv_set_secure_ranging_ctx(struct hostapd_data *hapd,
1237 if (!hapd->driver || !hapd->driver->set_secure_ranging_ctx)
1250 return hapd->driver->set_secure_ranging_ctx(hapd->drv_priv, ¶ms);