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