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