Lines Matching refs:hapd

55 static int hostapd_flush_old_stations(struct hostapd_data *hapd, u16 reason);
56 static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd);
57 static int hostapd_broadcast_wep_clear(struct hostapd_data *hapd);
81 void hostapd_reconfig_encryption(struct hostapd_data *hapd) in hostapd_reconfig_encryption() argument
83 if (hapd->wpa_auth) in hostapd_reconfig_encryption()
86 hostapd_set_privacy(hapd, 0); in hostapd_reconfig_encryption()
87 hostapd_setup_encryption(hapd->conf->iface, hapd); in hostapd_reconfig_encryption()
91 static void hostapd_reload_bss(struct hostapd_data *hapd) in hostapd_reload_bss() argument
95 if (!hapd->started) in hostapd_reload_bss()
98 if (hapd->conf->wmm_enabled < 0) in hostapd_reload_bss()
99 hapd->conf->wmm_enabled = hapd->iconf->ieee80211n; in hostapd_reload_bss()
102 radius_client_reconfig(hapd->radius, hapd->conf->radius); in hostapd_reload_bss()
105 ssid = &hapd->conf->ssid; in hostapd_reload_bss()
112 hostapd_config_clear_wpa_psk(&hapd->conf->ssid.wpa_psk); in hostapd_reload_bss()
114 if (hostapd_setup_wpa_psk(hapd->conf)) { in hostapd_reload_bss()
119 if (hapd->conf->ieee802_1x || hapd->conf->wpa) in hostapd_reload_bss()
120 hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 1); in hostapd_reload_bss()
122 hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 0); in hostapd_reload_bss()
124 if ((hapd->conf->wpa || hapd->conf->osen) && hapd->wpa_auth == NULL) { in hostapd_reload_bss()
125 hostapd_setup_wpa(hapd); in hostapd_reload_bss()
126 if (hapd->wpa_auth) in hostapd_reload_bss()
127 wpa_init_keys(hapd->wpa_auth); in hostapd_reload_bss()
128 } else if (hapd->conf->wpa) { in hostapd_reload_bss()
131 hostapd_reconfig_wpa(hapd); in hostapd_reload_bss()
132 wpa_ie = wpa_auth_get_wpa_ie(hapd->wpa_auth, &wpa_ie_len); in hostapd_reload_bss()
133 if (hostapd_set_generic_elem(hapd, wpa_ie, wpa_ie_len)) in hostapd_reload_bss()
136 } else if (hapd->wpa_auth) { in hostapd_reload_bss()
137 wpa_deinit(hapd->wpa_auth); in hostapd_reload_bss()
138 hapd->wpa_auth = NULL; in hostapd_reload_bss()
139 hostapd_set_privacy(hapd, 0); in hostapd_reload_bss()
140 hostapd_setup_encryption(hapd->conf->iface, hapd); in hostapd_reload_bss()
141 hostapd_set_generic_elem(hapd, (u8 *) "", 0); in hostapd_reload_bss()
144 ieee802_11_set_beacon(hapd); in hostapd_reload_bss()
145 hostapd_update_wps(hapd); in hostapd_reload_bss()
147 if (hapd->conf->ssid.ssid_set && in hostapd_reload_bss()
148 hostapd_set_ssid(hapd, hapd->conf->ssid.ssid, in hostapd_reload_bss()
149 hapd->conf->ssid.ssid_len)) { in hostapd_reload_bss()
153 wpa_printf(MSG_DEBUG, "Reconfigured interface %s", hapd->conf->iface); in hostapd_reload_bss()
200 struct hostapd_data *hapd = iface->bss[0]; in hostapd_reload_config() local
221 oldconf = hapd->iconf; in hostapd_reload_config()
233 hostapd_remove_iface(interfaces, hapd->conf->iface); in hostapd_reload_config()
254 hapd = iface->bss[j]; in hostapd_reload_config()
255 hapd->iconf = newconf; in hostapd_reload_config()
256 hapd->iconf->channel = oldconf->channel; in hostapd_reload_config()
257 hapd->iconf->acs = oldconf->acs; in hostapd_reload_config()
258 hapd->iconf->secondary_channel = oldconf->secondary_channel; in hostapd_reload_config()
259 hapd->iconf->ieee80211n = oldconf->ieee80211n; in hostapd_reload_config()
260 hapd->iconf->ieee80211ac = oldconf->ieee80211ac; in hostapd_reload_config()
261 hapd->iconf->ht_capab = oldconf->ht_capab; in hostapd_reload_config()
262 hapd->iconf->vht_capab = oldconf->vht_capab; in hostapd_reload_config()
263 hapd->iconf->vht_oper_chwidth = oldconf->vht_oper_chwidth; in hostapd_reload_config()
264 hapd->iconf->vht_oper_centr_freq_seg0_idx = in hostapd_reload_config()
266 hapd->iconf->vht_oper_centr_freq_seg1_idx = in hostapd_reload_config()
268 hapd->conf = newconf->bss[j]; in hostapd_reload_config()
269 hostapd_reload_bss(hapd); in hostapd_reload_config()
279 static void hostapd_broadcast_key_clear_iface(struct hostapd_data *hapd, in hostapd_broadcast_key_clear_iface() argument
284 if (!ifname || !hapd->drv_priv) in hostapd_broadcast_key_clear_iface()
287 if (hostapd_drv_set_key(ifname, hapd, WPA_ALG_NONE, NULL, i, in hostapd_broadcast_key_clear_iface()
295 if (hapd->conf->ieee80211w) { in hostapd_broadcast_key_clear_iface()
297 if (hostapd_drv_set_key(ifname, hapd, WPA_ALG_NONE, in hostapd_broadcast_key_clear_iface()
310 static int hostapd_broadcast_wep_clear(struct hostapd_data *hapd) in hostapd_broadcast_wep_clear() argument
312 hostapd_broadcast_key_clear_iface(hapd, hapd->conf->iface); in hostapd_broadcast_wep_clear()
317 static int hostapd_broadcast_wep_set(struct hostapd_data *hapd) in hostapd_broadcast_wep_set() argument
320 struct hostapd_ssid *ssid = &hapd->conf->ssid; in hostapd_broadcast_wep_set()
324 hostapd_drv_set_key(hapd->conf->iface, in hostapd_broadcast_wep_set()
325 hapd, WPA_ALG_WEP, broadcast_ether_addr, idx, in hostapd_broadcast_wep_set()
336 static void hostapd_free_hapd_data(struct hostapd_data *hapd) in hostapd_free_hapd_data() argument
338 os_free(hapd->probereq_cb); in hostapd_free_hapd_data()
339 hapd->probereq_cb = NULL; in hostapd_free_hapd_data()
340 hapd->num_probereq_cb = 0; in hostapd_free_hapd_data()
343 wpabuf_free(hapd->p2p_beacon_ie); in hostapd_free_hapd_data()
344 hapd->p2p_beacon_ie = NULL; in hostapd_free_hapd_data()
345 wpabuf_free(hapd->p2p_probe_resp_ie); in hostapd_free_hapd_data()
346 hapd->p2p_probe_resp_ie = NULL; in hostapd_free_hapd_data()
349 if (!hapd->started) { in hostapd_free_hapd_data()
351 __func__, hapd->conf ? hapd->conf->iface : "N/A"); in hostapd_free_hapd_data()
354 hapd->started = 0; in hostapd_free_hapd_data()
355 hapd->beacon_set_done = 0; in hostapd_free_hapd_data()
357 wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface); in hostapd_free_hapd_data()
358 iapp_deinit(hapd->iapp); in hostapd_free_hapd_data()
359 hapd->iapp = NULL; in hostapd_free_hapd_data()
360 accounting_deinit(hapd); in hostapd_free_hapd_data()
361 hostapd_deinit_wpa(hapd); in hostapd_free_hapd_data()
362 vlan_deinit(hapd); in hostapd_free_hapd_data()
363 hostapd_acl_deinit(hapd); in hostapd_free_hapd_data()
365 radius_client_deinit(hapd->radius); in hostapd_free_hapd_data()
366 hapd->radius = NULL; in hostapd_free_hapd_data()
367 radius_das_deinit(hapd->radius_das); in hostapd_free_hapd_data()
368 hapd->radius_das = NULL; in hostapd_free_hapd_data()
371 hostapd_deinit_wps(hapd); in hostapd_free_hapd_data()
373 hostapd_dpp_deinit(hapd); in hostapd_free_hapd_data()
374 gas_query_ap_deinit(hapd->gas); in hostapd_free_hapd_data()
377 authsrv_deinit(hapd); in hostapd_free_hapd_data()
379 if (hapd->interface_added) { in hostapd_free_hapd_data()
380 hapd->interface_added = 0; in hostapd_free_hapd_data()
381 if (hostapd_if_remove(hapd, WPA_IF_AP_BSS, hapd->conf->iface)) { in hostapd_free_hapd_data()
384 hapd->conf->iface); in hostapd_free_hapd_data()
385 hapd->interface_added = 1; in hostapd_free_hapd_data()
392 hapd->drv_priv = NULL; in hostapd_free_hapd_data()
396 wpabuf_free(hapd->time_adv); in hostapd_free_hapd_data()
399 gas_serv_deinit(hapd); in hostapd_free_hapd_data()
402 bss_load_update_deinit(hapd); in hostapd_free_hapd_data()
403 ndisc_snoop_deinit(hapd); in hostapd_free_hapd_data()
404 dhcp_snoop_deinit(hapd); in hostapd_free_hapd_data()
405 x_snoop_deinit(hapd); in hostapd_free_hapd_data()
408 bin_clear_free(hapd->tmp_eap_user.identity, in hostapd_free_hapd_data()
409 hapd->tmp_eap_user.identity_len); in hostapd_free_hapd_data()
410 bin_clear_free(hapd->tmp_eap_user.password, in hostapd_free_hapd_data()
411 hapd->tmp_eap_user.password_len); in hostapd_free_hapd_data()
415 wpabuf_free(hapd->mesh_pending_auth); in hostapd_free_hapd_data()
416 hapd->mesh_pending_auth = NULL; in hostapd_free_hapd_data()
419 hostapd_clean_rrm(hapd); in hostapd_free_hapd_data()
420 fils_hlp_deinit(hapd); in hostapd_free_hapd_data()
426 while ((q = dl_list_first(&hapd->sae_commit_queue, in hostapd_free_hapd_data()
433 eloop_cancel_timeout(auth_sae_process_commit, hapd, NULL); in hostapd_free_hapd_data()
446 static void hostapd_cleanup(struct hostapd_data *hapd) in hostapd_cleanup() argument
448 wpa_printf(MSG_DEBUG, "%s(hapd=%p (%s))", __func__, hapd, in hostapd_cleanup()
449 hapd->conf ? hapd->conf->iface : "N/A"); in hostapd_cleanup()
450 if (hapd->iface->interfaces && in hostapd_cleanup()
451 hapd->iface->interfaces->ctrl_iface_deinit) { in hostapd_cleanup()
452 wpa_msg(hapd->msg_ctx, MSG_INFO, WPA_EVENT_TERMINATING); in hostapd_cleanup()
453 hapd->iface->interfaces->ctrl_iface_deinit(hapd); in hostapd_cleanup()
455 hostapd_free_hapd_data(hapd); in hostapd_cleanup()
522 static void hostapd_clear_wep(struct hostapd_data *hapd) in hostapd_clear_wep() argument
524 if (hapd->drv_priv && !hapd->iface->driver_ap_teardown && hapd->conf) { in hostapd_clear_wep()
525 hostapd_set_privacy(hapd, 0); in hostapd_clear_wep()
526 hostapd_broadcast_wep_clear(hapd); in hostapd_clear_wep()
531 static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd) in hostapd_setup_encryption() argument
535 hostapd_broadcast_wep_set(hapd); in hostapd_setup_encryption()
537 if (hapd->conf->ssid.wep.default_len) { in hostapd_setup_encryption()
538 hostapd_set_privacy(hapd, 1); in hostapd_setup_encryption()
546 hostapd_drv_set_authmode(hapd, hapd->conf->auth_algs); in hostapd_setup_encryption()
549 if (hapd->conf->ssid.wep.key[i] && in hostapd_setup_encryption()
550 hostapd_drv_set_key(iface, hapd, WPA_ALG_WEP, NULL, i, in hostapd_setup_encryption()
551 i == hapd->conf->ssid.wep.idx, NULL, 0, in hostapd_setup_encryption()
552 hapd->conf->ssid.wep.key[i], in hostapd_setup_encryption()
553 hapd->conf->ssid.wep.len[i])) { in hostapd_setup_encryption()
558 if (hapd->conf->ssid.wep.key[i] && in hostapd_setup_encryption()
559 i == hapd->conf->ssid.wep.idx) in hostapd_setup_encryption()
560 hostapd_set_privacy(hapd, 1); in hostapd_setup_encryption()
567 static int hostapd_flush_old_stations(struct hostapd_data *hapd, u16 reason) in hostapd_flush_old_stations() argument
572 if (hostapd_drv_none(hapd) || hapd->drv_priv == NULL) in hostapd_flush_old_stations()
575 if (!hapd->iface->driver_ap_teardown) { in hostapd_flush_old_stations()
576 wpa_dbg(hapd->msg_ctx, MSG_DEBUG, in hostapd_flush_old_stations()
579 if (hostapd_flush(hapd)) { in hostapd_flush_old_stations()
580 wpa_msg(hapd->msg_ctx, MSG_WARNING, in hostapd_flush_old_stations()
585 if (hapd->conf && hapd->conf->broadcast_deauth) { in hostapd_flush_old_stations()
586 wpa_dbg(hapd->msg_ctx, MSG_DEBUG, in hostapd_flush_old_stations()
589 hostapd_drv_sta_deauth(hapd, addr, reason); in hostapd_flush_old_stations()
591 hostapd_free_stas(hapd); in hostapd_flush_old_stations()
597 static void hostapd_bss_deinit_no_free(struct hostapd_data *hapd) in hostapd_bss_deinit_no_free() argument
599 hostapd_free_stas(hapd); in hostapd_bss_deinit_no_free()
600 hostapd_flush_old_stations(hapd, WLAN_REASON_DEAUTH_LEAVING); in hostapd_bss_deinit_no_free()
601 hostapd_clear_wep(hapd); in hostapd_bss_deinit_no_free()
615 struct hostapd_data *hapd = iface->bss[0]; in hostapd_validate_bssid_configuration() local
619 if (hostapd_drv_none(hapd)) in hostapd_validate_bssid_configuration()
643 hapd->own_addr[i]; in hostapd_validate_bssid_configuration()
689 if ((hapd->own_addr[i] & mask[i]) != hapd->own_addr[i]) { in hostapd_validate_bssid_configuration()
692 MAC2STR(mask), MAC2STR(hapd->own_addr)); in hostapd_validate_bssid_configuration()
720 static int hostapd_das_nas_mismatch(struct hostapd_data *hapd, in hostapd_das_nas_mismatch() argument
724 (!hapd->conf->nas_identifier || in hostapd_das_nas_mismatch()
725 os_strlen(hapd->conf->nas_identifier) != in hostapd_das_nas_mismatch()
727 os_memcmp(hapd->conf->nas_identifier, attr->nas_identifier, in hostapd_das_nas_mismatch()
734 (hapd->conf->own_ip_addr.af != AF_INET || in hostapd_das_nas_mismatch()
735 os_memcmp(&hapd->conf->own_ip_addr.u.v4, attr->nas_ip_addr, 4) != in hostapd_das_nas_mismatch()
743 (hapd->conf->own_ip_addr.af != AF_INET6 || in hostapd_das_nas_mismatch()
744 os_memcmp(&hapd->conf->own_ip_addr.u.v6, attr->nas_ipv6_addr, 16) in hostapd_das_nas_mismatch()
755 static struct sta_info * hostapd_das_find_sta(struct hostapd_data *hapd, in hostapd_das_find_sta() argument
766 for (sta = hapd->sta_list; sta; sta = sta->next) in hostapd_das_find_sta()
771 sta = ap_get_sta(hapd, attr->sta_addr); in hostapd_das_find_sta()
779 for (sta = hapd->sta_list; sta; sta = sta->next) { in hostapd_das_find_sta()
795 for (sta = hapd->sta_list; sta; sta = sta->next) { in hostapd_das_find_sta()
823 for (sta = hapd->sta_list; sta; sta = sta->next) { in hostapd_das_find_sta()
854 for (sta = hapd->sta_list; sta; sta = sta->next) { in hostapd_das_find_sta()
881 for (sta = hapd->sta_list; sta; sta = sta->next) { in hostapd_das_find_sta()
919 for (sta = hapd->sta_list; sta; sta = sta->next) { in hostapd_das_find_sta()
933 static int hostapd_das_disconnect_pmksa(struct hostapd_data *hapd, in hostapd_das_disconnect_pmksa() argument
936 if (!hapd->wpa_auth) in hostapd_das_disconnect_pmksa()
938 return wpa_auth_radius_das_disconnect_pmksa(hapd->wpa_auth, attr); in hostapd_das_disconnect_pmksa()
945 struct hostapd_data *hapd = ctx; in hostapd_das_disconnect() local
949 if (hostapd_das_nas_mismatch(hapd, attr)) in hostapd_das_disconnect()
952 sta = hostapd_das_find_sta(hapd, attr, &multi); in hostapd_das_disconnect()
959 if (hostapd_das_disconnect_pmksa(hapd, attr) == 0) { in hostapd_das_disconnect()
970 wpa_auth_pmksa_remove(hapd->wpa_auth, sta->addr); in hostapd_das_disconnect()
972 hostapd_drv_sta_deauth(hapd, sta->addr, in hostapd_das_disconnect()
974 ap_sta_deauthenticate(hapd, sta, WLAN_REASON_PREV_AUTH_NOT_VALID); in hostapd_das_disconnect()
984 struct hostapd_data *hapd = ctx; in hostapd_das_coa() local
988 if (hostapd_das_nas_mismatch(hapd, attr)) in hostapd_das_coa()
991 sta = hostapd_das_find_sta(hapd, attr, &multi); in hostapd_das_coa()
1012 hs20_t_c_filtering(hapd, sta, 0); in hostapd_das_coa()
1035 static int hostapd_setup_bss(struct hostapd_data *hapd, int first) in hostapd_setup_bss() argument
1037 struct hostapd_bss_config *conf = hapd->conf; in hostapd_setup_bss()
1045 __func__, hapd, conf->iface, first); in hostapd_setup_bss()
1054 if (hapd->started) { in hostapd_setup_bss()
1059 hapd->started = 1; in hostapd_setup_bss()
1062 u8 *addr = hapd->own_addr; in hostapd_setup_bss()
1066 os_memcpy(hapd->own_addr, conf->bssid, ETH_ALEN); in hostapd_setup_bss()
1068 if (hostapd_mac_comp(hapd->own_addr, in hostapd_setup_bss()
1069 hapd->iface->bss[0]->own_addr) == in hostapd_setup_bss()
1076 } else if (hapd->iconf->use_driver_iface_addr) { in hostapd_setup_bss()
1081 inc_byte_array(hapd->own_addr, ETH_ALEN); in hostapd_setup_bss()
1082 } while (mac_in_conf(hapd->iconf, hapd->own_addr)); in hostapd_setup_bss()
1085 hapd->interface_added = 1; in hostapd_setup_bss()
1086 if (hostapd_if_add(hapd->iface->bss[0], WPA_IF_AP_BSS, in hostapd_setup_bss()
1087 conf->iface, addr, hapd, in hostapd_setup_bss()
1088 &hapd->drv_priv, force_ifname, if_addr, in hostapd_setup_bss()
1092 MACSTR ")", MAC2STR(hapd->own_addr)); in hostapd_setup_bss()
1093 hapd->interface_added = 0; in hostapd_setup_bss()
1098 os_memcpy(hapd->own_addr, if_addr, ETH_ALEN); in hostapd_setup_bss()
1102 conf->wmm_enabled = hapd->iconf->ieee80211n; in hostapd_setup_bss()
1106 os_memcpy(conf->r1_key_holder, hapd->own_addr, ETH_ALEN); in hostapd_setup_bss()
1110 if ((hapd->conf->mesh & MESH_ENABLED) && hapd->iface->mconf == NULL) in hostapd_setup_bss()
1115 hostapd_flush_old_stations(hapd, in hostapd_setup_bss()
1117 hostapd_set_privacy(hapd, 0); in hostapd_setup_bss()
1119 hostapd_broadcast_wep_clear(hapd); in hostapd_setup_bss()
1120 if (hostapd_setup_encryption(conf->iface, hapd)) in hostapd_setup_bss()
1128 ssid_len = hostapd_get_ssid(hapd, ssid, sizeof(ssid)); in hostapd_setup_bss()
1151 if (!hostapd_drv_none(hapd)) { in hostapd_setup_bss()
1154 conf->iface, MAC2STR(hapd->own_addr), in hostapd_setup_bss()
1165 if (set_ssid && hostapd_set_ssid(hapd, conf->ssid.ssid, in hostapd_setup_bss()
1174 hapd->radius = radius_client_init(hapd, conf->radius); in hostapd_setup_bss()
1175 if (hapd->radius == NULL) { in hostapd_setup_bss()
1193 das_conf.ctx = hapd; in hostapd_setup_bss()
1196 hapd->radius_das = radius_das_init(&das_conf); in hostapd_setup_bss()
1197 if (hapd->radius_das == NULL) { in hostapd_setup_bss()
1205 if (hostapd_acl_init(hapd)) { in hostapd_setup_bss()
1209 if (hostapd_init_wps(hapd, conf)) in hostapd_setup_bss()
1213 hapd->gas = gas_query_ap_init(hapd, hapd->msg_ctx); in hostapd_setup_bss()
1214 if (!hapd->gas) in hostapd_setup_bss()
1216 if (hostapd_dpp_init(hapd)) in hostapd_setup_bss()
1220 if (authsrv_init(hapd) < 0) in hostapd_setup_bss()
1223 if (ieee802_1x_init(hapd)) { in hostapd_setup_bss()
1228 if ((conf->wpa || conf->osen) && hostapd_setup_wpa(hapd)) in hostapd_setup_bss()
1231 if (accounting_init(hapd)) { in hostapd_setup_bss()
1237 (hapd->iapp = iapp_init(hapd, conf->iapp_iface)) == NULL) { in hostapd_setup_bss()
1244 if (gas_serv_init(hapd)) { in hostapd_setup_bss()
1250 hostapd_drv_set_qos_map(hapd, conf->qos_map_set, in hostapd_setup_bss()
1257 if (conf->bss_load_update_period && bss_load_update_init(hapd)) { in hostapd_setup_bss()
1263 if (x_snoop_init(hapd)) { in hostapd_setup_bss()
1269 if (dhcp_snoop_init(hapd)) { in hostapd_setup_bss()
1275 if (ndisc_snoop_init(hapd)) { in hostapd_setup_bss()
1282 if (!hostapd_drv_none(hapd) && vlan_init(hapd)) { in hostapd_setup_bss()
1287 if (!conf->start_disabled && ieee802_11_set_beacon(hapd) < 0) in hostapd_setup_bss()
1290 if (hapd->wpa_auth && wpa_init_keys(hapd->wpa_auth) < 0) in hostapd_setup_bss()
1293 if (hapd->driver && hapd->driver->set_operstate) in hostapd_setup_bss()
1294 hapd->driver->set_operstate(hapd->drv_priv, 1); in hostapd_setup_bss()
1302 struct hostapd_data *hapd = iface->bss[0]; in hostapd_tx_queue_params() local
1307 if ((hapd->conf->mesh & MESH_ENABLED) && iface->mconf == NULL) in hostapd_tx_queue_params()
1314 if (hostapd_set_tx_queue_params(hapd, i, p->aifs, p->cwmin, in hostapd_tx_queue_params()
1324 static int hostapd_set_acl_list(struct hostapd_data *hapd, in hostapd_set_acl_list() argument
1343 err = hostapd_drv_set_acl(hapd, acl_params); in hostapd_set_acl_list()
1351 static void hostapd_set_acl(struct hostapd_data *hapd) in hostapd_set_acl() argument
1353 struct hostapd_config *conf = hapd->iconf; in hostapd_set_acl()
1357 if (hapd->iface->drv_max_acl_mac_addrs == 0) in hostapd_set_acl()
1362 err = hostapd_set_acl_list(hapd, conf->bss[0]->accept_mac, in hostapd_set_acl()
1371 err = hostapd_set_acl_list(hapd, conf->bss[0]->deny_mac, in hostapd_set_acl()
1382 static int start_ctrl_iface_bss(struct hostapd_data *hapd) in start_ctrl_iface_bss() argument
1384 if (!hapd->iface->interfaces || in start_ctrl_iface_bss()
1385 !hapd->iface->interfaces->ctrl_iface_init) in start_ctrl_iface_bss()
1388 if (hapd->iface->interfaces->ctrl_iface_init(hapd)) { in start_ctrl_iface_bss()
1391 hapd->conf->iface); in start_ctrl_iface_bss()
1407 struct hostapd_data *hapd = iface->bss[i]; in start_ctrl_iface() local
1408 if (iface->interfaces->ctrl_iface_init(hapd)) { in start_ctrl_iface()
1411 hapd->conf->iface); in start_ctrl_iface()
1451 struct hostapd_data *hapd = iface->bss[0]; in setup_interface() local
1464 const char *phy = hostapd_drv_get_radio_name(hapd); in setup_interface()
1476 iface->bss[i]->driver = hapd->driver; in setup_interface()
1477 iface->bss[i]->drv_priv = hapd->drv_priv; in setup_interface()
1491 if (hapd->iconf->country[0] && hapd->iconf->country[1]) { in setup_interface()
1495 if (hostapd_get_country(hapd, previous_country) < 0) in setup_interface()
1498 os_memcpy(country, hapd->iconf->country, 3); in setup_interface()
1500 if (hostapd_set_country(hapd, country) < 0) { in setup_interface()
1567 struct hostapd_data *hapd = ctx; in fst_hostapd_get_bssid_cb() local
1569 return hapd->own_addr; in fst_hostapd_get_bssid_cb()
1577 struct hostapd_data *hapd = ctx; in fst_hostapd_get_channel_info_cb() local
1579 *hw_mode = ieee80211_freq_to_chan(hapd->iface->freq, channel); in fst_hostapd_get_channel_info_cb()
1585 struct hostapd_data *hapd = ctx; in fst_hostapd_set_ies_cb() local
1587 if (hapd->iface->fst_ies != fst_ies) { in fst_hostapd_set_ies_cb()
1588 hapd->iface->fst_ies = fst_ies; in fst_hostapd_set_ies_cb()
1589 if (ieee802_11_set_beacon(hapd)) in fst_hostapd_set_ies_cb()
1598 struct hostapd_data *hapd = ctx; in fst_hostapd_send_action_cb() local
1600 return hostapd_drv_send_action(hapd, hapd->iface->freq, 0, da, in fst_hostapd_send_action_cb()
1607 struct hostapd_data *hapd = ctx; in fst_hostapd_get_mb_ie_cb() local
1608 struct sta_info *sta = ap_get_sta(hapd, addr); in fst_hostapd_get_mb_ie_cb()
1617 struct hostapd_data *hapd = ctx; in fst_hostapd_update_mb_ie_cb() local
1618 struct sta_info *sta = ap_get_sta(hapd, addr); in fst_hostapd_update_mb_ie_cb()
1656 struct hostapd_data *hapd = ctx; in fst_hostapd_get_peer_first() local
1658 *get_ctx = (struct fst_get_peer_ctx *) hapd->sta_list; in fst_hostapd_get_peer_first()
1672 void fst_hostapd_fill_iface_obj(struct hostapd_data *hapd, in fst_hostapd_fill_iface_obj() argument
1675 iface_obj->ctx = hapd; in fst_hostapd_fill_iface_obj()
1692 struct hostapd_data *hapd = ctx; in hostapd_owe_iface_iter() local
1698 if (os_strcmp(hapd->conf->owe_transition_ifname, in hostapd_owe_iface_iter()
1705 hapd->conf->iface, bss->conf->iface, in hostapd_owe_iface_iter()
1713 os_memcpy(hapd->conf->owe_transition_bssid, bss->own_addr, in hostapd_owe_iface_iter()
1715 os_memcpy(hapd->conf->owe_transition_ssid, in hostapd_owe_iface_iter()
1717 hapd->conf->owe_transition_ssid_len = bss->conf->ssid.ssid_len; in hostapd_owe_iface_iter()
1727 int hostapd_owe_trans_get_info(struct hostapd_data *hapd) in hostapd_owe_trans_get_info() argument
1729 if (hapd->conf->owe_transition_ssid_len > 0 && in hostapd_owe_trans_get_info()
1730 !is_zero_ether_addr(hapd->conf->owe_transition_bssid)) in hostapd_owe_trans_get_info()
1735 if (!hapd->iface->interfaces || in hostapd_owe_trans_get_info()
1736 !hapd->iface->interfaces->for_each_interface) in hostapd_owe_trans_get_info()
1737 return hostapd_owe_iface_iter(hapd->iface, hapd); in hostapd_owe_trans_get_info()
1739 return hapd->iface->interfaces->for_each_interface( in hostapd_owe_trans_get_info()
1740 hapd->iface->interfaces, hostapd_owe_iface_iter, hapd); in hostapd_owe_trans_get_info()
1788 struct hostapd_data *hapd; in hostapd_interface_setup_failure_handler() local
1792 hapd = iface->bss[0]; in hostapd_interface_setup_failure_handler()
1793 if (hapd->setup_complete_cb) in hostapd_interface_setup_failure_handler()
1794 hapd->setup_complete_cb(hapd->setup_complete_cb_ctx); in hostapd_interface_setup_failure_handler()
1801 struct hostapd_data *hapd = iface->bss[0]; in hostapd_setup_interface_complete_sync() local
1816 iface->freq = hostapd_hw_get_freq(hapd, iface->conf->channel); in hostapd_setup_interface_complete_sync()
1862 hostapd_set_freq(hapd, hapd->iconf->hw_mode, iface->freq, in hostapd_setup_interface_complete_sync()
1863 hapd->iconf->channel, in hostapd_setup_interface_complete_sync()
1864 hapd->iconf->ieee80211n, in hostapd_setup_interface_complete_sync()
1865 hapd->iconf->ieee80211ac, in hostapd_setup_interface_complete_sync()
1866 hapd->iconf->secondary_channel, in hostapd_setup_interface_complete_sync()
1867 hapd->iconf->vht_oper_chwidth, in hostapd_setup_interface_complete_sync()
1868 hapd->iconf->vht_oper_centr_freq_seg0_idx, in hostapd_setup_interface_complete_sync()
1869 hapd->iconf->vht_oper_centr_freq_seg1_idx)) { in hostapd_setup_interface_complete_sync()
1880 hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, in hostapd_setup_interface_complete_sync()
1887 if (hapd->iconf->rts_threshold >= -1 && in hostapd_setup_interface_complete_sync()
1888 hostapd_set_rts(hapd, hapd->iconf->rts_threshold) && in hostapd_setup_interface_complete_sync()
1889 hapd->iconf->rts_threshold >= -1) { in hostapd_setup_interface_complete_sync()
1895 if (hapd->iconf->fragm_threshold >= -1 && in hostapd_setup_interface_complete_sync()
1896 hostapd_set_frag(hapd, hapd->iconf->fragm_threshold) && in hostapd_setup_interface_complete_sync()
1897 hapd->iconf->fragm_threshold != -1) { in hostapd_setup_interface_complete_sync()
1903 prev_addr = hapd->own_addr; in hostapd_setup_interface_complete_sync()
1906 hapd = iface->bss[j]; in hostapd_setup_interface_complete_sync()
1908 os_memcpy(hapd->own_addr, prev_addr, ETH_ALEN); in hostapd_setup_interface_complete_sync()
1909 if (hostapd_setup_bss(hapd, j == 0)) { in hostapd_setup_interface_complete_sync()
1911 hapd = iface->bss[j]; in hostapd_setup_interface_complete_sync()
1912 hostapd_bss_deinit_no_free(hapd); in hostapd_setup_interface_complete_sync()
1913 hostapd_free_hapd_data(hapd); in hostapd_setup_interface_complete_sync()
1920 if (is_zero_ether_addr(hapd->conf->bssid)) in hostapd_setup_interface_complete_sync()
1921 prev_addr = hapd->own_addr; in hostapd_setup_interface_complete_sync()
1923 hapd = iface->bss[0]; in hostapd_setup_interface_complete_sync()
1929 hostapd_set_acl(hapd); in hostapd_setup_interface_complete_sync()
1931 if (hostapd_driver_commit(hapd) < 0) { in hostapd_setup_interface_complete_sync()
1963 if (hapd->iconf->fst_cfg.group_id[0]) { in hostapd_setup_interface_complete_sync()
1966 fst_hostapd_fill_iface_obj(hapd, &iface_obj); in hostapd_setup_interface_complete_sync()
1967 iface->fst = fst_attach(hapd->conf->iface, hapd->own_addr, in hostapd_setup_interface_complete_sync()
1968 &iface_obj, &hapd->iconf->fst_cfg); in hostapd_setup_interface_complete_sync()
1971 hapd->iconf->fst_cfg.group_id); in hostapd_setup_interface_complete_sync()
1980 if (hapd->setup_complete_cb) in hostapd_setup_interface_complete_sync()
1981 hapd->setup_complete_cb(hapd->setup_complete_cb_ctx); in hostapd_setup_interface_complete_sync()
1996 wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED); in hostapd_setup_interface_complete_sync()
2006 } else if (hapd->setup_complete_cb) { in hostapd_setup_interface_complete_sync()
2031 struct hostapd_data *hapd = iface->bss[0]; in hostapd_setup_interface_complete() local
2042 wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED); in hostapd_setup_interface_complete()
2150 struct hostapd_data *hapd; in hostapd_alloc_bss_data() local
2152 hapd = os_zalloc(sizeof(*hapd)); in hostapd_alloc_bss_data()
2153 if (hapd == NULL) in hostapd_alloc_bss_data()
2156 hapd->new_assoc_sta_cb = hostapd_new_assoc_sta; in hostapd_alloc_bss_data()
2157 hapd->iconf = conf; in hostapd_alloc_bss_data()
2158 hapd->conf = bss; in hostapd_alloc_bss_data()
2159 hapd->iface = hapd_iface; in hostapd_alloc_bss_data()
2161 hapd->driver = conf->driver; in hostapd_alloc_bss_data()
2162 hapd->ctrl_sock = -1; in hostapd_alloc_bss_data()
2163 dl_list_init(&hapd->ctrl_dst); in hostapd_alloc_bss_data()
2164 dl_list_init(&hapd->nr_db); in hostapd_alloc_bss_data()
2165 hapd->dhcp_sock = -1; in hostapd_alloc_bss_data()
2167 dl_list_init(&hapd->l2_queue); in hostapd_alloc_bss_data()
2168 dl_list_init(&hapd->l2_oui_queue); in hostapd_alloc_bss_data()
2171 dl_list_init(&hapd->sae_commit_queue); in hostapd_alloc_bss_data()
2174 return hapd; in hostapd_alloc_bss_data()
2178 static void hostapd_bss_deinit(struct hostapd_data *hapd) in hostapd_bss_deinit() argument
2180 if (!hapd) in hostapd_bss_deinit()
2183 hapd->conf ? hapd->conf->iface : "N/A"); in hostapd_bss_deinit()
2184 hostapd_bss_deinit_no_free(hapd); in hostapd_bss_deinit()
2185 wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED); in hostapd_bss_deinit()
2186 hostapd_cleanup(hapd); in hostapd_bss_deinit()
2268 struct hostapd_data *hapd; in hostapd_init() local
2291 hapd = hapd_iface->bss[i] = in hostapd_init()
2294 if (hapd == NULL) in hostapd_init()
2296 hapd->msg_ctx = hapd; in hostapd_init()
2324 struct hostapd_data *hapd = iface->bss[j]; in ifname_in_use() local
2325 if (os_strcmp(ifname, hapd->conf->iface) == 0) in ifname_in_use()
2350 struct hostapd_data *hapd; in hostapd_interface_init_bss() local
2409 hapd = hostapd_alloc_bss_data(iface, iface->conf, bss); in hostapd_interface_init_bss()
2410 if (hapd == NULL) { in hostapd_interface_init_bss()
2416 iface->bss[iface->num_bss] = hapd; in hostapd_interface_init_bss()
2417 hapd->msg_ctx = hapd; in hostapd_interface_init_bss()
2586 struct hostapd_data *hapd = hapd_iface->bss[j]; in hostapd_disable_iface() local
2587 hostapd_bss_deinit_no_free(hapd); in hostapd_disable_iface()
2588 hostapd_free_hapd_data(hapd); in hostapd_disable_iface()
2688 struct hostapd_data *hapd; in hostapd_data_alloc() local
2696 hapd = hapd_iface->bss[i] = in hostapd_data_alloc()
2698 if (hapd == NULL) { in hostapd_data_alloc()
2708 hapd->msg_ctx = hapd; in hostapd_data_alloc()
2722 struct hostapd_data *hapd; in hostapd_add_iface() local
2773 hapd = hapd_iface->bss[hapd_iface->num_bss - 1]; in hostapd_add_iface()
2774 hapd->driver = hapd_iface->bss[0]->driver; in hostapd_add_iface()
2775 hapd->drv_priv = hapd_iface->bss[0]->drv_priv; in hostapd_add_iface()
2776 os_memcpy(hapd->own_addr, hapd_iface->bss[0]->own_addr, in hostapd_add_iface()
2779 if (start_ctrl_iface_bss(hapd) < 0 || in hostapd_add_iface()
2781 hostapd_setup_bss(hapd, -1))) { in hostapd_add_iface()
2782 hostapd_cleanup(hapd); in hostapd_add_iface()
2787 __func__, hapd, hapd->conf->iface); in hostapd_add_iface()
2788 hostapd_config_free_bss(hapd->conf); in hostapd_add_iface()
2789 hapd->conf = NULL; in hostapd_add_iface()
2790 os_free(hapd); in hostapd_add_iface()
2863 hapd = hapd_iface->bss[i]; in hostapd_add_iface()
2864 if (!hapd) in hostapd_add_iface()
2869 ctrl_iface_deinit(hapd); in hostapd_add_iface()
2872 hapd->conf->iface); in hostapd_add_iface()
2873 hostapd_cleanup(hapd); in hostapd_add_iface()
2874 os_free(hapd); in hostapd_add_iface()
2898 struct hostapd_data *hapd = iface->bss[idx]; in hostapd_remove_bss() local
2900 hostapd_bss_deinit(hapd); in hostapd_remove_bss()
2902 __func__, hapd, hapd->conf->iface); in hostapd_remove_bss()
2903 hostapd_config_free_bss(hapd->conf); in hostapd_remove_bss()
2904 hapd->conf = NULL; in hostapd_remove_bss()
2905 os_free(hapd); in hostapd_remove_bss()
2974 void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, in hostapd_new_assoc_sta() argument
2977 if (hapd->tkip_countermeasures) { in hostapd_new_assoc_sta()
2978 hostapd_drv_sta_deauth(hapd, sta->addr, in hostapd_new_assoc_sta()
2983 hostapd_prune_associations(hapd, sta->addr); in hostapd_new_assoc_sta()
2984 ap_sta_clear_disconnect_timeouts(hapd, sta); in hostapd_new_assoc_sta()
2987 if (hapd->conf->ieee802_11f) in hostapd_new_assoc_sta()
2988 iapp_new_station(hapd->iapp, sta); in hostapd_new_assoc_sta()
2993 hapd->num_sta_no_p2p++; in hostapd_new_assoc_sta()
2994 if (hapd->num_sta_no_p2p == 1) in hostapd_new_assoc_sta()
2995 hostapd_p2p_non_p2p_sta_connected(hapd); in hostapd_new_assoc_sta()
3002 if (!hapd->conf->ieee802_1x && !hapd->conf->wpa && !hapd->conf->osen) { in hostapd_new_assoc_sta()
3003 ap_sta_set_authorized(hapd, sta, 1); in hostapd_new_assoc_sta()
3005 accounting_sta_start(hapd, sta); in hostapd_new_assoc_sta()
3009 ieee802_1x_new_station(hapd, sta); in hostapd_new_assoc_sta()
3018 wpa_auth_sta_associated(hapd->wpa_auth, sta->wpa_sm); in hostapd_new_assoc_sta()
3020 if (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_WIRED) { in hostapd_new_assoc_sta()
3021 if (eloop_cancel_timeout(ap_handle_timer, hapd, sta) > 0) { in hostapd_new_assoc_sta()
3025 hapd->conf->iface, __func__, in hostapd_new_assoc_sta()
3028 } else if (!(hapd->iface->drv_flags & in hostapd_new_assoc_sta()
3033 hapd->conf->iface, __func__, MAC2STR(sta->addr), in hostapd_new_assoc_sta()
3034 hapd->conf->ap_max_inactivity); in hostapd_new_assoc_sta()
3035 eloop_cancel_timeout(ap_handle_timer, hapd, sta); in hostapd_new_assoc_sta()
3036 eloop_register_timeout(hapd->conf->ap_max_inactivity, 0, in hostapd_new_assoc_sta()
3037 ap_handle_timer, hapd, sta); in hostapd_new_assoc_sta()
3104 static int hostapd_build_beacon_data(struct hostapd_data *hapd, in hostapd_build_beacon_data() argument
3112 ret = ieee802_11_build_ap_params(hapd, &params); in hostapd_build_beacon_data()
3116 ret = hostapd_build_ap_extra_ies(hapd, &beacon_extra, in hostapd_build_beacon_data()
3179 hostapd_free_ap_extra_ies(hapd, beacon_extra, proberesp_extra, in hostapd_build_beacon_data()
3192 static int hostapd_change_config_freq(struct hostapd_data *hapd, in hostapd_change_config_freq() argument
3201 params->channel = hostapd_hw_get_channel(hapd, params->freq); in hostapd_change_config_freq()
3211 hostapd_hw_get_freq(hapd, conf->channel), in hostapd_change_config_freq()
3254 static int hostapd_fill_csa_settings(struct hostapd_data *hapd, in hostapd_fill_csa_settings() argument
3257 struct hostapd_iface *iface = hapd->iface; in hostapd_fill_csa_settings()
3263 if (!iface || !iface->freq || hapd->csa_in_progress) in hostapd_fill_csa_settings()
3285 &hapd->iface->cs_oper_class, in hostapd_fill_csa_settings()
3303 ret = hostapd_build_beacon_data(hapd, &settings->beacon_after); in hostapd_fill_csa_settings()
3313 hapd->cs_freq_params = settings->freq_params; in hostapd_fill_csa_settings()
3314 hapd->cs_count = settings->cs_count; in hostapd_fill_csa_settings()
3315 hapd->cs_block_tx = settings->block_tx; in hostapd_fill_csa_settings()
3317 ret = hostapd_build_beacon_data(hapd, &settings->beacon_csa); in hostapd_fill_csa_settings()
3323 settings->counter_offset_beacon[0] = hapd->cs_c_off_beacon; in hostapd_fill_csa_settings()
3324 settings->counter_offset_presp[0] = hapd->cs_c_off_proberesp; in hostapd_fill_csa_settings()
3325 settings->counter_offset_beacon[1] = hapd->cs_c_off_ecsa_beacon; in hostapd_fill_csa_settings()
3326 settings->counter_offset_presp[1] = hapd->cs_c_off_ecsa_proberesp; in hostapd_fill_csa_settings()
3332 void hostapd_cleanup_cs_params(struct hostapd_data *hapd) in hostapd_cleanup_cs_params() argument
3334 os_memset(&hapd->cs_freq_params, 0, sizeof(hapd->cs_freq_params)); in hostapd_cleanup_cs_params()
3335 hapd->cs_count = 0; in hostapd_cleanup_cs_params()
3336 hapd->cs_block_tx = 0; in hostapd_cleanup_cs_params()
3337 hapd->cs_c_off_beacon = 0; in hostapd_cleanup_cs_params()
3338 hapd->cs_c_off_proberesp = 0; in hostapd_cleanup_cs_params()
3339 hapd->csa_in_progress = 0; in hostapd_cleanup_cs_params()
3340 hapd->cs_c_off_ecsa_beacon = 0; in hostapd_cleanup_cs_params()
3341 hapd->cs_c_off_ecsa_proberesp = 0; in hostapd_cleanup_cs_params()
3345 void hostapd_chan_switch_vht_config(struct hostapd_data *hapd, int vht_enabled) in hostapd_chan_switch_vht_config() argument
3348 hapd->iconf->ch_switch_vht_config |= CH_SWITCH_VHT_ENABLED; in hostapd_chan_switch_vht_config()
3350 hapd->iconf->ch_switch_vht_config |= CH_SWITCH_VHT_DISABLED; in hostapd_chan_switch_vht_config()
3352 hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, in hostapd_chan_switch_vht_config()
3354 hapd->iconf->ch_switch_vht_config); in hostapd_chan_switch_vht_config()
3358 int hostapd_switch_channel(struct hostapd_data *hapd, in hostapd_switch_channel() argument
3363 if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA)) { in hostapd_switch_channel()
3368 ret = hostapd_fill_csa_settings(hapd, settings); in hostapd_switch_channel()
3372 ret = hostapd_drv_switch_channel(hapd, settings); in hostapd_switch_channel()
3378 hostapd_cleanup_cs_params(hapd); in hostapd_switch_channel()
3382 hapd->csa_in_progress = 1; in hostapd_switch_channel()
3451 struct hostapd_data *hapd = iface->bss[j]; in hostapd_get_iface() local
3453 if (os_strcmp(ifname, hapd->conf->iface) == 0) in hostapd_get_iface()
3454 return hapd; in hostapd_get_iface()
3469 struct hostapd_data *hapd = iface->bss[i]; in hostapd_periodic_iface() local
3471 if (!hapd->started) in hostapd_periodic_iface()
3475 hostapd_acl_expire(hapd); in hostapd_periodic_iface()