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