• Home
  • Raw
  • Download

Lines Matching refs:hapd

46 static int hostapd_flush_old_stations(struct hostapd_data *hapd, u16 reason);
47 static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd);
48 static int hostapd_broadcast_wep_clear(struct hostapd_data *hapd);
70 static void hostapd_reload_bss(struct hostapd_data *hapd) in hostapd_reload_bss() argument
75 radius_client_reconfig(hapd->radius, hapd->conf->radius); in hostapd_reload_bss()
78 ssid = &hapd->conf->ssid; in hostapd_reload_bss()
85 hostapd_config_clear_wpa_psk(&hapd->conf->ssid.wpa_psk); in hostapd_reload_bss()
87 if (hostapd_setup_wpa_psk(hapd->conf)) { in hostapd_reload_bss()
92 if (hapd->conf->ieee802_1x || hapd->conf->wpa) in hostapd_reload_bss()
93 hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 1); in hostapd_reload_bss()
95 hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 0); in hostapd_reload_bss()
97 if ((hapd->conf->wpa || hapd->conf->osen) && hapd->wpa_auth == NULL) { in hostapd_reload_bss()
98 hostapd_setup_wpa(hapd); in hostapd_reload_bss()
99 if (hapd->wpa_auth) in hostapd_reload_bss()
100 wpa_init_keys(hapd->wpa_auth); in hostapd_reload_bss()
101 } else if (hapd->conf->wpa) { in hostapd_reload_bss()
104 hostapd_reconfig_wpa(hapd); in hostapd_reload_bss()
105 wpa_ie = wpa_auth_get_wpa_ie(hapd->wpa_auth, &wpa_ie_len); in hostapd_reload_bss()
106 if (hostapd_set_generic_elem(hapd, wpa_ie, wpa_ie_len)) in hostapd_reload_bss()
109 } else if (hapd->wpa_auth) { in hostapd_reload_bss()
110 wpa_deinit(hapd->wpa_auth); in hostapd_reload_bss()
111 hapd->wpa_auth = NULL; in hostapd_reload_bss()
112 hostapd_set_privacy(hapd, 0); in hostapd_reload_bss()
113 hostapd_setup_encryption(hapd->conf->iface, hapd); in hostapd_reload_bss()
114 hostapd_set_generic_elem(hapd, (u8 *) "", 0); in hostapd_reload_bss()
117 ieee802_11_set_beacon(hapd); in hostapd_reload_bss()
118 hostapd_update_wps(hapd); in hostapd_reload_bss()
120 if (hapd->conf->ssid.ssid_set && in hostapd_reload_bss()
121 hostapd_set_ssid(hapd, hapd->conf->ssid.ssid, in hostapd_reload_bss()
122 hapd->conf->ssid.ssid_len)) { in hostapd_reload_bss()
126 wpa_printf(MSG_DEBUG, "Reconfigured interface %s", hapd->conf->iface); in hostapd_reload_bss()
154 struct hostapd_data *hapd = iface->bss[0]; in hostapd_reload_config() local
175 oldconf = hapd->iconf; in hostapd_reload_config()
179 hapd = iface->bss[j]; in hostapd_reload_config()
180 hapd->iconf = newconf; in hostapd_reload_config()
181 hapd->iconf->channel = oldconf->channel; in hostapd_reload_config()
182 hapd->iconf->acs = oldconf->acs; in hostapd_reload_config()
183 hapd->iconf->secondary_channel = oldconf->secondary_channel; in hostapd_reload_config()
184 hapd->iconf->ieee80211n = oldconf->ieee80211n; in hostapd_reload_config()
185 hapd->iconf->ieee80211ac = oldconf->ieee80211ac; in hostapd_reload_config()
186 hapd->iconf->ht_capab = oldconf->ht_capab; in hostapd_reload_config()
187 hapd->iconf->vht_capab = oldconf->vht_capab; in hostapd_reload_config()
188 hapd->iconf->vht_oper_chwidth = oldconf->vht_oper_chwidth; in hostapd_reload_config()
189 hapd->iconf->vht_oper_centr_freq_seg0_idx = in hostapd_reload_config()
191 hapd->iconf->vht_oper_centr_freq_seg1_idx = in hostapd_reload_config()
193 hapd->conf = newconf->bss[j]; in hostapd_reload_config()
194 hostapd_reload_bss(hapd); in hostapd_reload_config()
204 static void hostapd_broadcast_key_clear_iface(struct hostapd_data *hapd, in hostapd_broadcast_key_clear_iface() argument
210 if (hostapd_drv_set_key(ifname, hapd, WPA_ALG_NONE, NULL, i, in hostapd_broadcast_key_clear_iface()
218 if (hapd->conf->ieee80211w) { in hostapd_broadcast_key_clear_iface()
220 if (hostapd_drv_set_key(ifname, hapd, WPA_ALG_NONE, in hostapd_broadcast_key_clear_iface()
233 static int hostapd_broadcast_wep_clear(struct hostapd_data *hapd) in hostapd_broadcast_wep_clear() argument
235 hostapd_broadcast_key_clear_iface(hapd, hapd->conf->iface); in hostapd_broadcast_wep_clear()
240 static int hostapd_broadcast_wep_set(struct hostapd_data *hapd) in hostapd_broadcast_wep_set() argument
243 struct hostapd_ssid *ssid = &hapd->conf->ssid; in hostapd_broadcast_wep_set()
247 hostapd_drv_set_key(hapd->conf->iface, in hostapd_broadcast_wep_set()
248 hapd, WPA_ALG_WEP, broadcast_ether_addr, idx, in hostapd_broadcast_wep_set()
259 static void hostapd_free_hapd_data(struct hostapd_data *hapd) in hostapd_free_hapd_data() argument
261 os_free(hapd->probereq_cb); in hostapd_free_hapd_data()
262 hapd->probereq_cb = NULL; in hostapd_free_hapd_data()
265 wpabuf_free(hapd->p2p_beacon_ie); in hostapd_free_hapd_data()
266 hapd->p2p_beacon_ie = NULL; in hostapd_free_hapd_data()
267 wpabuf_free(hapd->p2p_probe_resp_ie); in hostapd_free_hapd_data()
268 hapd->p2p_probe_resp_ie = NULL; in hostapd_free_hapd_data()
271 if (!hapd->started) { in hostapd_free_hapd_data()
273 __func__, hapd->conf->iface); in hostapd_free_hapd_data()
276 hapd->started = 0; in hostapd_free_hapd_data()
278 wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface); in hostapd_free_hapd_data()
279 iapp_deinit(hapd->iapp); in hostapd_free_hapd_data()
280 hapd->iapp = NULL; in hostapd_free_hapd_data()
281 accounting_deinit(hapd); in hostapd_free_hapd_data()
282 hostapd_deinit_wpa(hapd); in hostapd_free_hapd_data()
283 vlan_deinit(hapd); in hostapd_free_hapd_data()
284 hostapd_acl_deinit(hapd); in hostapd_free_hapd_data()
286 radius_client_deinit(hapd->radius); in hostapd_free_hapd_data()
287 hapd->radius = NULL; in hostapd_free_hapd_data()
288 radius_das_deinit(hapd->radius_das); in hostapd_free_hapd_data()
289 hapd->radius_das = NULL; in hostapd_free_hapd_data()
292 hostapd_deinit_wps(hapd); in hostapd_free_hapd_data()
294 authsrv_deinit(hapd); in hostapd_free_hapd_data()
296 if (hapd->interface_added) { in hostapd_free_hapd_data()
297 hapd->interface_added = 0; in hostapd_free_hapd_data()
298 if (hostapd_if_remove(hapd, WPA_IF_AP_BSS, hapd->conf->iface)) { in hostapd_free_hapd_data()
301 hapd->conf->iface); in hostapd_free_hapd_data()
302 hapd->interface_added = 1; in hostapd_free_hapd_data()
309 hapd->drv_priv = NULL; in hostapd_free_hapd_data()
313 wpabuf_free(hapd->time_adv); in hostapd_free_hapd_data()
316 gas_serv_deinit(hapd); in hostapd_free_hapd_data()
319 bss_load_update_deinit(hapd); in hostapd_free_hapd_data()
320 ndisc_snoop_deinit(hapd); in hostapd_free_hapd_data()
321 dhcp_snoop_deinit(hapd); in hostapd_free_hapd_data()
322 x_snoop_deinit(hapd); in hostapd_free_hapd_data()
325 bin_clear_free(hapd->tmp_eap_user.identity, in hostapd_free_hapd_data()
326 hapd->tmp_eap_user.identity_len); in hostapd_free_hapd_data()
327 bin_clear_free(hapd->tmp_eap_user.password, in hostapd_free_hapd_data()
328 hapd->tmp_eap_user.password_len); in hostapd_free_hapd_data()
332 wpabuf_free(hapd->mesh_pending_auth); in hostapd_free_hapd_data()
333 hapd->mesh_pending_auth = NULL; in hostapd_free_hapd_data()
346 static void hostapd_cleanup(struct hostapd_data *hapd) in hostapd_cleanup() argument
348 wpa_printf(MSG_DEBUG, "%s(hapd=%p (%s))", __func__, hapd, in hostapd_cleanup()
349 hapd->conf->iface); in hostapd_cleanup()
350 if (hapd->iface->interfaces && in hostapd_cleanup()
351 hapd->iface->interfaces->ctrl_iface_deinit) in hostapd_cleanup()
352 hapd->iface->interfaces->ctrl_iface_deinit(hapd); in hostapd_cleanup()
353 hostapd_free_hapd_data(hapd); in hostapd_cleanup()
398 static void hostapd_clear_wep(struct hostapd_data *hapd) in hostapd_clear_wep() argument
400 if (hapd->drv_priv && !hapd->iface->driver_ap_teardown) { in hostapd_clear_wep()
401 hostapd_set_privacy(hapd, 0); in hostapd_clear_wep()
402 hostapd_broadcast_wep_clear(hapd); in hostapd_clear_wep()
407 static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd) in hostapd_setup_encryption() argument
411 hostapd_broadcast_wep_set(hapd); in hostapd_setup_encryption()
413 if (hapd->conf->ssid.wep.default_len) { in hostapd_setup_encryption()
414 hostapd_set_privacy(hapd, 1); in hostapd_setup_encryption()
422 hostapd_drv_set_authmode(hapd, hapd->conf->auth_algs); in hostapd_setup_encryption()
425 if (hapd->conf->ssid.wep.key[i] && in hostapd_setup_encryption()
426 hostapd_drv_set_key(iface, hapd, WPA_ALG_WEP, NULL, i, in hostapd_setup_encryption()
427 i == hapd->conf->ssid.wep.idx, NULL, 0, in hostapd_setup_encryption()
428 hapd->conf->ssid.wep.key[i], in hostapd_setup_encryption()
429 hapd->conf->ssid.wep.len[i])) { in hostapd_setup_encryption()
434 if (hapd->conf->ssid.wep.key[i] && in hostapd_setup_encryption()
435 i == hapd->conf->ssid.wep.idx) in hostapd_setup_encryption()
436 hostapd_set_privacy(hapd, 1); in hostapd_setup_encryption()
443 static int hostapd_flush_old_stations(struct hostapd_data *hapd, u16 reason) in hostapd_flush_old_stations() argument
448 if (hostapd_drv_none(hapd) || hapd->drv_priv == NULL) in hostapd_flush_old_stations()
451 if (!hapd->iface->driver_ap_teardown) { in hostapd_flush_old_stations()
452 wpa_dbg(hapd->msg_ctx, MSG_DEBUG, in hostapd_flush_old_stations()
455 if (hostapd_flush(hapd)) { in hostapd_flush_old_stations()
456 wpa_msg(hapd->msg_ctx, MSG_WARNING, in hostapd_flush_old_stations()
461 wpa_dbg(hapd->msg_ctx, MSG_DEBUG, "Deauthenticate all stations"); in hostapd_flush_old_stations()
463 hostapd_drv_sta_deauth(hapd, addr, reason); in hostapd_flush_old_stations()
464 hostapd_free_stas(hapd); in hostapd_flush_old_stations()
470 static void hostapd_bss_deinit_no_free(struct hostapd_data *hapd) in hostapd_bss_deinit_no_free() argument
472 hostapd_free_stas(hapd); in hostapd_bss_deinit_no_free()
473 hostapd_flush_old_stations(hapd, WLAN_REASON_DEAUTH_LEAVING); in hostapd_bss_deinit_no_free()
474 hostapd_clear_wep(hapd); in hostapd_bss_deinit_no_free()
488 struct hostapd_data *hapd = iface->bss[0]; in hostapd_validate_bssid_configuration() local
492 if (hostapd_drv_none(hapd)) in hostapd_validate_bssid_configuration()
513 hapd->own_addr[i]; in hostapd_validate_bssid_configuration()
557 if ((hapd->own_addr[i] & mask[i]) != hapd->own_addr[i]) { in hostapd_validate_bssid_configuration()
560 MAC2STR(mask), MAC2STR(hapd->own_addr)); in hostapd_validate_bssid_configuration()
588 static int hostapd_das_nas_mismatch(struct hostapd_data *hapd, in hostapd_das_nas_mismatch() argument
592 (!hapd->conf->nas_identifier || in hostapd_das_nas_mismatch()
593 os_strlen(hapd->conf->nas_identifier) != in hostapd_das_nas_mismatch()
595 os_memcmp(hapd->conf->nas_identifier, attr->nas_identifier, in hostapd_das_nas_mismatch()
602 (hapd->conf->own_ip_addr.af != AF_INET || in hostapd_das_nas_mismatch()
603 os_memcmp(&hapd->conf->own_ip_addr.u.v4, attr->nas_ip_addr, 4) != in hostapd_das_nas_mismatch()
611 (hapd->conf->own_ip_addr.af != AF_INET6 || in hostapd_das_nas_mismatch()
612 os_memcmp(&hapd->conf->own_ip_addr.u.v6, attr->nas_ipv6_addr, 16) in hostapd_das_nas_mismatch()
623 static struct sta_info * hostapd_das_find_sta(struct hostapd_data *hapd, in hostapd_das_find_sta() argument
634 for (sta = hapd->sta_list; sta; sta = sta->next) in hostapd_das_find_sta()
639 sta = ap_get_sta(hapd, attr->sta_addr); in hostapd_das_find_sta()
647 for (sta = hapd->sta_list; sta; sta = sta->next) { in hostapd_das_find_sta()
663 for (sta = hapd->sta_list; sta; sta = sta->next) { in hostapd_das_find_sta()
692 for (sta = hapd->sta_list; sta; sta = sta->next) { in hostapd_das_find_sta()
723 for (sta = hapd->sta_list; sta; sta = sta->next) { in hostapd_das_find_sta()
750 for (sta = hapd->sta_list; sta; sta = sta->next) { in hostapd_das_find_sta()
788 for (sta = hapd->sta_list; sta; sta = sta->next) { in hostapd_das_find_sta()
802 static int hostapd_das_disconnect_pmksa(struct hostapd_data *hapd, in hostapd_das_disconnect_pmksa() argument
805 if (!hapd->wpa_auth) in hostapd_das_disconnect_pmksa()
807 return wpa_auth_radius_das_disconnect_pmksa(hapd->wpa_auth, attr); in hostapd_das_disconnect_pmksa()
814 struct hostapd_data *hapd = ctx; in hostapd_das_disconnect() local
818 if (hostapd_das_nas_mismatch(hapd, attr)) in hostapd_das_disconnect()
821 sta = hostapd_das_find_sta(hapd, attr, &multi); in hostapd_das_disconnect()
828 if (hostapd_das_disconnect_pmksa(hapd, attr) == 0) { in hostapd_das_disconnect()
839 wpa_auth_pmksa_remove(hapd->wpa_auth, sta->addr); in hostapd_das_disconnect()
841 hostapd_drv_sta_deauth(hapd, sta->addr, in hostapd_das_disconnect()
843 ap_sta_deauthenticate(hapd, sta, WLAN_REASON_PREV_AUTH_NOT_VALID); in hostapd_das_disconnect()
862 static int hostapd_setup_bss(struct hostapd_data *hapd, int first) in hostapd_setup_bss() argument
864 struct hostapd_bss_config *conf = hapd->conf; in hostapd_setup_bss()
872 __func__, hapd, conf->iface, first); in hostapd_setup_bss()
881 if (hapd->started) { in hostapd_setup_bss()
886 hapd->started = 1; in hostapd_setup_bss()
892 inc_byte_array(hapd->own_addr, ETH_ALEN); in hostapd_setup_bss()
893 } while (mac_in_conf(hapd->iconf, hapd->own_addr)); in hostapd_setup_bss()
896 os_memcpy(hapd->own_addr, conf->bssid, ETH_ALEN); in hostapd_setup_bss()
898 if (hostapd_mac_comp(hapd->own_addr, in hostapd_setup_bss()
899 hapd->iface->bss[0]->own_addr) == in hostapd_setup_bss()
908 hapd->interface_added = 1; in hostapd_setup_bss()
909 if (hostapd_if_add(hapd->iface->bss[0], WPA_IF_AP_BSS, in hostapd_setup_bss()
910 conf->iface, hapd->own_addr, hapd, in hostapd_setup_bss()
911 &hapd->drv_priv, force_ifname, if_addr, in hostapd_setup_bss()
915 MACSTR ")", MAC2STR(hapd->own_addr)); in hostapd_setup_bss()
916 hapd->interface_added = 0; in hostapd_setup_bss()
922 conf->wmm_enabled = hapd->iconf->ieee80211n; in hostapd_setup_bss()
925 if (hapd->iface->mconf == NULL) in hostapd_setup_bss()
930 hostapd_flush_old_stations(hapd, in hostapd_setup_bss()
932 hostapd_set_privacy(hapd, 0); in hostapd_setup_bss()
934 hostapd_broadcast_wep_clear(hapd); in hostapd_setup_bss()
935 if (hostapd_setup_encryption(conf->iface, hapd)) in hostapd_setup_bss()
943 ssid_len = hostapd_get_ssid(hapd, ssid, sizeof(ssid)); in hostapd_setup_bss()
966 if (!hostapd_drv_none(hapd)) { in hostapd_setup_bss()
969 conf->iface, MAC2STR(hapd->own_addr), in hostapd_setup_bss()
980 if (set_ssid && hostapd_set_ssid(hapd, conf->ssid.ssid, in hostapd_setup_bss()
989 hapd->radius = radius_client_init(hapd, conf->radius); in hostapd_setup_bss()
990 if (hapd->radius == NULL) { in hostapd_setup_bss()
1006 das_conf.ctx = hapd; in hostapd_setup_bss()
1008 hapd->radius_das = radius_das_init(&das_conf); in hostapd_setup_bss()
1009 if (hapd->radius_das == NULL) { in hostapd_setup_bss()
1017 if (hostapd_acl_init(hapd)) { in hostapd_setup_bss()
1021 if (hostapd_init_wps(hapd, conf)) in hostapd_setup_bss()
1024 if (authsrv_init(hapd) < 0) in hostapd_setup_bss()
1027 if (ieee802_1x_init(hapd)) { in hostapd_setup_bss()
1032 if ((conf->wpa || conf->osen) && hostapd_setup_wpa(hapd)) in hostapd_setup_bss()
1035 if (accounting_init(hapd)) { in hostapd_setup_bss()
1041 (hapd->iapp = iapp_init(hapd, conf->iapp_iface)) == NULL) { in hostapd_setup_bss()
1048 if (gas_serv_init(hapd)) { in hostapd_setup_bss()
1054 hostapd_drv_set_qos_map(hapd, conf->qos_map_set, in hostapd_setup_bss()
1061 if (conf->bss_load_update_period && bss_load_update_init(hapd)) { in hostapd_setup_bss()
1067 if (x_snoop_init(hapd)) { in hostapd_setup_bss()
1073 if (dhcp_snoop_init(hapd)) { in hostapd_setup_bss()
1079 if (ndisc_snoop_init(hapd)) { in hostapd_setup_bss()
1086 if (!hostapd_drv_none(hapd) && vlan_init(hapd)) { in hostapd_setup_bss()
1091 if (!conf->start_disabled && ieee802_11_set_beacon(hapd) < 0) in hostapd_setup_bss()
1094 if (hapd->wpa_auth && wpa_init_keys(hapd->wpa_auth) < 0) in hostapd_setup_bss()
1097 if (hapd->driver && hapd->driver->set_operstate) in hostapd_setup_bss()
1098 hapd->driver->set_operstate(hapd->drv_priv, 1); in hostapd_setup_bss()
1106 struct hostapd_data *hapd = iface->bss[0]; in hostapd_tx_queue_params() local
1118 if (hostapd_set_tx_queue_params(hapd, i, p->aifs, p->cwmin, in hostapd_tx_queue_params()
1128 static int hostapd_set_acl_list(struct hostapd_data *hapd, in hostapd_set_acl_list() argument
1147 err = hostapd_drv_set_acl(hapd, acl_params); in hostapd_set_acl_list()
1155 static void hostapd_set_acl(struct hostapd_data *hapd) in hostapd_set_acl() argument
1157 struct hostapd_config *conf = hapd->iconf; in hostapd_set_acl()
1161 if (hapd->iface->drv_max_acl_mac_addrs == 0) in hostapd_set_acl()
1166 err = hostapd_set_acl_list(hapd, conf->bss[0]->accept_mac, in hostapd_set_acl()
1175 err = hostapd_set_acl_list(hapd, conf->bss[0]->deny_mac, in hostapd_set_acl()
1186 static int start_ctrl_iface_bss(struct hostapd_data *hapd) in start_ctrl_iface_bss() argument
1188 if (!hapd->iface->interfaces || in start_ctrl_iface_bss()
1189 !hapd->iface->interfaces->ctrl_iface_init) in start_ctrl_iface_bss()
1192 if (hapd->iface->interfaces->ctrl_iface_init(hapd)) { in start_ctrl_iface_bss()
1195 hapd->conf->iface); in start_ctrl_iface_bss()
1211 struct hostapd_data *hapd = iface->bss[i]; in start_ctrl_iface() local
1212 if (iface->interfaces->ctrl_iface_init(hapd)) { in start_ctrl_iface()
1215 hapd->conf->iface); in start_ctrl_iface()
1255 struct hostapd_data *hapd = iface->bss[0]; in setup_interface() local
1268 const char *phy = hostapd_drv_get_radio_name(hapd); in setup_interface()
1280 iface->bss[i]->driver = hapd->driver; in setup_interface()
1281 iface->bss[i]->drv_priv = hapd->drv_priv; in setup_interface()
1295 if (hapd->iconf->country[0] && hapd->iconf->country[1]) { in setup_interface()
1299 if (hostapd_get_country(hapd, previous_country) < 0) in setup_interface()
1302 os_memcpy(country, hapd->iconf->country, 3); in setup_interface()
1304 if (hostapd_set_country(hapd, country) < 0) { in setup_interface()
1377 struct hostapd_data *hapd = iface->bss[0]; in hostapd_setup_interface_complete() local
1392 iface->freq = hostapd_hw_get_freq(hapd, iface->conf->channel); in hostapd_setup_interface_complete()
1438 hostapd_set_freq(hapd, hapd->iconf->hw_mode, iface->freq, in hostapd_setup_interface_complete()
1439 hapd->iconf->channel, in hostapd_setup_interface_complete()
1440 hapd->iconf->ieee80211n, in hostapd_setup_interface_complete()
1441 hapd->iconf->ieee80211ac, in hostapd_setup_interface_complete()
1442 hapd->iconf->secondary_channel, in hostapd_setup_interface_complete()
1443 hapd->iconf->vht_oper_chwidth, in hostapd_setup_interface_complete()
1444 hapd->iconf->vht_oper_centr_freq_seg0_idx, in hostapd_setup_interface_complete()
1445 hapd->iconf->vht_oper_centr_freq_seg1_idx)) { in hostapd_setup_interface_complete()
1456 hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, in hostapd_setup_interface_complete()
1463 if (hapd->iconf->rts_threshold > -1 && in hostapd_setup_interface_complete()
1464 hostapd_set_rts(hapd, hapd->iconf->rts_threshold)) { in hostapd_setup_interface_complete()
1470 if (hapd->iconf->fragm_threshold > -1 && in hostapd_setup_interface_complete()
1471 hostapd_set_frag(hapd, hapd->iconf->fragm_threshold)) { in hostapd_setup_interface_complete()
1477 prev_addr = hapd->own_addr; in hostapd_setup_interface_complete()
1480 hapd = iface->bss[j]; in hostapd_setup_interface_complete()
1482 os_memcpy(hapd->own_addr, prev_addr, ETH_ALEN); in hostapd_setup_interface_complete()
1483 if (hostapd_setup_bss(hapd, j == 0)) { in hostapd_setup_interface_complete()
1485 hapd = iface->bss[j]; in hostapd_setup_interface_complete()
1486 hostapd_bss_deinit_no_free(hapd); in hostapd_setup_interface_complete()
1487 hostapd_free_hapd_data(hapd); in hostapd_setup_interface_complete()
1491 if (hostapd_mac_comp_empty(hapd->conf->bssid) == 0) in hostapd_setup_interface_complete()
1492 prev_addr = hapd->own_addr; in hostapd_setup_interface_complete()
1494 hapd = iface->bss[0]; in hostapd_setup_interface_complete()
1500 hostapd_set_acl(hapd); in hostapd_setup_interface_complete()
1502 if (hostapd_driver_commit(hapd) < 0) { in hostapd_setup_interface_complete()
1534 if (hapd->setup_complete_cb) in hostapd_setup_interface_complete()
1535 hapd->setup_complete_cb(hapd->setup_complete_cb_ctx); in hostapd_setup_interface_complete()
1547 wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED); in hostapd_setup_interface_complete()
1601 struct hostapd_data *hapd; in hostapd_alloc_bss_data() local
1603 hapd = os_zalloc(sizeof(*hapd)); in hostapd_alloc_bss_data()
1604 if (hapd == NULL) in hostapd_alloc_bss_data()
1607 hapd->new_assoc_sta_cb = hostapd_new_assoc_sta; in hostapd_alloc_bss_data()
1608 hapd->iconf = conf; in hostapd_alloc_bss_data()
1609 hapd->conf = bss; in hostapd_alloc_bss_data()
1610 hapd->iface = hapd_iface; in hostapd_alloc_bss_data()
1611 hapd->driver = hapd->iconf->driver; in hostapd_alloc_bss_data()
1612 hapd->ctrl_sock = -1; in hostapd_alloc_bss_data()
1614 return hapd; in hostapd_alloc_bss_data()
1618 static void hostapd_bss_deinit(struct hostapd_data *hapd) in hostapd_bss_deinit() argument
1621 hapd->conf->iface); in hostapd_bss_deinit()
1622 hostapd_bss_deinit_no_free(hapd); in hostapd_bss_deinit()
1623 wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED); in hostapd_bss_deinit()
1624 hostapd_cleanup(hapd); in hostapd_bss_deinit()
1679 struct hostapd_data *hapd; in hostapd_init() local
1702 hapd = hapd_iface->bss[i] = in hostapd_init()
1705 if (hapd == NULL) in hostapd_init()
1707 hapd->msg_ctx = hapd; in hostapd_init()
1735 struct hostapd_data *hapd = iface->bss[j]; in ifname_in_use() local
1736 if (os_strcmp(ifname, hapd->conf->iface) == 0) in ifname_in_use()
1761 struct hostapd_data *hapd; in hostapd_interface_init_bss() local
1820 hapd = hostapd_alloc_bss_data(iface, iface->conf, bss); in hostapd_interface_init_bss()
1821 if (hapd == NULL) { in hostapd_interface_init_bss()
1827 iface->bss[iface->num_bss] = hapd; in hostapd_interface_init_bss()
1828 hapd->msg_ctx = hapd; in hostapd_interface_init_bss()
1988 struct hostapd_data *hapd = hapd_iface->bss[j]; in hostapd_disable_iface() local
1989 hostapd_bss_deinit_no_free(hapd); in hostapd_disable_iface()
1990 hostapd_free_hapd_data(hapd); in hostapd_disable_iface()
2074 struct hostapd_data *hapd; in hostapd_data_alloc() local
2082 hapd = hapd_iface->bss[i] = in hostapd_data_alloc()
2084 if (hapd == NULL) { in hostapd_data_alloc()
2094 hapd->msg_ctx = hapd; in hostapd_data_alloc()
2108 struct hostapd_data *hapd; in hostapd_add_iface() local
2159 hapd = hapd_iface->bss[hapd_iface->num_bss - 1]; in hostapd_add_iface()
2160 hapd->driver = hapd_iface->bss[0]->driver; in hostapd_add_iface()
2161 hapd->drv_priv = hapd_iface->bss[0]->drv_priv; in hostapd_add_iface()
2162 os_memcpy(hapd->own_addr, hapd_iface->bss[0]->own_addr, in hostapd_add_iface()
2165 if (start_ctrl_iface_bss(hapd) < 0 || in hostapd_add_iface()
2167 hostapd_setup_bss(hapd, -1))) { in hostapd_add_iface()
2168 hostapd_cleanup(hapd); in hostapd_add_iface()
2173 __func__, hapd, hapd->conf->iface); in hostapd_add_iface()
2174 hostapd_config_free_bss(hapd->conf); in hostapd_add_iface()
2175 hapd->conf = NULL; in hostapd_add_iface()
2176 os_free(hapd); in hostapd_add_iface()
2242 hapd = hapd_iface->bss[i]; in hostapd_add_iface()
2243 if (!hapd) in hostapd_add_iface()
2248 ctrl_iface_deinit(hapd); in hostapd_add_iface()
2251 hapd->conf->iface); in hostapd_add_iface()
2252 hostapd_cleanup(hapd); in hostapd_add_iface()
2253 os_free(hapd); in hostapd_add_iface()
2277 struct hostapd_data *hapd = iface->bss[idx]; in hostapd_remove_bss() local
2279 hostapd_bss_deinit(hapd); in hostapd_remove_bss()
2281 __func__, hapd, hapd->conf->iface); in hostapd_remove_bss()
2282 hostapd_config_free_bss(hapd->conf); in hostapd_remove_bss()
2283 hapd->conf = NULL; in hostapd_remove_bss()
2284 os_free(hapd); in hostapd_remove_bss()
2353 void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, in hostapd_new_assoc_sta() argument
2356 if (hapd->tkip_countermeasures) { in hostapd_new_assoc_sta()
2357 hostapd_drv_sta_deauth(hapd, sta->addr, in hostapd_new_assoc_sta()
2362 hostapd_prune_associations(hapd, sta->addr); in hostapd_new_assoc_sta()
2365 if (hapd->conf->ieee802_11f) in hostapd_new_assoc_sta()
2366 iapp_new_station(hapd->iapp, sta); in hostapd_new_assoc_sta()
2371 hapd->num_sta_no_p2p++; in hostapd_new_assoc_sta()
2372 if (hapd->num_sta_no_p2p == 1) in hostapd_new_assoc_sta()
2373 hostapd_p2p_non_p2p_sta_connected(hapd); in hostapd_new_assoc_sta()
2380 if (!hapd->conf->ieee802_1x && !hapd->conf->wpa && !hapd->conf->osen) { in hostapd_new_assoc_sta()
2381 ap_sta_set_authorized(hapd, sta, 1); in hostapd_new_assoc_sta()
2383 accounting_sta_start(hapd, sta); in hostapd_new_assoc_sta()
2387 ieee802_1x_new_station(hapd, sta); in hostapd_new_assoc_sta()
2393 wpa_auth_sta_associated(hapd->wpa_auth, sta->wpa_sm); in hostapd_new_assoc_sta()
2395 if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_INACTIVITY_TIMER)) { in hostapd_new_assoc_sta()
2399 hapd->conf->ap_max_inactivity); in hostapd_new_assoc_sta()
2400 eloop_cancel_timeout(ap_handle_timer, hapd, sta); in hostapd_new_assoc_sta()
2401 eloop_register_timeout(hapd->conf->ap_max_inactivity, 0, in hostapd_new_assoc_sta()
2402 ap_handle_timer, hapd, sta); in hostapd_new_assoc_sta()
2458 static int hostapd_build_beacon_data(struct hostapd_data *hapd, in hostapd_build_beacon_data() argument
2466 ret = ieee802_11_build_ap_params(hapd, &params); in hostapd_build_beacon_data()
2470 ret = hostapd_build_ap_extra_ies(hapd, &beacon_extra, in hostapd_build_beacon_data()
2541 hostapd_free_ap_extra_ies(hapd, beacon_extra, proberesp_extra, in hostapd_build_beacon_data()
2554 static int hostapd_change_config_freq(struct hostapd_data *hapd, in hostapd_change_config_freq() argument
2563 params->channel = hostapd_hw_get_channel(hapd, params->freq); in hostapd_change_config_freq()
2587 static int hostapd_fill_csa_settings(struct hostapd_data *hapd, in hostapd_fill_csa_settings() argument
2590 struct hostapd_iface *iface = hapd->iface; in hostapd_fill_csa_settings()
2595 if (!iface || !iface->freq || hapd->csa_in_progress) in hostapd_fill_csa_settings()
2604 ret = hostapd_build_beacon_data(hapd, &settings->beacon_after); in hostapd_fill_csa_settings()
2614 hapd->cs_freq_params = settings->freq_params; in hostapd_fill_csa_settings()
2615 hapd->cs_count = settings->cs_count; in hostapd_fill_csa_settings()
2616 hapd->cs_block_tx = settings->block_tx; in hostapd_fill_csa_settings()
2618 ret = hostapd_build_beacon_data(hapd, &settings->beacon_csa); in hostapd_fill_csa_settings()
2624 settings->counter_offset_beacon = hapd->cs_c_off_beacon; in hostapd_fill_csa_settings()
2625 settings->counter_offset_presp = hapd->cs_c_off_proberesp; in hostapd_fill_csa_settings()
2631 void hostapd_cleanup_cs_params(struct hostapd_data *hapd) in hostapd_cleanup_cs_params() argument
2633 os_memset(&hapd->cs_freq_params, 0, sizeof(hapd->cs_freq_params)); in hostapd_cleanup_cs_params()
2634 hapd->cs_count = 0; in hostapd_cleanup_cs_params()
2635 hapd->cs_block_tx = 0; in hostapd_cleanup_cs_params()
2636 hapd->cs_c_off_beacon = 0; in hostapd_cleanup_cs_params()
2637 hapd->cs_c_off_proberesp = 0; in hostapd_cleanup_cs_params()
2638 hapd->csa_in_progress = 0; in hostapd_cleanup_cs_params()
2642 int hostapd_switch_channel(struct hostapd_data *hapd, in hostapd_switch_channel() argument
2647 if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA)) { in hostapd_switch_channel()
2652 ret = hostapd_fill_csa_settings(hapd, settings); in hostapd_switch_channel()
2656 ret = hostapd_drv_switch_channel(hapd, settings); in hostapd_switch_channel()
2662 hostapd_cleanup_cs_params(hapd); in hostapd_switch_channel()
2666 hapd->csa_in_progress = 1; in hostapd_switch_channel()