Lines Matching full:iface

64 static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd);
67 static int setup_interface2(struct hostapd_iface *iface);
78 int (*cb)(struct hostapd_iface *iface,
85 if (!interfaces->iface[i])
87 ret = cb(interfaces->iface[i], ctx);
99 return hapd->iface->bss[0];
110 for (i = 1; i < hapd->iface->num_bss; i++)
111 if (hapd->iface->bss[i] == hapd)
126 hostapd_setup_encryption(hapd->conf->iface, hapd);
161 hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 1);
163 hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 0);
182 hostapd_setup_encryption(hapd->conf->iface, hapd);
198 wpa_printf(MSG_DEBUG, "Reconfigured interface %s", hapd->conf->iface);
205 bss->conf->iface);
224 static void hostapd_clear_old(struct hostapd_iface *iface)
228 for (j = 0; j < iface->num_bss; j++)
229 hostapd_clear_old_bss(iface->bss[j]);
242 if (os_strcmp(newconf->bss[i]->iface,
243 oldconf->bss[i]->iface) != 0)
251 int hostapd_reload_config(struct hostapd_iface *iface)
253 struct hapd_interfaces *interfaces = iface->interfaces;
254 struct hostapd_data *hapd = iface->bss[0];
258 if (iface->config_fname == NULL) {
260 hostapd_clear_old(iface);
261 for (j = 0; j < iface->num_bss; j++)
262 hostapd_reload_bss(iface->bss[j]);
266 if (iface->interfaces == NULL ||
267 iface->interfaces->config_read_cb == NULL)
269 newconf = iface->interfaces->config_read_cb(iface->config_fname);
278 hostapd_clear_old(iface);
282 fname = os_strdup(iface->config_fname);
287 hostapd_remove_iface(interfaces, hapd->conf->iface);
288 iface = hostapd_init(interfaces, fname);
291 if (!iface) {
296 iface->interfaces = interfaces;
297 interfaces->iface[interfaces->count] = iface;
299 res = hostapd_enable_iface(iface);
305 iface->conf = newconf;
307 for (j = 0; j < iface->num_bss; j++) {
308 hapd = iface->bss[j];
373 hostapd_broadcast_key_clear_iface(hapd, hapd->conf->iface);
385 hostapd_drv_set_key(hapd->conf->iface,
422 hostapd_disable_iface(hapd->iface);
471 __func__, hapd->conf ? hapd->conf->iface : "N/A");
477 wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
485 struct hapd_interfaces *ifaces = hapd->iface->interfaces;
489 struct hostapd_iface *iface = ifaces->iface[i];
492 for (j = 0; iface && j < iface->num_bss; j++) {
493 struct hostapd_data *h = iface->bss[j];
526 if (hostapd_if_remove(hapd, WPA_IF_AP_BSS, hapd->conf->iface)) {
529 hapd->conf->iface);
546 hapd->iface->bss[0] != hapd)
547 hostapd_if_link_remove(hapd, WPA_IF_AP_BSS, hapd->conf->iface,
633 if (!hapd->started && hapd->iface->bss[0] != hapd)
640 if (hapd->iface->bss[0] == hapd && !hapd->drv_priv)
659 hapd->conf ? hapd->conf->iface : "N/A");
660 if (hapd->iface->interfaces &&
661 hapd->iface->interfaces->ctrl_iface_deinit) {
663 hapd->iface->interfaces->ctrl_iface_deinit(hapd);
669 static void sta_track_deinit(struct hostapd_iface *iface)
673 if (!iface->num_sta_seen)
676 while ((info = dl_list_first(&iface->sta_seen, struct hostapd_sta_info,
679 iface->num_sta_seen--;
685 void hostapd_cleanup_iface_partial(struct hostapd_iface *iface)
687 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
688 eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
690 hostapd_stop_setup_timers(iface);
692 if (iface->current_mode)
693 acs_cleanup(iface);
694 hostapd_free_hw_features(iface->hw_features, iface->num_hw_features);
695 iface->hw_features = NULL;
696 iface->current_mode = NULL;
697 os_free(iface->current_rates);
698 iface->current_rates = NULL;
699 os_free(iface->basic_rates);
700 iface->basic_rates = NULL;
701 iface->cac_started = 0;
702 ap_list_deinit(iface);
703 sta_track_deinit(iface);
704 airtime_policy_update_deinit(iface);
710 * @iface: Pointer to interface data
715 static void hostapd_cleanup_iface(struct hostapd_iface *iface)
717 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
718 eloop_cancel_timeout(hostapd_interface_setup_failure_handler, iface,
721 hostapd_cleanup_iface_partial(iface);
722 hostapd_config_free(iface->conf);
723 iface->conf = NULL;
725 os_free(iface->config_fname);
726 os_free(iface->bss);
727 wpa_printf(MSG_DEBUG, "%s: free iface=%p", __func__, iface);
728 os_free(iface);
736 if (hapd->drv_priv && !hapd->iface->driver_ap_teardown && hapd->conf) {
743 static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd)
762 hostapd_drv_set_key(iface, hapd, WPA_ALG_WEP, NULL, i, 0,
792 if (!hapd->iface->driver_ap_teardown) {
826 * @iface: Pointer to interface data
831 static int hostapd_validate_bssid_configuration(struct hostapd_iface *iface)
834 struct hostapd_data *hapd = iface->bss[0];
835 unsigned int i = iface->conf->num_bss, bits = 0, j;
841 if (iface->conf->use_driver_iface_addr)
852 for (j = 0; j < iface->conf->num_bss; j++) {
853 if (is_zero_ether_addr(iface->conf->bss[j]->bssid)) {
861 iface->conf->bss[j]->bssid[i] ^
902 (unsigned long) iface->conf->num_bss, MAC2STR(mask), bits);
1395 __func__, hapd, conf->iface, first);
1406 __func__, conf->iface);
1419 hapd->iface->bss[0]->own_addr) ==
1423 "the radio", conf->iface);
1446 hapd->mld_link_id, hapd->conf->iface);
1453 if (hostapd_if_add(hapd->iface->bss[0], WPA_IF_AP_BSS,
1454 conf->iface, addr, hapd,
1471 hapd->mld_link_id, hapd->conf->iface);
1504 if ((hapd->conf->mesh & MESH_ENABLED) && hapd->iface->mconf == NULL)
1515 if (hostapd_setup_encryption(conf->iface, hapd))
1557 conf->iface, MAC2STR(hapd->own_addr),
1728 static void hostapd_tx_queue_params(struct hostapd_iface *iface)
1730 struct hostapd_data *hapd = iface->bss[0];
1735 if ((hapd->conf->mesh & MESH_ENABLED) && iface->mconf == NULL)
1740 p = &iface->conf->tx_queue[i];
1785 if (hapd->iface->drv_max_acl_mac_addrs == 0)
1813 if (!hapd->iface->interfaces ||
1814 !hapd->iface->interfaces->ctrl_iface_init)
1817 if (hapd->iface->interfaces->ctrl_iface_init(hapd)) {
1820 hapd->conf->iface);
1828 static int start_ctrl_iface(struct hostapd_iface *iface)
1832 if (!iface->interfaces || !iface->interfaces->ctrl_iface_init)
1835 for (i = 0; i < iface->num_bss; i++) {
1836 struct hostapd_data *hapd = iface->bss[i];
1837 if (iface->interfaces->ctrl_iface_init(hapd)) {
1840 hapd->conf->iface);
1858 hostapd_cleanup_iface_partial(bss->iface);
1862 static int hostapd_no_ir_channel_list_updated(struct hostapd_iface *iface,
1869 if (hostapd_get_hw_features(iface))
1875 for (i = 0; i < iface->num_hw_features; i++) {
1876 mode = &iface->hw_features[i];
1878 if (mode->mode == iface->conf->hw_mode) {
1879 if (iface->freq > 0 &&
1880 !hw_mode_get_channel(mode, iface->freq, NULL)) {
1899 iface->current_mode = mode;
1901 if (iface->state == HAPD_IFACE_ENABLED) {
1905 chan = hw_get_channel_freq(iface->current_mode->mode,
1906 iface->freq, NULL,
1907 iface->hw_features,
1908 iface->num_hw_features);
1925 hostapd_set_state(iface, HAPD_IFACE_NO_IR);
1926 iface->is_no_ir = true;
1927 hostapd_drv_stop_ap(iface->bss[0]);
1928 hostapd_no_ir_cleanup(iface->bss[0]);
1929 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, AP_EVENT_NO_IR);
1930 } else if (iface->state == HAPD_IFACE_NO_IR) {
1937 if (!iface->conf->acs) {
1940 chan = hw_get_channel_freq(iface->current_mode->mode,
1941 iface->freq, NULL,
1942 iface->hw_features,
1943 iface->num_hw_features);
1953 iface->freq = 0;
1954 iface->conf->channel = 0;
1955 if (acs_init(iface) != HOSTAPD_CHAN_ACS)
1962 setup_interface2(iface);
1971 struct hostapd_iface *iface = eloop_ctx;
1973 if (!iface->wait_channel_update) {
1983 setup_interface2(iface);
1987 void hostapd_channel_list_updated(struct hostapd_iface *iface, int initiator)
1990 hostapd_for_each_interface(iface->interfaces,
1996 if (!iface->wait_channel_update || initiator != REGDOM_SET_BY_USER)
2000 eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
2001 setup_interface2(iface);
2005 static int setup_interface(struct hostapd_iface *iface)
2007 struct hostapd_data *hapd = iface->bss[0];
2017 iface->driver_ap_teardown = 0;
2019 if (!iface->phy[0]) {
2023 os_strlcpy(iface->phy, phy, sizeof(iface->phy));
2031 for (i = 1; i < iface->num_bss; i++) {
2032 iface->bss[i]->driver = hapd->driver;
2033 iface->bss[i]->drv_priv = hapd->drv_priv;
2036 if (hostapd_validate_bssid_configuration(iface))
2044 if (start_ctrl_iface(iface))
2050 hostapd_set_state(iface, HAPD_IFACE_COUNTRY_UPDATE);
2066 iface->wait_channel_update = 1;
2069 iface, NULL);
2074 return setup_interface2(iface);
2078 static int configured_fixed_chan_to_freq(struct hostapd_iface *iface)
2082 if (!iface->conf->channel)
2084 if (iface->conf->op_class) {
2085 freq = ieee80211_chan_to_freq(NULL, iface->conf->op_class,
2086 iface->conf->channel);
2090 iface->conf->op_class, iface->conf->channel);
2093 iface->freq = freq;
2101 for (j = 0; j < iface->num_hw_features; j++) {
2102 struct hostapd_hw_modes *mode = &iface->hw_features[j];
2104 if (iface->conf->hw_mode != HOSTAPD_MODE_IEEE80211ANY &&
2105 iface->conf->hw_mode != mode->mode)
2110 if (chan->chan == iface->conf->channel &&
2112 iface->freq = chan->freq;
2123 static void hostapd_set_6ghz_sec_chan(struct hostapd_iface *iface)
2127 if (!is_6ghz_op_class(iface->conf->op_class))
2130 bw = op_class_to_bandwidth(iface->conf->op_class);
2133 if (bw >= 40 && !iface->conf->secondary_channel) {
2134 if (((iface->conf->channel - 1) / 4) % 2)
2135 iface->conf->secondary_channel = -1;
2137 iface->conf->secondary_channel = 1;
2142 static int setup_interface2(struct hostapd_iface *iface)
2144 iface->wait_channel_update = 0;
2145 iface->is_no_ir = false;
2159 iface->freq = iface->conf->channel;
2161 if (hostapd_get_hw_features(iface)) {
2167 if (iface->conf->acs && !iface->is_ch_switch_dfs) {
2168 iface->freq = 0;
2169 iface->conf->channel = 0;
2171 iface->is_ch_switch_dfs = false;
2173 ret = configured_fixed_chan_to_freq(iface);
2177 if (iface->conf->op_class) {
2180 ch_width = op_class_to_ch_width(iface->conf->op_class);
2181 hostapd_set_oper_chwidth(iface->conf, ch_width);
2182 hostapd_set_6ghz_sec_chan(iface);
2185 ret = hostapd_select_hw_mode(iface);
2195 ret = hostapd_check_edmg_capab(iface);
2198 ret = hostapd_check_he_6ghz_capab(iface);
2201 ret = hostapd_check_ht_capab(iface);
2210 if (iface->conf->ieee80211h)
2214 return hostapd_setup_interface_complete(iface, 0);
2217 if (iface->is_no_ir) {
2220 hostapd_set_state(iface, HAPD_IFACE_NO_IR);
2221 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, AP_EVENT_NO_IR);
2225 hostapd_set_state(iface, HAPD_IFACE_DISABLED);
2226 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, AP_EVENT_DISABLED);
2227 if (iface->interfaces && iface->interfaces->terminate_on_error)
2249 *hw_mode = ieee80211_freq_to_chan(hapd->iface->freq, channel);
2258 *modes = hapd->iface->hw_features;
2259 return hapd->iface->num_hw_features;
2267 if (hapd->iface->fst_ies != fst_ies) {
2268 hapd->iface->fst_ies = fst_ies;
2280 return hostapd_drv_send_action(hapd, hapd->iface->freq, 0, da,
2372 static int hostapd_owe_iface_iter(struct hostapd_iface *iface, void *ctx)
2377 for (i = 0; i < iface->num_bss; i++) {
2378 struct hostapd_data *bss = iface->bss[i];
2381 bss->conf->iface) != 0)
2387 hapd->conf->iface, bss->conf->iface,
2417 if (!hapd->iface->interfaces ||
2418 !hapd->iface->interfaces->for_each_interface)
2419 return hostapd_owe_iface_iter(hapd->iface, hapd);
2421 return hapd->iface->interfaces->for_each_interface(
2422 hapd->iface->interfaces, hostapd_owe_iface_iter, hapd);
2426 static int hostapd_owe_iface_iter2(struct hostapd_iface *iface, void *ctx)
2430 for (i = 0; i < iface->num_bss; i++) {
2431 struct hostapd_data *bss = iface->bss[i];
2436 if (bss->iface->state != HAPD_IFACE_ENABLED) {
2439 bss->conf->iface,
2440 hostapd_state_text(bss->iface->state));
2448 bss->conf->iface);
2458 static void hostapd_owe_update_trans(struct hostapd_iface *iface)
2463 if (!iface->interfaces ||
2464 !iface->interfaces->for_each_interface)
2465 hostapd_owe_iface_iter2(iface, NULL);
2467 iface->interfaces->for_each_interface(
2468 iface->interfaces, hostapd_owe_iface_iter2, NULL);
2476 struct hostapd_iface *iface = eloop_ctx;
2479 if (iface->num_bss < 1 || !iface->bss || !iface->bss[0])
2481 hapd = iface->bss[0];
2487 static int hostapd_setup_interface_complete_sync(struct hostapd_iface *iface,
2490 struct hostapd_data *hapd = iface->bss[0];
2500 if (iface->freq) {
2507 hostapd_hw_mode_txt(iface->conf->hw_mode),
2508 iface->conf->channel, iface->freq);
2512 if (!(iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)) {
2514 res = hostapd_handle_dfs(iface);
2522 res_dfs_offload = hostapd_handle_dfs_offload(iface);
2541 if (iface->mconf != NULL) {
2544 iface->bss[0]->conf->iface);
2550 hostapd_set_freq(hapd, hapd->iconf->hw_mode, iface->freq,
2570 if (iface->current_mode) {
2571 if (hostapd_prepare_rates(iface, iface->current_mode)) {
2599 for (j = 0; j < iface->num_bss; j++) {
2600 hapd = iface->bss[j];
2603 if (hostapd_setup_bss(hapd, j == 0, !iface->conf->mbssid)) {
2605 hapd = iface->bss[j];
2619 for (j = 0; hapd->iconf->mbssid && j < iface->num_bss; j++) {
2620 hapd = iface->bss[j];
2623 hapd = iface->bss[j];
2635 hapd = iface->bss[0];
2637 hostapd_tx_queue_params(iface);
2639 ap_list_init(iface);
2655 for (j = 0; j < iface->num_bss; j++) {
2656 if (hostapd_init_wps_complete(iface->bss[j]))
2660 if ((iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) &&
2679 iface->fst = fst_attach(hapd->conf->iface, hapd->own_addr,
2681 if (!iface->fst) {
2689 hostapd_set_state(iface, HAPD_IFACE_ENABLED);
2690 hostapd_owe_update_trans(iface);
2691 airtime_policy_update_init(iface);
2692 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, AP_EVENT_ENABLED);
2697 if (delay_apply_cfg && !iface->mconf) {
2704 iface->bss[0]->conf->iface);
2705 if (iface->interfaces && iface->interfaces->terminate_on_error > 0)
2706 iface->interfaces->terminate_on_error--;
2708 for (j = 0; j < iface->num_bss; j++)
2709 hostapd_neighbor_set_own_report(iface->bss[j]);
2711 if (iface->interfaces && iface->interfaces->count > 1)
2712 ieee802_11_set_beacons(iface);
2719 if (iface->is_no_ir) {
2720 hostapd_set_state(iface, HAPD_IFACE_NO_IR);
2725 hostapd_set_state(iface, HAPD_IFACE_DISABLED);
2728 if (iface->fst) {
2729 fst_detach(iface->fst);
2730 iface->fst = NULL;
2734 if (iface->interfaces && iface->interfaces->terminate_on_error) {
2738 * Calling hapd->setup_complete_cb directly may cause iface
2743 iface, NULL);
2758 int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err)
2760 struct hapd_interfaces *interfaces = iface->interfaces;
2761 struct hostapd_data *hapd = iface->bss[0];
2765 if (!iface->need_to_start_in_sync)
2766 return hostapd_setup_interface_complete_sync(iface, err);
2770 iface->need_to_start_in_sync = 0;
2772 if (iface->is_no_ir) {
2773 hostapd_set_state(iface, HAPD_IFACE_NO_IR);
2778 hostapd_set_state(iface, HAPD_IFACE_DISABLED);
2785 if (iface->ready_to_start_in_sync) {
2791 if (interfaces->iface[i]->need_to_start_in_sync &&
2792 !interfaces->iface[i]->ready_to_start_in_sync)
2800 if (not_ready_in_sync_ifaces > 1 && iface->state == HAPD_IFACE_DFS) {
2805 iface->need_to_start_in_sync = 0;
2808 iface->bss[0]->conf->iface);
2809 return hostapd_setup_interface_complete_sync(iface, err);
2814 iface->ready_to_start_in_sync = 1;
2817 iface->bss[0]->conf->iface);
2823 iface->bss[0]->conf->iface);
2824 iface->need_to_start_in_sync = 0;
2825 hostapd_setup_interface_complete_sync(iface, err);
2827 if (interfaces->iface[i]->need_to_start_in_sync &&
2828 interfaces->iface[i]->ready_to_start_in_sync) {
2830 interfaces->iface[i], 0);
2832 interfaces->iface[i]->need_to_start_in_sync = 0;
2842 * @iface: Pointer to interface data.
2856 int hostapd_setup_interface(struct hostapd_iface *iface)
2860 if (!iface->conf)
2862 ret = setup_interface(iface);
2865 iface->conf->bss[0]->iface);
2898 hapd->iface = hapd_iface;
2922 hapd->conf ? hapd->conf->iface : "N/A");
2937 void hostapd_interface_deinit(struct hostapd_iface *iface)
2941 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
2942 if (iface == NULL)
2945 hostapd_set_state(iface, HAPD_IFACE_DISABLED);
2947 eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
2948 iface->wait_channel_update = 0;
2949 iface->is_no_ir = false;
2952 if (iface->fst) {
2953 fst_detach(iface->fst);
2954 iface->fst = NULL;
2958 for (j = (int) iface->num_bss - 1; j >= 0; j--) {
2959 if (!iface->bss)
2961 hostapd_bss_deinit(iface->bss[j]);
2965 hostapd_stop_setup_timers(iface);
2966 eloop_cancel_timeout(ap_ht2040_timeout, iface, NULL);
3005 void hostapd_interface_free(struct hostapd_iface *iface)
3008 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
3009 for (j = 0; j < iface->num_bss; j++) {
3010 if (!iface->bss)
3013 if (iface->bss[j])
3014 hostapd_mld_ref_dec(iface->bss[j]->mld);
3017 __func__, iface->bss[j]);
3018 os_free(iface->bss[j]);
3020 hostapd_cleanup_iface(iface);
3065 if (!mld || os_strcmp(conf->iface, mld->name) != 0)
3081 os_strlcpy(mld->name, conf->iface, sizeof(conf->iface));
3246 wpa_printf(MSG_DEBUG, "%s: free iface %p",
3259 struct hostapd_iface *iface = interfaces->iface[i];
3260 for (j = 0; j < iface->num_bss; j++) {
3261 struct hostapd_data *hapd = iface->bss[j];
3262 if (os_strcmp(ifname, hapd->conf->iface) == 0)
3286 struct hostapd_iface *new_iface = NULL, *iface = NULL;
3295 if (os_strcmp(interfaces->iface[i]->phy, phy) == 0) {
3296 iface = interfaces->iface[i];
3302 config_fname, phy, iface ? "" : " --> new PHY");
3303 if (iface) {
3310 /* Add new BSS to existing iface */
3320 ifname = conf->bss[0]->iface;
3329 iface->conf->bss, iface->conf->num_bss + 1,
3331 tmp_bss = os_realloc_array(iface->bss, iface->num_bss + 1,
3334 iface->bss = tmp_bss;
3336 iface->conf->bss = tmp_conf;
3337 iface->conf->last_bss = tmp_conf[0];
3343 bss = iface->conf->bss[iface->conf->num_bss] = conf->bss[0];
3344 iface->conf->num_bss++;
3346 hapd = hostapd_alloc_bss_data(iface, iface->conf, bss);
3348 iface->conf->num_bss--;
3352 iface->conf->last_bss = bss;
3353 iface->bss[iface->num_bss] = hapd;
3358 bss_idx = iface->num_bss++;
3363 /* Add a new iface with the first BSS */
3364 new_iface = iface = hostapd_init(interfaces, config_fname);
3365 if (!iface)
3367 os_strlcpy(iface->phy, phy, sizeof(iface->phy));
3368 iface->interfaces = interfaces;
3373 if (iface->bss[bss_idx]->conf->logger_stdout_level > 0)
3374 iface->bss[bss_idx]->conf->logger_stdout_level--;
3377 if (iface->conf->bss[bss_idx]->iface[0] == '\0' &&
3378 !hostapd_drv_none(iface->bss[bss_idx])) {
3386 return iface;
3391 void *drv_priv, struct hostapd_iface *iface)
3401 if (!iface->bss[0]->conf->mld_ap) {
3403 } else if (hostapd_mld_is_first_bss(iface->bss[0]) &&
3405 !driver->is_drv_shared(drv_priv, iface->bss[0])) {
3407 } else if (hostapd_if_link_remove(iface->bss[0],
3409 iface->bss[0]->conf->iface,
3410 iface->bss[0]->mld_link_id)) {
3412 iface->bss[0]->conf->iface);
3417 iface->bss[0]->drv_priv = NULL;
3421 void hostapd_interface_deinit_free(struct hostapd_iface *iface)
3426 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
3427 if (iface == NULL)
3430 __func__, (unsigned int) iface->num_bss,
3431 (unsigned int) iface->conf->num_bss);
3432 driver = iface->bss[0]->driver;
3433 drv_priv = iface->bss[0]->drv_priv;
3434 hostapd_interface_deinit(iface);
3437 hostapd_cleanup_driver(driver, drv_priv, iface);
3438 hostapd_interface_free(iface);
3477 if (hapd_iface->interfaces->iface[j] == hapd_iface)
3480 ieee802_11_update_beacons(hapd_iface->interfaces->iface[j]);
3497 hapd_iface->conf->bss[0]->iface);
3502 hapd_iface->conf->bss[0]->iface);
3534 hapd_iface->conf->bss[0]->iface);
3552 wpa_printf(MSG_DEBUG, "Reload BSS %s", bss->conf->iface);
3578 hapd_iface->conf->bss[0]->iface);
3595 /* same as hostapd_interface_deinit without deinitializing ctrl-iface */
3611 hapd_iface->bss[0]->conf->iface);
3621 struct hostapd_iface **iface, *hapd_iface;
3623 iface = os_realloc_array(interfaces->iface, interfaces->count + 1,
3625 if (iface == NULL)
3627 interfaces->iface = iface;
3628 hapd_iface = interfaces->iface[interfaces->count] =
3682 os_strlcpy(bss->iface, ifname, sizeof(bss->iface));
3757 if (interfaces->iface[j] == hapd_iface)
3762 tmp = os_realloc_array(interfaces->iface,
3769 interfaces->iface = tmp;
3770 interfaces->iface[interfaces->count++] = hapd_iface;
3802 __func__, hapd, hapd->conf->iface);
3828 mld_ap = interfaces->iface[i]->conf->bss[0]->mld_ap;
3831 if (!os_strcmp(interfaces->iface[i]->conf->bss[0]->iface,
3850 os_strlcpy(conf->bss[0]->iface, buf,
3851 sizeof(conf->bss[0]->iface));
3877 hapd_iface->conf->bss[0]->iface);
3896 hapd->conf->iface);
3910 interfaces->iface[interfaces->count] = NULL;
3919 static int hostapd_remove_bss(struct hostapd_iface *iface, unsigned int idx)
3923 wpa_printf(MSG_INFO, "Remove BSS '%s'", iface->conf->bss[idx]->iface);
3926 if (idx < iface->num_bss) {
3927 struct hostapd_data *hapd = iface->bss[idx];
3931 __func__, hapd, hapd->conf->iface);
3939 iface->num_bss--;
3941 for (i = idx; i < iface->num_bss; i++)
3942 iface->bss[i] = iface->bss[i + 1];
3944 hostapd_config_free_bss(iface->conf->bss[idx]);
3945 iface->conf->bss[idx] = NULL;
3948 iface->conf->num_bss--;
3949 for (i = idx; i < iface->conf->num_bss; i++)
3950 iface->conf->bss[i] = iface->conf->bss[i + 1];
3962 hapd_iface = interfaces->iface[i];
3965 if (!os_strcmp(hapd_iface->conf->bss[0]->iface, buf)) {
3974 interfaces->iface[k] =
3975 interfaces->iface[k + 1];
3985 if (!os_strcmp(hapd_iface->conf->bss[j]->iface, buf)) {
4055 } else if (!(hapd->iface->drv_flags2 &
4062 if (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_WIRED) {
4067 hapd->conf->iface, __func__,
4070 } else if (!(hapd->iface->drv_flags &
4075 hapd->conf->iface, __func__, MAC2STR(sta->addr),
4117 void hostapd_set_state(struct hostapd_iface *iface, enum hostapd_iface_state s)
4120 iface->conf ? iface->conf->bss[0]->iface : "N/A",
4121 hostapd_state_text(iface->state), hostapd_state_text(s));
4122 iface->state = s;
4126 int hostapd_csa_in_progress(struct hostapd_iface *iface)
4130 for (i = 0; i < iface->num_bss; i++)
4131 if (iface->bss[i]->csa_in_progress)
4262 hostapd_determine_mode(hapd->iface);
4263 mode = hapd->iface->current_mode;
4347 struct hostapd_iface *iface = hapd->iface;
4356 if (!iface || !iface->freq || hapd->csa_in_progress)
4381 &hapd->iface->cs_oper_class,
4395 ret = hostapd_change_config_freq(iface->bss[0], iface->conf,
4402 old_punct_bitmap = iface->conf->punct_bitmap;
4403 iface->conf->punct_bitmap = settings->punct_bitmap;
4409 iface->conf->punct_bitmap = old_punct_bitmap;
4411 hostapd_change_config_freq(iface->bss[0], iface->conf,
4492 if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA)) {
4520 hostapd_switch_channel_fallback(struct hostapd_iface *iface,
4543 iface->conf->vht_capab |=
4551 iface->conf->vht_capab |= VHT_CAP_SUPP_CHAN_WIDTH_160MHZ;
4562 iface->freq = freq_params->freq;
4563 iface->conf->channel = freq_params->channel;
4564 iface->conf->secondary_channel = freq_params->sec_channel_offset;
4573 iface->conf->op_class = op_class;
4574 hostapd_set_oper_centr_freq_seg0_idx(iface->conf, seg0_idx);
4575 hostapd_set_oper_centr_freq_seg1_idx(iface->conf, seg1_idx);
4576 hostapd_set_oper_chwidth(iface->conf, bw);
4577 iface->conf->ieee80211n = freq_params->ht_enabled;
4578 iface->conf->ieee80211ac = freq_params->vht_enabled;
4579 iface->conf->ieee80211ax = freq_params->he_enabled;
4580 iface->conf->ieee80211be = freq_params->eht_enabled;
4587 hostapd_disable_iface(iface);
4588 hostapd_enable_iface(iface);
4607 struct hostapd_iface *iface = hapd->iface;
4611 if (!iface || iface->conf->he_op.he_bss_color_disabled)
4620 old_color = iface->conf->he_op.he_bss_color;
4621 iface->conf->he_op.he_bss_color = hapd->cca_color;
4626 iface->conf->he_op.he_bss_color = old_color;
4676 hapd->iface->conf->he_op.he_bss_color_disabled = 1;
4677 hapd->iface->conf->he_op.he_bss_color = os_random() % 63 + 1;
4678 for (b = 0; b < hapd->iface->num_bss; b++)
4679 ieee802_11_set_beacon(hapd->iface->bss[b]);
4683 for (b = 0; b < hapd->iface->num_bss; b++) {
4684 struct hostapd_data *bss = hapd->iface->bss[b];
4743 struct hostapd_iface *iface = interfaces->iface[i];
4745 for (j = 0; j < iface->num_bss; j++) {
4746 struct hostapd_data *hapd = iface->bss[j];
4748 if (os_strcmp(ifname, hapd->conf->iface) == 0)
4757 void hostapd_periodic_iface(struct hostapd_iface *iface)
4761 ap_list_timer(iface);
4763 for (i = 0; i < iface->num_bss; i++) {
4764 struct hostapd_data *hapd = iface->bss[i];
4803 struct hostapd_iface *iface;
4807 for (i = 0; i < hapd->iface->interfaces->count; i++) {
4808 iface = hapd->iface->interfaces->iface[i];
4809 if (!iface)
4812 for (j = 0; j < iface->num_bss; j++) {
4813 bss = iface->bss[j];
4837 return !os_strcmp(hapd1->conf->iface, hapd2->conf->iface);