1 /*
2 * hostapd - Driver operations
3 * Copyright (c) 2009-2010, Jouni Malinen <j@w1.fi>
4 *
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
7 */
8
9 #include "utils/includes.h"
10
11 #include "utils/common.h"
12 #include "common/ieee802_11_defs.h"
13 #include "common/ieee802_11_common.h"
14 #include "common/hw_features_common.h"
15 #include "wps/wps.h"
16 #include "p2p/p2p.h"
17 #include "hostapd.h"
18 #include "ieee802_11.h"
19 #include "sta_info.h"
20 #include "ap_config.h"
21 #include "p2p_hostapd.h"
22 #include "hs20.h"
23 #include "wpa_auth.h"
24 #include "ap_drv_ops.h"
25
26
hostapd_sta_flags_to_drv(u32 flags)27 u32 hostapd_sta_flags_to_drv(u32 flags)
28 {
29 int res = 0;
30 if (flags & WLAN_STA_AUTHORIZED)
31 res |= WPA_STA_AUTHORIZED;
32 if (flags & WLAN_STA_WMM)
33 res |= WPA_STA_WMM;
34 if (flags & WLAN_STA_SHORT_PREAMBLE)
35 res |= WPA_STA_SHORT_PREAMBLE;
36 if (flags & WLAN_STA_MFP)
37 res |= WPA_STA_MFP;
38 if (flags & WLAN_STA_AUTH)
39 res |= WPA_STA_AUTHENTICATED;
40 if (flags & WLAN_STA_ASSOC)
41 res |= WPA_STA_ASSOCIATED;
42 return res;
43 }
44
hostapd_set_privacy(struct hostapd_data * hapd,int enabled)45 int hostapd_set_privacy(struct hostapd_data *hapd, int enabled)
46 {
47 if (hapd->driver == NULL || hapd->driver->set_privacy == NULL)
48 return 0;
49 return hapd->driver->set_privacy(hapd->drv_priv, enabled);
50 }
51
hostapd_set_generic_elem(struct hostapd_data * hapd,const u8 * elem,size_t elem_len)52 int hostapd_set_generic_elem(struct hostapd_data *hapd, const u8 *elem,
53 size_t elem_len)
54 {
55 if (hapd->driver == NULL || hapd->driver->set_generic_elem == NULL)
56 return 0;
57 return hapd->driver->set_generic_elem(hapd->drv_priv, elem, elem_len);
58 }
hostapd_set_drv_ieee8021x(struct hostapd_data * hapd,const char * ifname,int enabled)59 int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd, const char *ifname,
60 int enabled)
61 {
62 struct wpa_bss_params params;
63 os_memset(¶ms, 0, sizeof(params));
64 params.ifname = ifname;
65 params.enabled = enabled;
66 if (enabled) {
67 params.wpa = hapd->conf->wpa;
68 #ifndef LOS_CONFIG_HOSTAPD_SECURITY
69 params.ieee802_1x = hapd->conf->ieee802_1x;
70 #endif
71 params.wpa_group = hapd->conf->wpa_group;
72 if ((hapd->conf->wpa & (WPA_PROTO_WPA | WPA_PROTO_RSN)) ==
73 (WPA_PROTO_WPA | WPA_PROTO_RSN))
74 params.wpa_pairwise = hapd->conf->wpa_pairwise |
75 hapd->conf->rsn_pairwise;
76 else if (hapd->conf->wpa & WPA_PROTO_RSN)
77 params.wpa_pairwise = hapd->conf->rsn_pairwise;
78 else if (hapd->conf->wpa & WPA_PROTO_WPA)
79 params.wpa_pairwise = hapd->conf->wpa_pairwise;
80 params.wpa_key_mgmt = hapd->conf->wpa_key_mgmt;
81 params.rsn_preauth = hapd->conf->rsn_preauth;
82 params.ieee80211w = hapd->conf->ieee80211w;
83 }
84 return hostapd_set_ieee8021x(hapd, ¶ms);
85 }
86
hostapd_set_ieee8021x(struct hostapd_data * hapd,struct wpa_bss_params * params)87 int hostapd_set_ieee8021x(struct hostapd_data *hapd,
88 struct wpa_bss_params *params)
89 {
90 if (hapd->driver == NULL || hapd->driver->set_ieee8021x == NULL)
91 return 0;
92 return hapd->driver->set_ieee8021x(hapd->drv_priv, params);
93 }
94
95
96 #ifdef CONFIG_WPS_AP
add_buf(struct wpabuf ** dst,const struct wpabuf * src)97 static int add_buf(struct wpabuf **dst, const struct wpabuf *src)
98 {
99 if (!src)
100 return 0;
101 if (wpabuf_resize(dst, wpabuf_len(src)) != 0)
102 return -1;
103 wpabuf_put_buf(*dst, src);
104 return 0;
105 }
106 #endif /* CONFIG_WPS_AP */
107
108 #ifdef CONFIG_WPS_AP
add_buf_data(struct wpabuf ** dst,const u8 * data,size_t len)109 static int add_buf_data(struct wpabuf **dst, const u8 *data, size_t len)
110 {
111 if (!data || !len)
112 return 0;
113 if (wpabuf_resize(dst, len) != 0)
114 return -1;
115 wpabuf_put_data(*dst, data, len);
116 return 0;
117 }
118 #endif /* CONFIG_WPS_AP */
119
hostapd_build_ap_extra_ies(struct hostapd_data * hapd,struct wpabuf ** beacon_ret,struct wpabuf ** proberesp_ret,struct wpabuf ** assocresp_ret)120 int hostapd_build_ap_extra_ies(struct hostapd_data *hapd,
121 struct wpabuf **beacon_ret,
122 struct wpabuf **proberesp_ret,
123 struct wpabuf **assocresp_ret)
124 {
125 struct wpabuf *beacon = NULL, *proberesp = NULL, *assocresp = NULL;
126 u8 buf[200], *pos;
127
128 *beacon_ret = *proberesp_ret = *assocresp_ret = NULL;
129
130 #ifndef EXT_CODE_CROP
131 pos = buf;
132 pos = hostapd_eid_time_adv(hapd, pos);
133 if (add_buf_data(&beacon, buf, pos - buf) < 0)
134 goto fail;
135 pos = hostapd_eid_time_zone(hapd, pos);
136 if (add_buf_data(&proberesp, buf, pos - buf) < 0)
137 goto fail;
138
139 pos = buf;
140 pos = hostapd_eid_ext_capab(hapd, pos);
141 if (add_buf_data(&assocresp, buf, pos - buf) < 0)
142 goto fail;
143 pos = hostapd_eid_interworking(hapd, pos);
144 pos = hostapd_eid_adv_proto(hapd, pos);
145 pos = hostapd_eid_roaming_consortium(hapd, pos);
146 if (add_buf_data(&beacon, buf, pos - buf) < 0 ||
147 add_buf_data(&proberesp, buf, pos - buf) < 0)
148 goto fail;
149 #endif /* EXT_CODE_CROP */
150 #ifdef CONFIG_FST
151 if (add_buf(&beacon, hapd->iface->fst_ies) < 0 ||
152 add_buf(&proberesp, hapd->iface->fst_ies) < 0 ||
153 add_buf(&assocresp, hapd->iface->fst_ies) < 0)
154 goto fail;
155 #endif /* CONFIG_FST */
156
157 #ifdef CONFIG_FILS
158 pos = hostapd_eid_fils_indic(hapd, buf, 0);
159 if (add_buf_data(&beacon, buf, pos - buf) < 0 ||
160 add_buf_data(&proberesp, buf, pos - buf) < 0)
161 goto fail;
162 #endif /* CONFIG_FILS */
163
164 pos = hostapd_eid_rsnxe(hapd, buf, sizeof(buf));
165 #ifdef CONFIG_WPS_AP
166 if (add_buf_data(&assocresp, buf, pos - buf) < 0)
167 goto fail;
168 #endif
169 #ifdef CONFIG_WPS_AP
170 if (add_buf(&beacon, hapd->wps_beacon_ie) < 0 ||
171 add_buf(&proberesp, hapd->wps_probe_resp_ie) < 0)
172 goto fail;
173 #endif /* CONFIG_WPS_AP */
174
175 #ifdef CONFIG_P2P
176 if (add_buf(&beacon, hapd->p2p_beacon_ie) < 0 ||
177 add_buf(&proberesp, hapd->p2p_probe_resp_ie) < 0)
178 goto fail;
179 #endif /* CONFIG_P2P */
180
181 #ifdef CONFIG_P2P_MANAGER
182 if (hapd->conf->p2p & P2P_MANAGE) {
183 if (wpabuf_resize(&beacon, 100) == 0) {
184 u8 *start, *p;
185 start = wpabuf_put(beacon, 0);
186 p = hostapd_eid_p2p_manage(hapd, start);
187 wpabuf_put(beacon, p - start);
188 }
189
190 if (wpabuf_resize(&proberesp, 100) == 0) {
191 u8 *start, *p;
192 start = wpabuf_put(proberesp, 0);
193 p = hostapd_eid_p2p_manage(hapd, start);
194 wpabuf_put(proberesp, p - start);
195 }
196 }
197 #endif /* CONFIG_P2P_MANAGER */
198
199 #ifdef CONFIG_WPS_AP
200 if (hapd->conf->wps_state) {
201 struct wpabuf *a = wps_build_assoc_resp_ie();
202 add_buf(&assocresp, a);
203 wpabuf_free(a);
204 }
205 #endif /* CONFIG_WPS_AP */
206
207 #ifdef CONFIG_P2P_MANAGER
208 if (hapd->conf->p2p & P2P_MANAGE) {
209 if (wpabuf_resize(&assocresp, 100) == 0) {
210 u8 *start, *p;
211 start = wpabuf_put(assocresp, 0);
212 p = hostapd_eid_p2p_manage(hapd, start);
213 wpabuf_put(assocresp, p - start);
214 }
215 }
216 #endif /* CONFIG_P2P_MANAGER */
217
218 #ifdef CONFIG_WIFI_DISPLAY
219 if (hapd->p2p_group) {
220 struct wpabuf *a;
221 a = p2p_group_assoc_resp_ie(hapd->p2p_group, P2P_SC_SUCCESS);
222 add_buf(&assocresp, a);
223 wpabuf_free(a);
224 }
225 #endif /* CONFIG_WIFI_DISPLAY */
226 #ifndef EXT_CODE_CROP
227 #ifdef CONFIG_HS20
228 pos = hostapd_eid_hs20_indication(hapd, buf);
229 if (add_buf_data(&beacon, buf, pos - buf) < 0 ||
230 add_buf_data(&proberesp, buf, pos - buf) < 0)
231 goto fail;
232
233 pos = hostapd_eid_osen(hapd, buf);
234 if (add_buf_data(&beacon, buf, pos - buf) < 0 ||
235 add_buf_data(&proberesp, buf, pos - buf) < 0)
236 goto fail;
237 #endif /* CONFIG_HS20 */
238 #endif /* EXT_CODE_CROP */
239 #ifdef CONFIG_MBO
240 if (hapd->conf->mbo_enabled ||
241 OCE_STA_CFON_ENABLED(hapd) || OCE_AP_ENABLED(hapd)) {
242 pos = hostapd_eid_mbo(hapd, buf, sizeof(buf));
243 if (add_buf_data(&beacon, buf, pos - buf) < 0 ||
244 add_buf_data(&proberesp, buf, pos - buf) < 0 ||
245 add_buf_data(&assocresp, buf, pos - buf) < 0)
246 goto fail;
247 }
248 #endif /* CONFIG_MBO */
249
250 #ifdef CONFIG_OWE
251 pos = hostapd_eid_owe_trans(hapd, buf, sizeof(buf));
252 if (add_buf_data(&beacon, buf, pos - buf) < 0 ||
253 add_buf_data(&proberesp, buf, pos - buf) < 0)
254 goto fail;
255 #endif /* CONFIG_OWE */
256 #ifndef EXT_CODE_CROP
257 add_buf(&beacon, hapd->conf->vendor_elements);
258 add_buf(&proberesp, hapd->conf->vendor_elements);
259 add_buf(&assocresp, hapd->conf->assocresp_elements);
260 #endif /* EXT_CODE_CROP */
261 *beacon_ret = beacon;
262 *proberesp_ret = proberesp;
263 *assocresp_ret = assocresp;
264
265 return 0;
266
267 #if defined(CONFIG_WPS_AP) || defined(CONFIG_OWE)
268 fail:
269 #endif /* CONFIG_WPS_AP */
270 wpabuf_free(beacon);
271 wpabuf_free(proberesp);
272 wpabuf_free(assocresp);
273 return -1;
274 }
275
276
hostapd_free_ap_extra_ies(struct hostapd_data * hapd,struct wpabuf * beacon,struct wpabuf * proberesp,struct wpabuf * assocresp)277 void hostapd_free_ap_extra_ies(struct hostapd_data *hapd,
278 struct wpabuf *beacon,
279 struct wpabuf *proberesp,
280 struct wpabuf *assocresp)
281 {
282 wpabuf_free(beacon);
283 wpabuf_free(proberesp);
284 wpabuf_free(assocresp);
285 }
286
287 #ifdef CONFIG_WPS_AP
hostapd_reset_ap_wps_ie(struct hostapd_data * hapd)288 int hostapd_reset_ap_wps_ie(struct hostapd_data *hapd)
289 {
290 if (hapd->driver == NULL || hapd->driver->set_ap_wps_ie == NULL)
291 return 0;
292
293 return hapd->driver->set_ap_wps_ie(hapd->drv_priv, NULL, NULL, NULL);
294 }
295
296
hostapd_set_ap_wps_ie(struct hostapd_data * hapd)297 int hostapd_set_ap_wps_ie(struct hostapd_data *hapd)
298 {
299 struct wpabuf *beacon, *proberesp, *assocresp;
300 int ret;
301
302 if (hapd->driver == NULL || hapd->driver->set_ap_wps_ie == NULL)
303 return 0;
304
305 if (hostapd_build_ap_extra_ies(hapd, &beacon, &proberesp, &assocresp) <
306 0)
307 return -1;
308
309 ret = hapd->driver->set_ap_wps_ie(hapd->drv_priv, beacon, proberesp,
310 assocresp);
311
312 hostapd_free_ap_extra_ies(hapd, beacon, proberesp, assocresp);
313
314 return ret;
315 }
316 #endif /* CONFIG_WPS_AP */
317 #ifndef LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT
hostapd_set_authorized(struct hostapd_data * hapd,struct sta_info * sta,int authorized)318 int hostapd_set_authorized(struct hostapd_data *hapd,
319 struct sta_info *sta, int authorized)
320 {
321 if (authorized) {
322 return hostapd_sta_set_flags(hapd, sta->addr,
323 hostapd_sta_flags_to_drv(
324 sta->flags),
325 WPA_STA_AUTHORIZED, ~0);
326 }
327
328 return hostapd_sta_set_flags(hapd, sta->addr,
329 hostapd_sta_flags_to_drv(sta->flags),
330 0, ~WPA_STA_AUTHORIZED);
331 }
332
333
hostapd_set_sta_flags(struct hostapd_data * hapd,struct sta_info * sta)334 int hostapd_set_sta_flags(struct hostapd_data *hapd, struct sta_info *sta)
335 {
336 int set_flags, total_flags, flags_and, flags_or;
337 total_flags = hostapd_sta_flags_to_drv(sta->flags);
338 set_flags = WPA_STA_SHORT_PREAMBLE | WPA_STA_WMM | WPA_STA_MFP;
339 #ifndef LOS_CONFIG_HOSTAPD_SECURITY
340 if (((!hapd->conf->ieee802_1x && !hapd->conf->wpa) ||
341 #else
342 if (((!hapd->conf->wpa) ||
343 #endif
344 sta->auth_alg == WLAN_AUTH_FT) &&
345 sta->flags & WLAN_STA_AUTHORIZED)
346 set_flags |= WPA_STA_AUTHORIZED;
347 flags_or = total_flags & set_flags;
348 flags_and = total_flags | ~set_flags;
349 return hostapd_sta_set_flags(hapd, sta->addr, total_flags,
350 flags_or, flags_and);
351 }
352
hostapd_vlan_if_add(struct hostapd_data * hapd,const char * ifname)353 int hostapd_vlan_if_add(struct hostapd_data *hapd, const char *ifname)
354 {
355 char force_ifname[IFNAMSIZ];
356 u8 if_addr[ETH_ALEN];
357 return hostapd_if_add(hapd, WPA_IF_AP_VLAN, ifname, hapd->own_addr,
358 NULL, NULL, force_ifname, if_addr, NULL, 0);
359 }
360
361
hostapd_vlan_if_remove(struct hostapd_data * hapd,const char * ifname)362 int hostapd_vlan_if_remove(struct hostapd_data *hapd, const char *ifname)
363 {
364 return hostapd_if_remove(hapd, WPA_IF_AP_VLAN, ifname);
365 }
366
367
hostapd_set_wds_sta(struct hostapd_data * hapd,char * ifname_wds,const u8 * addr,int aid,int val)368 int hostapd_set_wds_sta(struct hostapd_data *hapd, char *ifname_wds,
369 const u8 *addr, int aid, int val)
370 {
371 const char *bridge = NULL;
372
373 if (hapd->driver == NULL || hapd->driver->set_wds_sta == NULL)
374 return -1;
375 if (hapd->conf->wds_bridge[0])
376 bridge = hapd->conf->wds_bridge;
377 else if (hapd->conf->bridge[0])
378 bridge = hapd->conf->bridge;
379 return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val,
380 bridge, ifname_wds);
381 }
382
383
hostapd_add_sta_node(struct hostapd_data * hapd,const u8 * addr,u16 auth_alg)384 int hostapd_add_sta_node(struct hostapd_data *hapd, const u8 *addr,
385 u16 auth_alg)
386 {
387 if (hapd->driver == NULL || hapd->driver->add_sta_node == NULL)
388 return -EOPNOTSUPP;
389 return hapd->driver->add_sta_node(hapd->drv_priv, addr, auth_alg);
390 }
391
392
hostapd_sta_auth(struct hostapd_data * hapd,const u8 * addr,u16 seq,u16 status,const u8 * ie,size_t len)393 int hostapd_sta_auth(struct hostapd_data *hapd, const u8 *addr,
394 u16 seq, u16 status, const u8 *ie, size_t len)
395 {
396 struct wpa_driver_sta_auth_params params;
397 #ifndef EXT_CODE_CROP
398 #ifdef CONFIG_FILS
399 struct sta_info *sta;
400 #endif /* CONFIG_FILS */
401 #endif /* EXT_CODE_CROP */
402 if (hapd->driver == NULL || hapd->driver->sta_auth == NULL)
403 return 0;
404
405 os_memset(¶ms, 0, sizeof(params));
406 #ifndef EXT_CODE_CROP
407 #ifdef CONFIG_FILS
408 sta = ap_get_sta(hapd, addr);
409 if (!sta) {
410 wpa_printf(MSG_DEBUG, "Station " MACSTR
411 " not found for sta_auth processing",
412 MAC2STR(addr));
413 return 0;
414 }
415
416 if (sta->auth_alg == WLAN_AUTH_FILS_SK ||
417 sta->auth_alg == WLAN_AUTH_FILS_SK_PFS ||
418 sta->auth_alg == WLAN_AUTH_FILS_PK) {
419 params.fils_auth = 1;
420 wpa_auth_get_fils_aead_params(sta->wpa_sm, params.fils_anonce,
421 params.fils_snonce,
422 params.fils_kek,
423 ¶ms.fils_kek_len);
424 }
425 #endif /* CONFIG_FILS */
426 #endif /* EXT_CODE_CROP */
427 params.own_addr = hapd->own_addr;
428 params.addr = addr;
429 params.seq = seq;
430 params.status = status;
431 params.ie = ie;
432 params.len = len;
433
434 return hapd->driver->sta_auth(hapd->drv_priv, ¶ms);
435 }
436
437
hostapd_sta_assoc(struct hostapd_data * hapd,const u8 * addr,int reassoc,u16 status,const u8 * ie,size_t len)438 int hostapd_sta_assoc(struct hostapd_data *hapd, const u8 *addr,
439 int reassoc, u16 status, const u8 *ie, size_t len)
440 {
441 if (hapd->driver == NULL || hapd->driver->sta_assoc == NULL)
442 return 0;
443 return hapd->driver->sta_assoc(hapd->drv_priv, hapd->own_addr, addr,
444 reassoc, status, ie, len);
445 }
446
447 #ifndef EXT_CODE_CROP
hostapd_sta_add(struct hostapd_data * hapd,const u8 * addr,u16 aid,u16 capability,const u8 * supp_rates,size_t supp_rates_len,u16 listen_interval,const struct ieee80211_ht_capabilities * ht_capab,const struct ieee80211_vht_capabilities * vht_capab,const struct ieee80211_he_capabilities * he_capab,size_t he_capab_len,const struct ieee80211_he_6ghz_band_cap * he_6ghz_capab,u32 flags,u8 qosinfo,u8 vht_opmode,int supp_p2p_ps,int set)448 int hostapd_sta_add(struct hostapd_data *hapd,
449 const u8 *addr, u16 aid, u16 capability,
450 const u8 *supp_rates, size_t supp_rates_len,
451 u16 listen_interval,
452 const struct ieee80211_ht_capabilities *ht_capab,
453
454 const struct ieee80211_vht_capabilities *vht_capab,
455 const struct ieee80211_he_capabilities *he_capab,
456 size_t he_capab_len,
457 const struct ieee80211_he_6ghz_band_cap *he_6ghz_capab,
458 u32 flags, u8 qosinfo, u8 vht_opmode, int supp_p2p_ps,
459 int set)
460 #else
461 int hostapd_sta_add(struct hostapd_data *hapd,
462 const u8 *addr, u16 aid, u16 capability,
463 const u8 *supp_rates, size_t supp_rates_len,
464 u16 listen_interval,
465 const struct ieee80211_ht_capabilities *ht_capab,
466 u32 flags, u8 qosinfo, int supp_p2p_ps,
467 int set)
468 #endif /* EXT_CODE_CROP */
469 {
470 struct hostapd_sta_add_params params;
471
472 if (hapd->driver == NULL)
473 return 0;
474 if (hapd->driver->sta_add == NULL)
475 return 0;
476
477 os_memset(¶ms, 0, sizeof(params));
478 params.addr = addr;
479 params.aid = aid;
480 params.capability = capability;
481 params.supp_rates = supp_rates;
482 params.supp_rates_len = supp_rates_len;
483 params.listen_interval = listen_interval;
484 params.ht_capabilities = ht_capab;
485 #ifndef EXT_CODE_CROP
486 params.he_capab = he_capab;
487 params.he_capab_len = he_capab_len;
488 params.vht_capabilities = vht_capab;
489 params.he_6ghz_capab = he_6ghz_capab;
490 params.vht_opmode_enabled = !!(flags & WLAN_STA_VHT_OPMODE_ENABLED);
491 params.vht_opmode = vht_opmode;
492 #endif /* EXT_CODE_CROP */
493 params.flags = hostapd_sta_flags_to_drv(flags);
494 #ifndef EXT_CODE_CROP
495 params.qosinfo = qosinfo;
496 params.support_p2p_ps = supp_p2p_ps;
497 #endif /* EXT_CODE_CROP */
498 params.set = set;
499 return hapd->driver->sta_add(hapd->drv_priv, ¶ms);
500 }
501
502
hostapd_add_tspec(struct hostapd_data * hapd,const u8 * addr,u8 * tspec_ie,size_t tspec_ielen)503 int hostapd_add_tspec(struct hostapd_data *hapd, const u8 *addr,
504 u8 *tspec_ie, size_t tspec_ielen)
505 {
506 if (hapd->driver == NULL || hapd->driver->add_tspec == NULL)
507 return 0;
508 return hapd->driver->add_tspec(hapd->drv_priv, addr, tspec_ie,
509 tspec_ielen);
510 }
511
hostapd_get_ssid(struct hostapd_data * hapd,u8 * buf,size_t len)512 int hostapd_get_ssid(struct hostapd_data *hapd, u8 *buf, size_t len)
513 {
514 if (hapd->driver == NULL || hapd->driver->hapd_get_ssid == NULL)
515 return 0;
516 return hapd->driver->hapd_get_ssid(hapd->drv_priv, buf, len);
517 }
518
519
hostapd_set_ssid(struct hostapd_data * hapd,const u8 * buf,size_t len)520 int hostapd_set_ssid(struct hostapd_data *hapd, const u8 *buf, size_t len)
521 {
522 if (hapd->driver == NULL || hapd->driver->hapd_set_ssid == NULL)
523 return 0;
524 return hapd->driver->hapd_set_ssid(hapd->drv_priv, buf, len);
525 }
526
527
hostapd_if_add(struct hostapd_data * hapd,enum wpa_driver_if_type type,const char * ifname,const u8 * addr,void * bss_ctx,void ** drv_priv,char * force_ifname,u8 * if_addr,const char * bridge,int use_existing)528 int hostapd_if_add(struct hostapd_data *hapd, enum wpa_driver_if_type type,
529 const char *ifname, const u8 *addr, void *bss_ctx,
530 void **drv_priv, char *force_ifname, u8 *if_addr,
531 const char *bridge, int use_existing)
532 {
533 if (hapd->driver == NULL || hapd->driver->if_add == NULL)
534 return -1;
535 return hapd->driver->if_add(hapd->drv_priv, type, ifname, addr,
536 bss_ctx, drv_priv, force_ifname, if_addr,
537 bridge, use_existing, 1);
538 }
539
540
hostapd_if_remove(struct hostapd_data * hapd,enum wpa_driver_if_type type,const char * ifname)541 int hostapd_if_remove(struct hostapd_data *hapd, enum wpa_driver_if_type type,
542 const char *ifname)
543 {
544 if (hapd->driver == NULL || hapd->drv_priv == NULL ||
545 hapd->driver->if_remove == NULL)
546 return -1;
547 return hapd->driver->if_remove(hapd->drv_priv, type, ifname);
548 }
549
hostapd_get_seqnum(const char * ifname,struct hostapd_data * hapd,const u8 * addr,int idx,u8 * seq)550 int hostapd_get_seqnum(const char *ifname, struct hostapd_data *hapd,
551 const u8 *addr, int idx, u8 *seq)
552 {
553 if (hapd->driver == NULL || hapd->driver->get_seqnum == NULL)
554 return 0;
555 return hapd->driver->get_seqnum(ifname, hapd->drv_priv, addr, idx,
556 seq);
557 }
558
559
hostapd_flush(struct hostapd_data * hapd)560 int hostapd_flush(struct hostapd_data *hapd)
561 {
562 if (hapd->driver == NULL || hapd->driver->flush == NULL)
563 return 0;
564 return hapd->driver->flush(hapd->drv_priv);
565 }
566
567 #ifndef EXT_CODE_CROP
hostapd_set_freq(struct hostapd_data * hapd,enum hostapd_hw_mode mode,int freq,int channel,int edmg,u8 edmg_channel,int ht_enabled,int vht_enabled,int he_enabled,int sec_channel_offset,int oper_chwidth,int center_segment0,int center_segment1)568 int hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode,
569 int freq, int channel, int edmg, u8 edmg_channel,
570 int ht_enabled, int vht_enabled,
571 int he_enabled,
572 int sec_channel_offset, int oper_chwidth,
573 int center_segment0, int center_segment1)
574 #else
575 int hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode,
576 int freq, int channel, int ht_enabled)
577 #endif /* EXT_CODE_CROP */
578 {
579 struct hostapd_freq_params data;
580 struct hostapd_hw_modes *cmode = hapd->iface->current_mode;
581 #ifndef LOS_WPA_PATCH
582 if (hostapd_set_freq_params(&data, mode, freq, channel, edmg,
583 edmg_channel, ht_enabled,
584 vht_enabled, he_enabled, sec_channel_offset,
585 oper_chwidth,
586 center_segment0, center_segment1,
587 cmode ? cmode->vht_capab : 0,
588 cmode ?
589 &cmode->he_capab[IEEE80211_MODE_AP] : NULL))
590 #else
591 if (hostapd_set_freq_params(&data, mode, freq, channel, ht_enabled))
592 #endif /* LOS_WPA_PATCH */
593 return -1;
594
595 #ifndef LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT
596 if (hapd->driver == NULL)
597 return 0;
598 if (hapd->driver->set_freq == NULL)
599 return 0;
600 return hapd->driver->set_freq(hapd->drv_priv, &data);
601 #else
602 return 0;
603 #endif /* LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT */
604 }
605
hostapd_set_rts(struct hostapd_data * hapd,int rts)606 int hostapd_set_rts(struct hostapd_data *hapd, int rts)
607 {
608 if (hapd->driver == NULL || hapd->driver->set_rts == NULL)
609 return 0;
610 return hapd->driver->set_rts(hapd->drv_priv, rts);
611 }
612
613
hostapd_set_frag(struct hostapd_data * hapd,int frag)614 int hostapd_set_frag(struct hostapd_data *hapd, int frag)
615 {
616 if (hapd->driver == NULL || hapd->driver->set_frag == NULL)
617 return 0;
618 return hapd->driver->set_frag(hapd->drv_priv, frag);
619 }
620
621
hostapd_sta_set_flags(struct hostapd_data * hapd,u8 * addr,int total_flags,int flags_or,int flags_and)622 int hostapd_sta_set_flags(struct hostapd_data *hapd, u8 *addr,
623 int total_flags, int flags_or, int flags_and)
624 {
625 if (!hapd->driver || !hapd->drv_priv || !hapd->driver->sta_set_flags)
626 return 0;
627 return hapd->driver->sta_set_flags(hapd->drv_priv, addr, total_flags,
628 flags_or, flags_and);
629 }
630
631
hostapd_sta_set_airtime_weight(struct hostapd_data * hapd,const u8 * addr,unsigned int weight)632 int hostapd_sta_set_airtime_weight(struct hostapd_data *hapd, const u8 *addr,
633 unsigned int weight)
634 {
635 if (!hapd->driver || !hapd->driver->sta_set_airtime_weight)
636 return 0;
637 return hapd->driver->sta_set_airtime_weight(hapd->drv_priv, addr,
638 weight);
639 }
640
641
hostapd_set_country(struct hostapd_data * hapd,const char * country)642 int hostapd_set_country(struct hostapd_data *hapd, const char *country)
643 {
644 if (hapd->driver == NULL ||
645 hapd->driver->set_country == NULL)
646 return 0;
647 return hapd->driver->set_country(hapd->drv_priv, country);
648 }
649
650
hostapd_set_tx_queue_params(struct hostapd_data * hapd,int queue,int aifs,int cw_min,int cw_max,int burst_time)651 int hostapd_set_tx_queue_params(struct hostapd_data *hapd, int queue, int aifs,
652 int cw_min, int cw_max, int burst_time)
653 {
654 if (hapd->driver == NULL || hapd->driver->set_tx_queue_params == NULL)
655 return 0;
656 return hapd->driver->set_tx_queue_params(hapd->drv_priv, queue, aifs,
657 cw_min, cw_max, burst_time);
658 }
659 #endif /* LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT */
660
661 #ifndef EXT_CODE_CROP
662 struct hostapd_hw_modes *
hostapd_get_hw_feature_data(struct hostapd_data * hapd,u16 * num_modes,u16 * flags,u8 * dfs_domain)663 hostapd_get_hw_feature_data(struct hostapd_data *hapd, u16 *num_modes,
664 u16 *flags, u8 *dfs_domain)
665 {
666 if (hapd->driver == NULL ||
667 hapd->driver->get_hw_feature_data == NULL)
668 return NULL;
669 return hapd->driver->get_hw_feature_data(hapd->drv_priv, num_modes,
670 flags, dfs_domain);
671 }
672 #else
673 struct hostapd_hw_modes *
hostapd_get_hw_feature_data(struct hostapd_data * hapd,u16 * num_modes,u16 * flags)674 hostapd_get_hw_feature_data(struct hostapd_data *hapd, u16 *num_modes,
675 u16 *flags)
676 {
677 if (hapd->driver == NULL ||
678 hapd->driver->get_hw_feature_data == NULL)
679 return NULL;
680 return hapd->driver->get_hw_feature_data(hapd->drv_priv, num_modes,
681 flags);
682 }
683 #endif /* EXT_CODE_CROP */
684 #ifndef LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT
hostapd_driver_commit(struct hostapd_data * hapd)685 int hostapd_driver_commit(struct hostapd_data *hapd)
686 {
687 if (hapd->driver == NULL || hapd->driver->commit == NULL)
688 return 0;
689 return hapd->driver->commit(hapd->drv_priv);
690 }
691
692
hostapd_drv_none(struct hostapd_data * hapd)693 int hostapd_drv_none(struct hostapd_data *hapd)
694 {
695 return hapd->driver && os_strcmp(hapd->driver->name, "none") == 0;
696 }
697 #endif /* LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT */
698
hostapd_drv_nl80211(struct hostapd_data * hapd)699 bool hostapd_drv_nl80211(struct hostapd_data *hapd)
700 {
701 return hapd->driver && os_strcmp(hapd->driver->name, "nl80211") == 0;
702 }
703
704
hostapd_driver_scan(struct hostapd_data * hapd,struct wpa_driver_scan_params * params)705 int hostapd_driver_scan(struct hostapd_data *hapd,
706 struct wpa_driver_scan_params *params)
707 {
708 if (hapd->driver && hapd->driver->scan2)
709 return hapd->driver->scan2(hapd->drv_priv, params);
710 return -1;
711 }
712
713
hostapd_driver_get_scan_results(struct hostapd_data * hapd)714 struct wpa_scan_results * hostapd_driver_get_scan_results(
715 struct hostapd_data *hapd)
716 {
717 if (hapd->driver && hapd->driver->get_scan_results2)
718 return hapd->driver->get_scan_results2(hapd->drv_priv);
719 return NULL;
720 }
721
722 #ifdef CONFIG_P2P
hostapd_driver_set_noa(struct hostapd_data * hapd,u8 count,int start,int duration)723 int hostapd_driver_set_noa(struct hostapd_data *hapd, u8 count, int start,
724 int duration)
725 {
726 if (hapd->driver && hapd->driver->set_noa)
727 return hapd->driver->set_noa(hapd->drv_priv, count, start,
728 duration);
729 return -1;
730 }
731 #endif /* CONFIG_P2P */
732
hostapd_drv_set_key(const char * ifname,struct hostapd_data * hapd,enum wpa_alg alg,const u8 * addr,int key_idx,int vlan_id,int set_tx,const u8 * seq,size_t seq_len,const u8 * key,size_t key_len,enum key_flag key_flag)733 int hostapd_drv_set_key(const char *ifname, struct hostapd_data *hapd,
734 enum wpa_alg alg, const u8 *addr,
735 int key_idx, int vlan_id, int set_tx,
736 const u8 *seq, size_t seq_len,
737 const u8 *key, size_t key_len, enum key_flag key_flag)
738 {
739 struct wpa_driver_set_key_params params;
740
741 if (hapd->driver == NULL || hapd->driver->set_key == NULL)
742 return 0;
743
744 os_memset(¶ms, 0, sizeof(params));
745 params.ifname = ifname;
746 params.alg = alg;
747 params.addr = addr;
748 params.key_idx = key_idx;
749 params.set_tx = set_tx;
750 params.seq = seq;
751 params.seq_len = seq_len;
752 params.key = key;
753 params.key_len = key_len;
754 params.vlan_id = vlan_id;
755 params.key_flag = key_flag;
756
757 return hapd->driver->set_key(hapd->drv_priv, ¶ms);
758 }
759
760
hostapd_drv_send_mlme(struct hostapd_data * hapd,const void * msg,size_t len,int noack,const u16 * csa_offs,size_t csa_offs_len,int no_encrypt)761 int hostapd_drv_send_mlme(struct hostapd_data *hapd,
762 const void *msg, size_t len, int noack,
763 const u16 *csa_offs, size_t csa_offs_len,
764 int no_encrypt)
765 {
766 if (!hapd->driver || !hapd->driver->send_mlme || !hapd->drv_priv)
767 return 0;
768 return hapd->driver->send_mlme(hapd->drv_priv, msg, len, noack, 0,
769 csa_offs, csa_offs_len, no_encrypt, 0);
770 }
771
772
hostapd_drv_sta_deauth(struct hostapd_data * hapd,const u8 * addr,int reason)773 int hostapd_drv_sta_deauth(struct hostapd_data *hapd,
774 const u8 *addr, int reason)
775 {
776 if (!hapd->driver || !hapd->driver->sta_deauth || !hapd->drv_priv)
777 return 0;
778 return hapd->driver->sta_deauth(hapd->drv_priv, hapd->own_addr, addr,
779 reason);
780 }
781
782 #ifndef LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT
hostapd_drv_sta_disassoc(struct hostapd_data * hapd,const u8 * addr,int reason)783 int hostapd_drv_sta_disassoc(struct hostapd_data *hapd,
784 const u8 *addr, int reason)
785 {
786 if (!hapd->driver || !hapd->driver->sta_disassoc || !hapd->drv_priv)
787 return 0;
788 return hapd->driver->sta_disassoc(hapd->drv_priv, hapd->own_addr, addr,
789 reason);
790 }
791
792
hostapd_drv_wnm_oper(struct hostapd_data * hapd,enum wnm_oper oper,const u8 * peer,u8 * buf,u16 * buf_len)793 int hostapd_drv_wnm_oper(struct hostapd_data *hapd, enum wnm_oper oper,
794 const u8 *peer, u8 *buf, u16 *buf_len)
795 {
796 if (hapd->driver == NULL || hapd->driver->wnm_oper == NULL)
797 return -1;
798 return hapd->driver->wnm_oper(hapd->drv_priv, oper, peer, buf,
799 buf_len);
800 }
801 #endif /* LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT */
802
hostapd_drv_send_action(struct hostapd_data * hapd,unsigned int freq,unsigned int wait,const u8 * dst,const u8 * data,size_t len)803 int hostapd_drv_send_action(struct hostapd_data *hapd, unsigned int freq,
804 unsigned int wait, const u8 *dst, const u8 *data,
805 size_t len)
806 {
807 const u8 *bssid;
808 const u8 wildcard_bssid[ETH_ALEN] = {
809 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
810 };
811
812 if (!hapd->driver || !hapd->driver->send_action || !hapd->drv_priv)
813 return 0;
814 bssid = hapd->own_addr;
815 if (!is_multicast_ether_addr(dst) &&
816 len > 0 && data[0] == WLAN_ACTION_PUBLIC) {
817 struct sta_info *sta;
818
819 /*
820 * Public Action frames to a STA that is not a member of the BSS
821 * shall use wildcard BSSID value.
822 */
823 sta = ap_get_sta(hapd, dst);
824 if (!sta || !(sta->flags & WLAN_STA_ASSOC))
825 bssid = wildcard_bssid;
826 } else if (is_broadcast_ether_addr(dst) &&
827 len > 0 && data[0] == WLAN_ACTION_PUBLIC) {
828 /*
829 * The only current use case of Public Action frames with
830 * broadcast destination address is DPP PKEX. That case is
831 * directing all devices and not just the STAs within the BSS,
832 * so have to use the wildcard BSSID value.
833 */
834 bssid = wildcard_bssid;
835 }
836 return hapd->driver->send_action(hapd->drv_priv, freq, wait, dst,
837 hapd->own_addr, bssid, data, len, 0);
838 }
839
840
hostapd_drv_send_action_addr3_ap(struct hostapd_data * hapd,unsigned int freq,unsigned int wait,const u8 * dst,const u8 * data,size_t len)841 int hostapd_drv_send_action_addr3_ap(struct hostapd_data *hapd,
842 unsigned int freq,
843 unsigned int wait, const u8 *dst,
844 const u8 *data, size_t len)
845 {
846 if (hapd->driver == NULL || hapd->driver->send_action == NULL)
847 return 0;
848 return hapd->driver->send_action(hapd->drv_priv, freq, wait, dst,
849 hapd->own_addr, hapd->own_addr, data,
850 len, 0);
851 }
852
853 #ifndef LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT
hostapd_start_dfs_cac(struct hostapd_iface * iface,enum hostapd_hw_mode mode,int freq,int channel,int ht_enabled,int vht_enabled,int he_enabled,int sec_channel_offset,int oper_chwidth,int center_segment0,int center_segment1)854 int hostapd_start_dfs_cac(struct hostapd_iface *iface,
855 enum hostapd_hw_mode mode, int freq,
856 int channel, int ht_enabled, int vht_enabled,
857 int he_enabled,
858 int sec_channel_offset, int oper_chwidth,
859 int center_segment0, int center_segment1)
860 {
861 struct hostapd_data *hapd = iface->bss[0];
862 struct hostapd_freq_params data;
863 int res;
864 struct hostapd_hw_modes *cmode = iface->current_mode;
865
866 if (!hapd->driver || !hapd->driver->start_dfs_cac || !cmode)
867 return 0;
868
869 if (!iface->conf->ieee80211h) {
870 wpa_printf(MSG_ERROR, "Can't start DFS CAC, DFS functionality "
871 "is not enabled");
872 return -1;
873 }
874
875 if (hostapd_set_freq_params(&data, mode, freq, channel, 0, 0,
876 ht_enabled,
877 vht_enabled, he_enabled, sec_channel_offset,
878 oper_chwidth, center_segment0,
879 center_segment1,
880 cmode->vht_capab,
881 &cmode->he_capab[IEEE80211_MODE_AP])) {
882 wpa_printf(MSG_ERROR, "Can't set freq params");
883 return -1;
884 }
885
886 res = hapd->driver->start_dfs_cac(hapd->drv_priv, &data);
887 if (!res) {
888 iface->cac_started = 1;
889 os_get_reltime(&iface->dfs_cac_start);
890 }
891
892 return res;
893 }
894
895
hostapd_drv_set_qos_map(struct hostapd_data * hapd,const u8 * qos_map_set,u8 qos_map_set_len)896 int hostapd_drv_set_qos_map(struct hostapd_data *hapd,
897 const u8 *qos_map_set, u8 qos_map_set_len)
898 {
899 if (!hapd->driver || !hapd->driver->set_qos_map || !hapd->drv_priv)
900 return 0;
901 return hapd->driver->set_qos_map(hapd->drv_priv, qos_map_set,
902 qos_map_set_len);
903 }
904 #endif /* LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT */
905
906 #if !defined(EXT_CODE_CROP) || defined(CONFIG_ACS)
hostapd_get_hw_mode_any_channels(struct hostapd_data * hapd,struct hostapd_hw_modes * mode,int acs_ch_list_all,int ** freq_list)907 static void hostapd_get_hw_mode_any_channels(struct hostapd_data *hapd,
908 struct hostapd_hw_modes *mode,
909 int acs_ch_list_all,
910 int **freq_list)
911 {
912 int i;
913
914 for (i = 0; i < mode->num_channels; i++) {
915 struct hostapd_channel_data *chan = &mode->channels[i];
916
917 if (!acs_ch_list_all &&
918 (hapd->iface->conf->acs_freq_list.num &&
919 !freq_range_list_includes(
920 &hapd->iface->conf->acs_freq_list,
921 chan->freq)))
922 continue;
923 if (!acs_ch_list_all &&
924 (!hapd->iface->conf->acs_freq_list_present &&
925 hapd->iface->conf->acs_ch_list.num &&
926 !freq_range_list_includes(
927 &hapd->iface->conf->acs_ch_list,
928 chan->chan)))
929 continue;
930 if (is_6ghz_freq(chan->freq) &&
931 hapd->iface->conf->acs_exclude_6ghz_non_psc &&
932 !is_6ghz_psc_frequency(chan->freq))
933 continue;
934 if (!(chan->flag & HOSTAPD_CHAN_DISABLED) &&
935 !(hapd->iface->conf->acs_exclude_dfs &&
936 (chan->flag & HOSTAPD_CHAN_RADAR)) &&
937 !(chan->max_tx_power < hapd->iface->conf->min_tx_power))
938 int_array_add_unique(freq_list, chan->freq);
939 }
940 }
941 #endif /* defined(EXT_CODE_CROP) || defined(CONFIG_ACS) */
942
943 #ifndef LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT
hostapd_get_ext_capa(struct hostapd_iface * iface)944 void hostapd_get_ext_capa(struct hostapd_iface *iface)
945 {
946 struct hostapd_data *hapd = iface->bss[0];
947
948 if (!hapd->driver || !hapd->driver->get_ext_capab)
949 return;
950
951 hapd->driver->get_ext_capab(hapd->drv_priv, WPA_IF_AP_BSS,
952 &iface->extended_capa,
953 &iface->extended_capa_mask,
954 &iface->extended_capa_len);
955 }
956 #endif /* LOS_CONFIG_EXT_DRIVER_NOT_SUPPORT */
957
958 #if !defined(EXT_CODE_CROP) || defined(CONFIG_ACS)
hostapd_drv_do_acs(struct hostapd_data * hapd)959 int hostapd_drv_do_acs(struct hostapd_data *hapd)
960 {
961 struct drv_acs_params params;
962 int ret, i, acs_ch_list_all = 0;
963 struct hostapd_hw_modes *mode;
964 int *freq_list = NULL;
965 enum hostapd_hw_mode selected_mode;
966
967 if (hapd->driver == NULL || hapd->driver->do_acs == NULL)
968 return 0;
969
970 os_memset(¶ms, 0, sizeof(params));
971 params.hw_mode = hapd->iface->conf->hw_mode;
972
973 /*
974 * If no chanlist config parameter is provided, include all enabled
975 * channels of the selected hw_mode.
976 */
977 if (hapd->iface->conf->acs_freq_list_present)
978 acs_ch_list_all = !hapd->iface->conf->acs_freq_list.num;
979 else
980 acs_ch_list_all = !hapd->iface->conf->acs_ch_list.num;
981
982 if (hapd->iface->current_mode)
983 selected_mode = hapd->iface->current_mode->mode;
984 else
985 selected_mode = HOSTAPD_MODE_IEEE80211ANY;
986
987 for (i = 0; i < hapd->iface->num_hw_features; i++) {
988 mode = &hapd->iface->hw_features[i];
989 if (selected_mode != HOSTAPD_MODE_IEEE80211ANY &&
990 selected_mode != mode->mode)
991 continue;
992 hostapd_get_hw_mode_any_channels(hapd, mode, acs_ch_list_all,
993 &freq_list);
994 }
995
996 params.freq_list = freq_list;
997 params.edmg_enabled = hapd->iface->conf->enable_edmg;
998
999 params.ht_enabled = !!(hapd->iface->conf->ieee80211n);
1000 params.ht40_enabled = !!(hapd->iface->conf->ht_capab &
1001 HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET);
1002 params.vht_enabled = !!(hapd->iface->conf->ieee80211ac);
1003 params.ch_width = 20;
1004 if (hapd->iface->conf->ieee80211n && params.ht40_enabled)
1005 params.ch_width = 40;
1006
1007 /* Note: VHT20 is defined by combination of ht_capab & oper_chwidth
1008 */
1009 if ((hapd->iface->conf->ieee80211ax ||
1010 hapd->iface->conf->ieee80211ac) &&
1011 params.ht40_enabled) {
1012 u8 oper_chwidth = hostapd_get_oper_chwidth(hapd->iface->conf);
1013
1014 if (oper_chwidth == CHANWIDTH_80MHZ)
1015 params.ch_width = 80;
1016 else if (oper_chwidth == CHANWIDTH_160MHZ ||
1017 oper_chwidth == CHANWIDTH_80P80MHZ)
1018 params.ch_width = 160;
1019 }
1020
1021 if (hapd->iface->conf->op_class)
1022 params.ch_width = op_class_to_bandwidth(
1023 hapd->iface->conf->op_class);
1024 ret = hapd->driver->do_acs(hapd->drv_priv, ¶ms);
1025 os_free(freq_list);
1026
1027 return ret;
1028 }
1029 #endif /* !defined(EXT_CODE_CROP) || defined(CONFIG_ACS) */
1030
1031 #ifdef CONFIG_OWE
hostapd_drv_update_dh_ie(struct hostapd_data * hapd,const u8 * peer,u16 reason_code,const u8 * ie,size_t ielen)1032 int hostapd_drv_update_dh_ie(struct hostapd_data *hapd, const u8 *peer,
1033 u16 reason_code, const u8 *ie, size_t ielen)
1034 {
1035 if (!hapd->driver || !hapd->driver->update_dh_ie || !hapd->drv_priv)
1036 return 0;
1037 return hapd->driver->update_dh_ie(hapd->drv_priv, peer, reason_code,
1038 ie, ielen);
1039 }
1040 #endif /* CONFIG_OWE */
1041
hostapd_drv_dpp_listen(struct hostapd_data * hapd,bool enable)1042 int hostapd_drv_dpp_listen(struct hostapd_data *hapd, bool enable)
1043 {
1044 if (!hapd->driver || !hapd->driver->dpp_listen || !hapd->drv_priv)
1045 return 0;
1046 return hapd->driver->dpp_listen(hapd->drv_priv, enable);
1047 }
1048