Lines Matching refs:iface
61 static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd);
63 static int setup_interface2(struct hostapd_iface *iface);
70 int (*cb)(struct hostapd_iface *iface, in hostapd_for_each_interface() argument
77 ret = cb(interfaces->iface[i], ctx); in hostapd_for_each_interface()
92 hostapd_setup_encryption(hapd->conf->iface, hapd); in hostapd_reconfig_encryption()
125 hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 1); in hostapd_reload_bss()
127 hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 0); in hostapd_reload_bss()
145 hostapd_setup_encryption(hapd->conf->iface, hapd); in hostapd_reload_bss()
158 wpa_printf(MSG_DEBUG, "Reconfigured interface %s", hapd->conf->iface); in hostapd_reload_bss()
162 static void hostapd_clear_old(struct hostapd_iface *iface) in hostapd_clear_old() argument
170 for (j = 0; j < iface->num_bss; j++) { in hostapd_clear_old()
171 hostapd_flush_old_stations(iface->bss[j], in hostapd_clear_old()
173 hostapd_broadcast_wep_clear(iface->bss[j]); in hostapd_clear_old()
178 radius_client_flush(iface->bss[j]->radius, 0); in hostapd_clear_old()
193 if (os_strcmp(newconf->bss[i]->iface, in hostapd_iface_conf_changed()
194 oldconf->bss[i]->iface) != 0) in hostapd_iface_conf_changed()
202 int hostapd_reload_config(struct hostapd_iface *iface) in hostapd_reload_config() argument
204 struct hapd_interfaces *interfaces = iface->interfaces; in hostapd_reload_config()
205 struct hostapd_data *hapd = iface->bss[0]; in hostapd_reload_config()
209 if (iface->config_fname == NULL) { in hostapd_reload_config()
211 hostapd_clear_old(iface); in hostapd_reload_config()
212 for (j = 0; j < iface->num_bss; j++) in hostapd_reload_config()
213 hostapd_reload_bss(iface->bss[j]); in hostapd_reload_config()
217 if (iface->interfaces == NULL || in hostapd_reload_config()
218 iface->interfaces->config_read_cb == NULL) in hostapd_reload_config()
220 newconf = iface->interfaces->config_read_cb(iface->config_fname); in hostapd_reload_config()
224 hostapd_clear_old(iface); in hostapd_reload_config()
233 fname = os_strdup(iface->config_fname); in hostapd_reload_config()
238 hostapd_remove_iface(interfaces, hapd->conf->iface); in hostapd_reload_config()
239 iface = hostapd_init(interfaces, fname); in hostapd_reload_config()
242 if (!iface) { in hostapd_reload_config()
247 iface->interfaces = interfaces; in hostapd_reload_config()
248 interfaces->iface[interfaces->count] = iface; in hostapd_reload_config()
250 res = hostapd_enable_iface(iface); in hostapd_reload_config()
256 iface->conf = newconf; in hostapd_reload_config()
258 for (j = 0; j < iface->num_bss; j++) { in hostapd_reload_config()
259 hapd = iface->bss[j]; in hostapd_reload_config()
320 hostapd_broadcast_key_clear_iface(hapd, hapd->conf->iface); in hostapd_broadcast_wep_clear()
332 hostapd_drv_set_key(hapd->conf->iface, in hostapd_broadcast_wep_set()
359 __func__, hapd->conf ? hapd->conf->iface : "N/A"); in hostapd_free_hapd_data()
365 wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface); in hostapd_free_hapd_data()
390 if (hostapd_if_remove(hapd, WPA_IF_AP_BSS, hapd->conf->iface)) { in hostapd_free_hapd_data()
393 hapd->conf->iface); in hostapd_free_hapd_data()
458 hapd->conf ? hapd->conf->iface : "N/A"); in hostapd_cleanup()
459 if (hapd->iface->interfaces && in hostapd_cleanup()
460 hapd->iface->interfaces->ctrl_iface_deinit) { in hostapd_cleanup()
462 hapd->iface->interfaces->ctrl_iface_deinit(hapd); in hostapd_cleanup()
468 static void sta_track_deinit(struct hostapd_iface *iface) in sta_track_deinit() argument
472 if (!iface->num_sta_seen) in sta_track_deinit()
475 while ((info = dl_list_first(&iface->sta_seen, struct hostapd_sta_info, in sta_track_deinit()
478 iface->num_sta_seen--; in sta_track_deinit()
484 static void hostapd_cleanup_iface_partial(struct hostapd_iface *iface) in hostapd_cleanup_iface_partial() argument
486 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); in hostapd_cleanup_iface_partial()
489 hostapd_stop_setup_timers(iface); in hostapd_cleanup_iface_partial()
492 if (iface->current_mode) in hostapd_cleanup_iface_partial()
493 acs_cleanup(iface); in hostapd_cleanup_iface_partial()
494 hostapd_free_hw_features(iface->hw_features, iface->num_hw_features); in hostapd_cleanup_iface_partial()
495 iface->hw_features = NULL; in hostapd_cleanup_iface_partial()
496 iface->current_mode = NULL; in hostapd_cleanup_iface_partial()
497 os_free(iface->current_rates); in hostapd_cleanup_iface_partial()
498 iface->current_rates = NULL; in hostapd_cleanup_iface_partial()
499 os_free(iface->basic_rates); in hostapd_cleanup_iface_partial()
500 iface->basic_rates = NULL; in hostapd_cleanup_iface_partial()
501 ap_list_deinit(iface); in hostapd_cleanup_iface_partial()
502 sta_track_deinit(iface); in hostapd_cleanup_iface_partial()
503 airtime_policy_update_deinit(iface); in hostapd_cleanup_iface_partial()
514 static void hostapd_cleanup_iface(struct hostapd_iface *iface) in hostapd_cleanup_iface() argument
516 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); in hostapd_cleanup_iface()
517 eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); in hostapd_cleanup_iface()
518 eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface, in hostapd_cleanup_iface()
521 hostapd_cleanup_iface_partial(iface); in hostapd_cleanup_iface()
522 hostapd_config_free(iface->conf); in hostapd_cleanup_iface()
523 iface->conf = NULL; in hostapd_cleanup_iface()
525 os_free(iface->config_fname); in hostapd_cleanup_iface()
526 os_free(iface->bss); in hostapd_cleanup_iface()
527 wpa_printf(MSG_DEBUG, "%s: free iface=%p", __func__, iface); in hostapd_cleanup_iface()
528 os_free(iface); in hostapd_cleanup_iface()
534 if (hapd->drv_priv && !hapd->iface->driver_ap_teardown && hapd->conf) { in hostapd_clear_wep()
541 static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd) in hostapd_setup_encryption() argument
560 hostapd_drv_set_key(iface, hapd, WPA_ALG_WEP, NULL, i, in hostapd_setup_encryption()
585 if (!hapd->iface->driver_ap_teardown) { in hostapd_flush_old_stations()
622 static int hostapd_validate_bssid_configuration(struct hostapd_iface *iface) in hostapd_validate_bssid_configuration() argument
625 struct hostapd_data *hapd = iface->bss[0]; in hostapd_validate_bssid_configuration()
626 unsigned int i = iface->conf->num_bss, bits = 0, j; in hostapd_validate_bssid_configuration()
632 if (iface->conf->use_driver_iface_addr) in hostapd_validate_bssid_configuration()
643 for (j = 0; j < iface->conf->num_bss; j++) { in hostapd_validate_bssid_configuration()
644 if (is_zero_ether_addr(iface->conf->bss[j]->bssid)) { in hostapd_validate_bssid_configuration()
652 iface->conf->bss[j]->bssid[i] ^ in hostapd_validate_bssid_configuration()
693 (unsigned long) iface->conf->num_bss, MAC2STR(mask), bits); in hostapd_validate_bssid_configuration()
1092 __func__, hapd, conf->iface, first); in hostapd_setup_bss()
1103 __func__, conf->iface); in hostapd_setup_bss()
1116 hapd->iface->bss[0]->own_addr) == in hostapd_setup_bss()
1120 "the radio", conf->iface); in hostapd_setup_bss()
1133 if (hostapd_if_add(hapd->iface->bss[0], WPA_IF_AP_BSS, in hostapd_setup_bss()
1134 conf->iface, addr, hapd, in hostapd_setup_bss()
1157 if ((hapd->conf->mesh & MESH_ENABLED) && hapd->iface->mconf == NULL) in hostapd_setup_bss()
1167 if (hostapd_setup_encryption(conf->iface, hapd)) in hostapd_setup_bss()
1201 conf->iface, MAC2DBGSTR(hapd->own_addr), in hostapd_setup_bss()
1365 static void hostapd_tx_queue_params(struct hostapd_iface *iface) in hostapd_tx_queue_params() argument
1367 struct hostapd_data *hapd = iface->bss[0]; in hostapd_tx_queue_params()
1372 if ((hapd->conf->mesh & MESH_ENABLED) && iface->mconf == NULL) in hostapd_tx_queue_params()
1377 p = &iface->conf->tx_queue[i]; in hostapd_tx_queue_params()
1422 if (hapd->iface->drv_max_acl_mac_addrs == 0) in hostapd_set_acl()
1449 if (!hapd->iface->interfaces || in start_ctrl_iface_bss()
1450 !hapd->iface->interfaces->ctrl_iface_init) in start_ctrl_iface_bss()
1453 if (hapd->iface->interfaces->ctrl_iface_init(hapd)) { in start_ctrl_iface_bss()
1456 hapd->conf->iface); in start_ctrl_iface_bss()
1464 static int start_ctrl_iface(struct hostapd_iface *iface) in start_ctrl_iface() argument
1468 if (!iface->interfaces || !iface->interfaces->ctrl_iface_init) in start_ctrl_iface()
1471 for (i = 0; i < iface->num_bss; i++) { in start_ctrl_iface()
1472 struct hostapd_data *hapd = iface->bss[i]; in start_ctrl_iface()
1473 if (iface->interfaces->ctrl_iface_init(hapd)) { in start_ctrl_iface()
1476 hapd->conf->iface); in start_ctrl_iface()
1487 struct hostapd_iface *iface = eloop_ctx; in channel_list_update_timeout() local
1489 if (!iface->wait_channel_update) { in channel_list_update_timeout()
1499 setup_interface2(iface); in channel_list_update_timeout()
1503 void hostapd_channel_list_updated(struct hostapd_iface *iface, int initiator) in hostapd_channel_list_updated() argument
1505 if (!iface->wait_channel_update || initiator != REGDOM_SET_BY_USER) in hostapd_channel_list_updated()
1509 eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); in hostapd_channel_list_updated()
1510 setup_interface2(iface); in hostapd_channel_list_updated()
1514 static int setup_interface(struct hostapd_iface *iface) in setup_interface() argument
1516 struct hostapd_data *hapd = iface->bss[0]; in setup_interface()
1526 iface->driver_ap_teardown = 0; in setup_interface()
1528 if (!iface->phy[0]) { in setup_interface()
1532 os_strlcpy(iface->phy, phy, sizeof(iface->phy)); in setup_interface()
1540 for (i = 1; i < iface->num_bss; i++) { in setup_interface()
1541 iface->bss[i]->driver = hapd->driver; in setup_interface()
1542 iface->bss[i]->drv_priv = hapd->drv_priv; in setup_interface()
1545 if (hostapd_validate_bssid_configuration(iface)) in setup_interface()
1553 if (start_ctrl_iface(iface)) in setup_interface()
1559 hostapd_set_state(iface, HAPD_IFACE_COUNTRY_UPDATE); in setup_interface()
1575 iface->wait_channel_update = 1; in setup_interface()
1578 iface, NULL); in setup_interface()
1583 return setup_interface2(iface); in setup_interface()
1587 static int setup_interface2(struct hostapd_iface *iface) in setup_interface2() argument
1589 iface->wait_channel_update = 0; in setup_interface2()
1591 if (hostapd_get_hw_features(iface)) { in setup_interface2()
1595 int ret = hostapd_select_hw_mode(iface); in setup_interface2()
1605 ret = hostapd_check_ht_capab(iface); in setup_interface2()
1614 if (iface->conf->ieee80211h) in setup_interface2()
1617 return hostapd_setup_interface_complete(iface, 0); in setup_interface2()
1620 hostapd_set_state(iface, HAPD_IFACE_DISABLED); in setup_interface2()
1621 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, AP_EVENT_DISABLED); in setup_interface2()
1622 if (iface->interfaces && iface->interfaces->terminate_on_error) in setup_interface2()
1644 *hw_mode = ieee80211_freq_to_chan(hapd->iface->freq, channel); in fst_hostapd_get_channel_info_cb()
1652 if (hapd->iface->fst_ies != fst_ies) { in fst_hostapd_set_ies_cb()
1653 hapd->iface->fst_ies = fst_ies; in fst_hostapd_set_ies_cb()
1665 return hostapd_drv_send_action(hapd, hapd->iface->freq, 0, da, in fst_hostapd_send_action_cb()
1755 static int hostapd_owe_iface_iter(struct hostapd_iface *iface, void *ctx) in hostapd_owe_iface_iter() argument
1760 for (i = 0; i < iface->num_bss; i++) { in hostapd_owe_iface_iter()
1761 struct hostapd_data *bss = iface->bss[i]; in hostapd_owe_iface_iter()
1764 bss->conf->iface) != 0) in hostapd_owe_iface_iter()
1770 hapd->conf->iface, bss->conf->iface, in hostapd_owe_iface_iter()
1800 if (!hapd->iface->interfaces || in hostapd_owe_trans_get_info()
1801 !hapd->iface->interfaces->for_each_interface) in hostapd_owe_trans_get_info()
1802 return hostapd_owe_iface_iter(hapd->iface, hapd); in hostapd_owe_trans_get_info()
1804 return hapd->iface->interfaces->for_each_interface( in hostapd_owe_trans_get_info()
1805 hapd->iface->interfaces, hostapd_owe_iface_iter, hapd); in hostapd_owe_trans_get_info()
1809 static int hostapd_owe_iface_iter2(struct hostapd_iface *iface, void *ctx) in hostapd_owe_iface_iter2() argument
1813 for (i = 0; i < iface->num_bss; i++) { in hostapd_owe_iface_iter2()
1814 struct hostapd_data *bss = iface->bss[i]; in hostapd_owe_iface_iter2()
1824 bss->conf->iface); in hostapd_owe_iface_iter2()
1834 static void hostapd_owe_update_trans(struct hostapd_iface *iface) in hostapd_owe_update_trans() argument
1839 if (!iface->interfaces || in hostapd_owe_update_trans()
1840 !iface->interfaces->for_each_interface) in hostapd_owe_update_trans()
1841 hostapd_owe_iface_iter2(iface, NULL); in hostapd_owe_update_trans()
1843 iface->interfaces->for_each_interface( in hostapd_owe_update_trans()
1844 iface->interfaces, hostapd_owe_iface_iter2, NULL); in hostapd_owe_update_trans()
1852 struct hostapd_iface *iface = eloop_ctx; in hostapd_interface_setup_failure_handler() local
1855 if (iface->num_bss < 1 || !iface->bss || !iface->bss[0]) in hostapd_interface_setup_failure_handler()
1857 hapd = iface->bss[0]; in hostapd_interface_setup_failure_handler()
1863 static int hostapd_setup_interface_complete_sync(struct hostapd_iface *iface, in hostapd_setup_interface_complete_sync() argument
1866 struct hostapd_data *hapd = iface->bss[0]; in hostapd_setup_interface_complete_sync()
1876 if (iface->conf->channel) { in hostapd_setup_interface_complete_sync()
1881 iface->freq = hostapd_hw_get_freq(hapd, iface->conf->channel); in hostapd_setup_interface_complete_sync()
1884 hostapd_hw_mode_txt(iface->conf->hw_mode), in hostapd_setup_interface_complete_sync()
1885 iface->conf->channel, iface->freq); in hostapd_setup_interface_complete_sync()
1889 if (!(iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)) { in hostapd_setup_interface_complete_sync()
1891 res = hostapd_handle_dfs(iface); in hostapd_setup_interface_complete_sync()
1899 res_dfs_offload = hostapd_handle_dfs_offload(iface); in hostapd_setup_interface_complete_sync()
1918 if (iface->mconf != NULL) { in hostapd_setup_interface_complete_sync()
1921 iface->bss[0]->conf->iface); in hostapd_setup_interface_complete_sync()
1927 hostapd_set_freq(hapd, hapd->iconf->hw_mode, iface->freq, in hostapd_setup_interface_complete_sync()
1944 if (iface->current_mode) { in hostapd_setup_interface_complete_sync()
1945 if (hostapd_prepare_rates(iface, iface->current_mode)) { in hostapd_setup_interface_complete_sync()
1973 for (j = 0; j < iface->num_bss; j++) { in hostapd_setup_interface_complete_sync()
1974 hapd = iface->bss[j]; in hostapd_setup_interface_complete_sync()
1979 hapd = iface->bss[j]; in hostapd_setup_interface_complete_sync()
1991 hapd = iface->bss[0]; in hostapd_setup_interface_complete_sync()
1993 hostapd_tx_queue_params(iface); in hostapd_setup_interface_complete_sync()
1995 ap_list_init(iface); in hostapd_setup_interface_complete_sync()
2011 for (j = 0; j < iface->num_bss; j++) { in hostapd_setup_interface_complete_sync()
2012 if (hostapd_init_wps_complete(iface->bss[j])) in hostapd_setup_interface_complete_sync()
2016 if ((iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) && in hostapd_setup_interface_complete_sync()
2035 iface->fst = fst_attach(hapd->conf->iface, hapd->own_addr, in hostapd_setup_interface_complete_sync()
2037 if (!iface->fst) { in hostapd_setup_interface_complete_sync()
2045 hostapd_set_state(iface, HAPD_IFACE_ENABLED); in hostapd_setup_interface_complete_sync()
2046 hostapd_owe_update_trans(iface); in hostapd_setup_interface_complete_sync()
2047 airtime_policy_update_init(iface); in hostapd_setup_interface_complete_sync()
2048 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, AP_EVENT_ENABLED); in hostapd_setup_interface_complete_sync()
2053 iface->bss[0]->conf->iface); in hostapd_setup_interface_complete_sync()
2054 if (iface->interfaces && iface->interfaces->terminate_on_error > 0) in hostapd_setup_interface_complete_sync()
2055 iface->interfaces->terminate_on_error--; in hostapd_setup_interface_complete_sync()
2057 for (j = 0; j < iface->num_bss; j++) in hostapd_setup_interface_complete_sync()
2058 hostapd_neighbor_set_own_report(iface->bss[j]); in hostapd_setup_interface_complete_sync()
2064 hostapd_set_state(iface, HAPD_IFACE_DISABLED); in hostapd_setup_interface_complete_sync()
2067 if (iface->fst) { in hostapd_setup_interface_complete_sync()
2068 fst_detach(iface->fst); in hostapd_setup_interface_complete_sync()
2069 iface->fst = NULL; in hostapd_setup_interface_complete_sync()
2073 if (iface->interfaces && iface->interfaces->terminate_on_error) { in hostapd_setup_interface_complete_sync()
2082 iface, NULL); in hostapd_setup_interface_complete_sync()
2097 int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err) in hostapd_setup_interface_complete() argument
2099 struct hapd_interfaces *interfaces = iface->interfaces; in hostapd_setup_interface_complete()
2100 struct hostapd_data *hapd = iface->bss[0]; in hostapd_setup_interface_complete()
2104 if (!iface->need_to_start_in_sync) in hostapd_setup_interface_complete()
2105 return hostapd_setup_interface_complete_sync(iface, err); in hostapd_setup_interface_complete()
2109 hostapd_set_state(iface, HAPD_IFACE_DISABLED); in hostapd_setup_interface_complete()
2110 iface->need_to_start_in_sync = 0; in hostapd_setup_interface_complete()
2117 if (iface->ready_to_start_in_sync) { in hostapd_setup_interface_complete()
2123 if (interfaces->iface[i]->need_to_start_in_sync && in hostapd_setup_interface_complete()
2124 !interfaces->iface[i]->ready_to_start_in_sync) in hostapd_setup_interface_complete()
2132 if (not_ready_in_sync_ifaces > 1 && iface->state == HAPD_IFACE_DFS) { in hostapd_setup_interface_complete()
2137 iface->need_to_start_in_sync = 0; in hostapd_setup_interface_complete()
2140 iface->bss[0]->conf->iface); in hostapd_setup_interface_complete()
2141 return hostapd_setup_interface_complete_sync(iface, err); in hostapd_setup_interface_complete()
2146 iface->ready_to_start_in_sync = 1; in hostapd_setup_interface_complete()
2149 iface->bss[0]->conf->iface); in hostapd_setup_interface_complete()
2155 iface->bss[0]->conf->iface); in hostapd_setup_interface_complete()
2156 iface->need_to_start_in_sync = 0; in hostapd_setup_interface_complete()
2157 hostapd_setup_interface_complete_sync(iface, err); in hostapd_setup_interface_complete()
2159 if (interfaces->iface[i]->need_to_start_in_sync && in hostapd_setup_interface_complete()
2160 interfaces->iface[i]->ready_to_start_in_sync) { in hostapd_setup_interface_complete()
2162 interfaces->iface[i], 0); in hostapd_setup_interface_complete()
2164 interfaces->iface[i]->need_to_start_in_sync = 0; in hostapd_setup_interface_complete()
2188 int hostapd_setup_interface(struct hostapd_iface *iface) in hostapd_setup_interface() argument
2192 ret = setup_interface(iface); in hostapd_setup_interface()
2195 iface->bss[0]->conf->iface); in hostapd_setup_interface()
2228 hapd->iface = hapd_iface; in hostapd_alloc_bss_data()
2252 hapd->conf ? hapd->conf->iface : "N/A"); in hostapd_bss_deinit()
2265 void hostapd_interface_deinit(struct hostapd_iface *iface) in hostapd_interface_deinit() argument
2269 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); in hostapd_interface_deinit()
2270 if (iface == NULL) in hostapd_interface_deinit()
2273 hostapd_set_state(iface, HAPD_IFACE_DISABLED); in hostapd_interface_deinit()
2275 eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); in hostapd_interface_deinit()
2276 iface->wait_channel_update = 0; in hostapd_interface_deinit()
2279 if (iface->fst) { in hostapd_interface_deinit()
2280 fst_detach(iface->fst); in hostapd_interface_deinit()
2281 iface->fst = NULL; in hostapd_interface_deinit()
2285 for (j = (int) iface->num_bss - 1; j >= 0; j--) { in hostapd_interface_deinit()
2286 if (!iface->bss) in hostapd_interface_deinit()
2288 hostapd_bss_deinit(iface->bss[j]); in hostapd_interface_deinit()
2293 hostapd_stop_setup_timers(iface); in hostapd_interface_deinit()
2294 eloop_cancel_timeout(ap_ht2040_timeout, iface, NULL); in hostapd_interface_deinit()
2300 void hostapd_interface_free(struct hostapd_iface *iface) in hostapd_interface_free() argument
2303 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); in hostapd_interface_free()
2304 for (j = 0; j < iface->num_bss; j++) { in hostapd_interface_free()
2305 if (!iface->bss) in hostapd_interface_free()
2308 __func__, iface->bss[j]); in hostapd_interface_free()
2309 os_free(iface->bss[j]); in hostapd_interface_free()
2311 hostapd_cleanup_iface(iface); in hostapd_interface_free()
2397 struct hostapd_iface *iface = interfaces->iface[i]; in ifname_in_use() local
2398 for (j = 0; j < iface->num_bss; j++) { in ifname_in_use()
2399 struct hostapd_data *hapd = iface->bss[j]; in ifname_in_use()
2400 if (os_strcmp(ifname, hapd->conf->iface) == 0) in ifname_in_use()
2424 struct hostapd_iface *new_iface = NULL, *iface = NULL; in hostapd_interface_init_bss() local
2433 if (os_strcmp(interfaces->iface[i]->phy, phy) == 0) { in hostapd_interface_init_bss()
2434 iface = interfaces->iface[i]; in hostapd_interface_init_bss()
2440 config_fname, phy, iface ? "" : " --> new PHY"); in hostapd_interface_init_bss()
2441 if (iface) { in hostapd_interface_init_bss()
2458 ifname = conf->bss[0]->iface; in hostapd_interface_init_bss()
2467 iface->conf->bss, iface->conf->num_bss + 1, in hostapd_interface_init_bss()
2469 tmp_bss = os_realloc_array(iface->bss, iface->num_bss + 1, in hostapd_interface_init_bss()
2472 iface->bss = tmp_bss; in hostapd_interface_init_bss()
2474 iface->conf->bss = tmp_conf; in hostapd_interface_init_bss()
2475 iface->conf->last_bss = tmp_conf[0]; in hostapd_interface_init_bss()
2481 bss = iface->conf->bss[iface->conf->num_bss] = conf->bss[0]; in hostapd_interface_init_bss()
2482 iface->conf->num_bss++; in hostapd_interface_init_bss()
2484 hapd = hostapd_alloc_bss_data(iface, iface->conf, bss); in hostapd_interface_init_bss()
2486 iface->conf->num_bss--; in hostapd_interface_init_bss()
2490 iface->conf->last_bss = bss; in hostapd_interface_init_bss()
2491 iface->bss[iface->num_bss] = hapd; in hostapd_interface_init_bss()
2494 bss_idx = iface->num_bss++; in hostapd_interface_init_bss()
2500 new_iface = iface = hostapd_init(interfaces, config_fname); in hostapd_interface_init_bss()
2501 if (!iface) in hostapd_interface_init_bss()
2503 os_strlcpy(iface->phy, phy, sizeof(iface->phy)); in hostapd_interface_init_bss()
2504 iface->interfaces = interfaces; in hostapd_interface_init_bss()
2509 if (iface->bss[bss_idx]->conf->logger_stdout_level > 0) in hostapd_interface_init_bss()
2510 iface->bss[bss_idx]->conf->logger_stdout_level--; in hostapd_interface_init_bss()
2513 if (iface->conf->bss[bss_idx]->iface[0] == '\0' && in hostapd_interface_init_bss()
2514 !hostapd_drv_none(iface->bss[bss_idx])) { in hostapd_interface_init_bss()
2522 return iface; in hostapd_interface_init_bss()
2526 void hostapd_interface_deinit_free(struct hostapd_iface *iface) in hostapd_interface_deinit_free() argument
2531 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); in hostapd_interface_deinit_free()
2532 if (iface == NULL) in hostapd_interface_deinit_free()
2535 __func__, (unsigned int) iface->num_bss, in hostapd_interface_deinit_free()
2536 (unsigned int) iface->conf->num_bss); in hostapd_interface_deinit_free()
2537 driver = iface->bss[0]->driver; in hostapd_interface_deinit_free()
2538 drv_priv = iface->bss[0]->drv_priv; in hostapd_interface_deinit_free()
2539 hostapd_interface_deinit(iface); in hostapd_interface_deinit_free()
2544 iface->bss[0]->drv_priv = NULL; in hostapd_interface_deinit_free()
2546 hostapd_interface_free(iface); in hostapd_interface_deinit_free()
2581 hapd_iface->conf->bss[0]->iface); in hostapd_enable_iface()
2586 hapd_iface->conf->bss[0]->iface); in hostapd_enable_iface()
2616 hapd_iface->conf->bss[0]->iface); in hostapd_reload_iface()
2642 hapd_iface->conf->bss[0]->iface); in hostapd_disable_iface()
2674 hapd_iface->bss[0]->conf->iface); in hostapd_disable_iface()
2683 struct hostapd_iface **iface, *hapd_iface; in hostapd_iface_alloc() local
2685 iface = os_realloc_array(interfaces->iface, interfaces->count + 1, in hostapd_iface_alloc()
2687 if (iface == NULL) in hostapd_iface_alloc()
2689 interfaces->iface = iface; in hostapd_iface_alloc()
2690 hapd_iface = interfaces->iface[interfaces->count] = in hostapd_iface_alloc()
2744 os_strlcpy(bss->iface, ifname, sizeof(bss->iface)); in hostapd_config_alloc()
2818 if (interfaces->iface[j] == hapd_iface) in hostapd_add_iface()
2823 tmp = os_realloc_array(interfaces->iface, in hostapd_add_iface()
2830 interfaces->iface = tmp; in hostapd_add_iface()
2831 interfaces->iface[interfaces->count++] = hapd_iface; in hostapd_add_iface()
2862 __func__, hapd, hapd->conf->iface); in hostapd_add_iface()
2882 if (!os_strcmp(interfaces->iface[i]->conf->bss[0]->iface, in hostapd_add_iface()
2901 os_strlcpy(conf->bss[0]->iface, buf, in hostapd_add_iface()
2902 sizeof(conf->bss[0]->iface)); in hostapd_add_iface()
2928 hapd_iface->conf->bss[0]->iface); in hostapd_add_iface()
2947 hapd->conf->iface); in hostapd_add_iface()
2957 interfaces->iface[interfaces->count] = NULL; in hostapd_add_iface()
2965 static int hostapd_remove_bss(struct hostapd_iface *iface, unsigned int idx) in hostapd_remove_bss() argument
2969 wpa_printf(MSG_INFO, "Remove BSS '%s'", iface->conf->bss[idx]->iface); in hostapd_remove_bss()
2972 if (idx < iface->num_bss) { in hostapd_remove_bss()
2973 struct hostapd_data *hapd = iface->bss[idx]; in hostapd_remove_bss()
2977 __func__, hapd, hapd->conf->iface); in hostapd_remove_bss()
2982 iface->num_bss--; in hostapd_remove_bss()
2984 for (i = idx; i < iface->num_bss; i++) in hostapd_remove_bss()
2985 iface->bss[i] = iface->bss[i + 1]; in hostapd_remove_bss()
2987 hostapd_config_free_bss(iface->conf->bss[idx]); in hostapd_remove_bss()
2988 iface->conf->bss[idx] = NULL; in hostapd_remove_bss()
2991 iface->conf->num_bss--; in hostapd_remove_bss()
2992 for (i = idx; i < iface->conf->num_bss; i++) in hostapd_remove_bss()
2993 iface->conf->bss[i] = iface->conf->bss[i + 1]; in hostapd_remove_bss()
3005 hapd_iface = interfaces->iface[i]; in hostapd_remove_iface()
3008 if (!os_strcmp(hapd_iface->conf->bss[0]->iface, buf)) { in hostapd_remove_iface()
3017 interfaces->iface[k] = in hostapd_remove_iface()
3018 interfaces->iface[k + 1]; in hostapd_remove_iface()
3026 if (!os_strcmp(hapd_iface->conf->bss[j]->iface, buf)) { in hostapd_remove_iface()
3097 if (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_WIRED) { in hostapd_new_assoc_sta()
3102 hapd->conf->iface, __func__, in hostapd_new_assoc_sta()
3105 } else if (!(hapd->iface->drv_flags & in hostapd_new_assoc_sta()
3110 hapd->conf->iface, __func__, MAC2STR(sta->addr), in hostapd_new_assoc_sta()
3150 void hostapd_set_state(struct hostapd_iface *iface, enum hostapd_iface_state s) in hostapd_set_state() argument
3153 iface->conf ? iface->conf->bss[0]->iface : "N/A", in hostapd_set_state()
3154 hostapd_state_text(iface->state), hostapd_state_text(s)); in hostapd_set_state()
3155 iface->state = s; in hostapd_set_state()
3159 int hostapd_csa_in_progress(struct hostapd_iface *iface) in hostapd_csa_in_progress() argument
3163 for (i = 0; i < iface->num_bss; i++) in hostapd_csa_in_progress()
3164 if (iface->bss[i]->csa_in_progress) in hostapd_csa_in_progress()
3295 mode = hapd->iface->current_mode; in hostapd_change_config_freq()
3350 struct hostapd_iface *iface = hapd->iface; in hostapd_fill_csa_settings() local
3356 if (!iface || !iface->freq || hapd->csa_in_progress) in hostapd_fill_csa_settings()
3378 &hapd->iface->cs_oper_class, in hostapd_fill_csa_settings()
3391 ret = hostapd_change_config_freq(iface->bss[0], iface->conf, in hostapd_fill_csa_settings()
3400 hostapd_change_config_freq(iface->bss[0], iface->conf, in hostapd_fill_csa_settings()
3457 if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA)) { in hostapd_switch_channel()
3482 hostapd_switch_channel_fallback(struct hostapd_iface *iface, in hostapd_switch_channel_fallback() argument
3515 iface->freq = freq_params->freq; in hostapd_switch_channel_fallback()
3516 iface->conf->channel = freq_params->channel; in hostapd_switch_channel_fallback()
3517 iface->conf->secondary_channel = freq_params->sec_channel_offset; in hostapd_switch_channel_fallback()
3518 hostapd_set_oper_centr_freq_seg0_idx(iface->conf, seg0_idx); in hostapd_switch_channel_fallback()
3519 hostapd_set_oper_centr_freq_seg1_idx(iface->conf, seg1_idx); in hostapd_switch_channel_fallback()
3520 hostapd_set_oper_chwidth(iface->conf, bw); in hostapd_switch_channel_fallback()
3521 iface->conf->ieee80211n = freq_params->ht_enabled; in hostapd_switch_channel_fallback()
3522 iface->conf->ieee80211ac = freq_params->vht_enabled; in hostapd_switch_channel_fallback()
3523 iface->conf->ieee80211ax = freq_params->he_enabled; in hostapd_switch_channel_fallback()
3530 hostapd_disable_iface(iface); in hostapd_switch_channel_fallback()
3531 hostapd_enable_iface(iface); in hostapd_switch_channel_fallback()
3543 struct hostapd_iface *iface = interfaces->iface[i]; in hostapd_get_iface() local
3545 for (j = 0; j < iface->num_bss; j++) { in hostapd_get_iface()
3546 struct hostapd_data *hapd = iface->bss[j]; in hostapd_get_iface()
3548 if (os_strcmp(ifname, hapd->conf->iface) == 0) in hostapd_get_iface()
3557 void hostapd_periodic_iface(struct hostapd_iface *iface) in hostapd_periodic_iface() argument
3561 ap_list_timer(iface); in hostapd_periodic_iface()
3563 for (i = 0; i < iface->num_bss; i++) { in hostapd_periodic_iface()
3564 struct hostapd_data *hapd = iface->bss[i]; in hostapd_periodic_iface()