Home | History | Annotate | Download | only in ap

Lines Matching refs:iface

52 static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd);
54 static int setup_interface2(struct hostapd_iface *iface);
59 int (*cb)(struct hostapd_iface *iface,
66 ret = cb(interfaces->iface[i], ctx);
101 hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 1);
103 hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 0);
121 hostapd_setup_encryption(hapd->conf->iface, hapd);
134 wpa_printf(MSG_DEBUG, "Reconfigured interface %s", hapd->conf->iface);
138 static void hostapd_clear_old(struct hostapd_iface *iface)
146 for (j = 0; j < iface->num_bss; j++) {
147 hostapd_flush_old_stations(iface->bss[j],
149 hostapd_broadcast_wep_clear(iface->bss[j]);
154 radius_client_flush(iface->bss[j]->radius, 0);
160 int hostapd_reload_config(struct hostapd_iface *iface)
162 struct hostapd_data *hapd = iface->bss[0];
166 if (iface->config_fname == NULL) {
168 hostapd_clear_old(iface);
169 for (j = 0; j < iface->num_bss; j++)
170 hostapd_reload_bss(iface->bss[j]);
174 if (iface->interfaces == NULL ||
175 iface->interfaces->config_read_cb == NULL)
177 newconf = iface->interfaces->config_read_cb(iface->config_fname);
181 hostapd_clear_old(iface);
184 iface->conf = newconf;
186 for (j = 0; j < iface->num_bss; j++) {
187 hapd = iface->bss[j];
245 hostapd_broadcast_key_clear_iface(hapd, hapd->conf->iface);
257 hostapd_drv_set_key(hapd->conf->iface,
284 __func__, hapd->conf->iface);
289 wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
309 if (hostapd_if_remove(hapd, WPA_IF_AP_BSS, hapd->conf->iface)) {
312 hapd->conf->iface);
363 hapd->conf->iface);
364 if (hapd->iface->interfaces &&
365 hapd->iface->interfaces->ctrl_iface_deinit) {
367 hapd->iface->interfaces->ctrl_iface_deinit(hapd);
373 static void sta_track_deinit(struct hostapd_iface *iface)
377 if (!iface->num_sta_seen)
380 while ((info = dl_list_first(&iface->sta_seen, struct hostapd_sta_info,
383 iface->num_sta_seen--;
389 static void hostapd_cleanup_iface_partial(struct hostapd_iface *iface)
391 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
394 hostapd_stop_setup_timers(iface);
397 hostapd_free_hw_features(iface->hw_features, iface->num_hw_features);
398 iface->hw_features = NULL;
399 os_free(iface->current_rates);
400 iface->current_rates = NULL;
401 os_free(iface->basic_rates);
402 iface->basic_rates = NULL;
403 ap_list_deinit(iface);
404 sta_track_deinit(iface);
410 * @iface: Pointer to interface data
415 static void hostapd_cleanup_iface(struct hostapd_iface *iface)
417 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
418 eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
420 hostapd_cleanup_iface_partial(iface);
421 hostapd_config_free(iface->conf);
422 iface->conf = NULL;
424 os_free(iface->config_fname);
425 os_free(iface->bss);
426 wpa_printf(MSG_DEBUG, "%s: free iface=%p", __func__, iface);
427 os_free(iface);
433 if (hapd->drv_priv && !hapd->iface->driver_ap_teardown) {
440 static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd)
459 hostapd_drv_set_key(iface, hapd, WPA_ALG_WEP, NULL, i,
484 if (!hapd->iface->driver_ap_teardown) {
513 * @iface: Pointer to interface data
518 static int hostapd_validate_bssid_configuration(struct hostapd_iface *iface)
521 struct hostapd_data *hapd = iface->bss[0];
522 unsigned int i = iface->conf->num_bss, bits = 0, j;
528 if (iface->conf->use_driver_iface_addr)
539 for (j = 0; j < iface->conf->num_bss; j++) {
540 if (is_zero_ether_addr(iface->conf->bss[j]->bssid)) {
548 iface->conf->bss[j]->bssid[i] ^
587 (unsigned long) iface->conf->num_bss, MAC2STR(mask), bits);
907 __func__, hapd, conf->iface, first);
918 __func__, conf->iface);
931 hapd->iface->bss[0]->own_addr) ==
935 "the radio", conf->iface);
948 if (hostapd_if_add(hapd->iface->bss[0], WPA_IF_AP_BSS,
949 conf->iface, addr, hapd,
972 if (hapd->iface->mconf == NULL)
982 if (hostapd_setup_encryption(conf->iface, hapd))
1016 conf->iface, MAC2STR(hapd->own_addr),
1153 static void hostapd_tx_queue_params(struct hostapd_iface *iface)
1155 struct hostapd_data *hapd = iface->bss[0];
1160 if (iface->mconf == NULL)
1165 p = &iface->conf->tx_queue[i];
1210 if (hapd->iface->drv_max_acl_mac_addrs == 0)
1237 if (!hapd->iface->interfaces ||
1238 !hapd->iface->interfaces->ctrl_iface_init)
1241 if (hapd->iface->interfaces->ctrl_iface_init(hapd)) {
1244 hapd->conf->iface);
1252 static int start_ctrl_iface(struct hostapd_iface *iface)
1256 if (!iface->interfaces || !iface->interfaces->ctrl_iface_init)
1259 for (i = 0; i < iface->num_bss; i++) {
1260 struct hostapd_data *hapd = iface->bss[i];
1261 if (iface->interfaces->ctrl_iface_init(hapd)) {
1264 hapd->conf->iface);
1275 struct hostapd_iface *iface = eloop_ctx;
1277 if (!iface->wait_channel_update) {
1287 setup_interface2(iface);
1291 void hostapd_channel_list_updated(struct hostapd_iface *iface, int initiator)
1293 if (!iface->wait_channel_update || initiator != REGDOM_SET_BY_USER)
1297 eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
1298 setup_interface2(iface);
1302 static int setup_interface(struct hostapd_iface *iface)
1304 iface->bss[0];
1314 iface->driver_ap_teardown = 0;
1316 if (!iface->phy[0]) {
1320 os_strlcpy(iface->phy, phy, sizeof(iface->phy));
1328 for (i = 1; i < iface->num_bss; i++) {
1329 iface->bss[i]->driver = hapd->driver;
1330 iface->bss[i]->drv_priv = hapd->drv_priv;
1333 if (hostapd_validate_bssid_configuration(iface))
1341 if (start_ctrl_iface(iface))
1347 hostapd_set_state(iface, HAPD_IFACE_COUNTRY_UPDATE);
1363 iface->wait_channel_update = 1;
1366 iface, NULL);
1371 return setup_interface2(iface);
1375 static int setup_interface2(struct hostapd_iface *iface)
1377 iface->wait_channel_update = 0;
1379 if (hostapd_get_hw_features(iface)) {
1383 int ret = hostapd_select_hw_mode(iface);
1393 ret = hostapd_check_ht_capab(iface);
1402 if (iface->conf->ieee80211h)
1405 return hostapd_setup_interface_complete(iface, 0);
1408 hostapd_set_state(iface, HAPD_IFACE_DISABLED);
1409 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, AP_EVENT_DISABLED);
1410 if (iface->interfaces && iface->interfaces->terminate_on_error)
1432 *hw_mode = ieee80211_freq_to_chan(hapd->iface->freq, channel);
1440 if (hapd->iface->fst_ies != fst_ies) {
1441 hapd->iface->fst_ies = fst_ies;
1453 return hostapd_drv_send_action(hapd, hapd->iface->freq, 0, da,
1593 (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_UAPSD))
1608 if (ieee80211_freq_to_channel_ext(hapd->iface->freq,
1621 ieee80211_freq_to_chan(hapd->iface->freq +
1641 wpabuf_put_u8(nr, ieee80211_get_phy_type(hapd->iface->freq, ht, vht));
1662 static int hostapd_setup_interface_complete_sync(struct hostapd_iface *iface,
1665 struct hostapd_data *hapd = iface->bss[0];
1675 if (iface->conf->channel) {
1680 iface->freq = hostapd_hw_get_freq(hapd, iface->conf->channel);
1683 hostapd_hw_mode_txt(iface->conf->hw_mode),
1684 iface->conf->channel, iface->freq);
1688 if (!(iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)) {
1690 res = hostapd_handle_dfs(iface);
1698 res_dfs_offload = hostapd_handle_dfs_offload(iface);
1717 if (iface->mconf != NULL) {
1720 iface->bss[0]->conf->iface);
1726 hostapd_set_freq(hapd, hapd->iconf->hw_mode, iface->freq,
1740 if (iface->current_mode) {
1741 if (hostapd_prepare_rates(iface, iface->current_mode)) {
1767 for (j = 0; j < iface->num_bss; j++) {
1768 hapd = iface->bss[j];
1773 hapd = iface->bss[j];
1782 hapd = iface->bss[0];
1784 hostapd_tx_queue_params(iface);
1786 ap_list_init(iface);
1802 for (j = 0; j < iface->num_bss; j++) {
1803 if (hostapd_init_wps_complete(iface->bss[j]))
1807 if ((iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) &&
1826 iface->fst = fst_attach(hapd->conf->iface, hapd->own_addr,
1828 if (!iface->fst) {
1836 hostapd_set_state(iface, HAPD_IFACE_ENABLED);
1837 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, AP_EVENT_ENABLED);
1842 iface->bss[0]->conf->iface);
1843 if (iface->interfaces && iface->interfaces->terminate_on_error > 0)
1844 iface->interfaces->terminate_on_error--;
1846 for (j = 0; j < iface->num_bss; j++)
1847 hostapd_set_own_neighbor_report(iface->bss[j]);
1853 hostapd_set_state(iface, HAPD_IFACE_DISABLED);
1856 if (iface->fst) {
1857 fst_detach(iface->fst);
1858 iface->fst = NULL;
1861 if (iface->interfaces && iface->interfaces->terminate_on_error)
1875 int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err)
1877 struct hapd_interfaces *interfaces = iface->interfaces;
1878 struct hostapd_data *hapd = iface->bss[0];
1882 if (!iface->need_to_start_in_sync)
1883 return hostapd_setup_interface_complete_sync(iface, err);
1887 hostapd_set_state(iface, HAPD_IFACE_DISABLED);
1888 iface->need_to_start_in_sync = 0;
1895 if (iface->ready_to_start_in_sync) {
1901 if (interfaces->iface[i]->need_to_start_in_sync &&
1902 !interfaces->iface[i]->ready_to_start_in_sync)
1910 iface->state == HAPD_IFACE_DFS) {
1915 iface->need_to_start_in_sync = 0;
1918 iface->bss[0]->conf->iface);
1919 return hostapd_setup_interface_complete_sync(iface, err);
1924 iface->ready_to_start_in_sync = 1;
1927 iface->bss[0]->conf->iface);
1933 iface->bss[0]->conf->iface);
1934 iface->need_to_start_in_sync = 0;
1935 hostapd_setup_interface_complete_sync(iface, err);
1937 if (interfaces->iface[i]->need_to_start_in_sync &&
1938 interfaces->iface[i]->ready_to_start_in_sync) {
1940 interfaces->iface[i], 0);
1942 interfaces->iface[i]->need_to_start_in_sync = 0;
1952 * @iface: Pointer to interface data.
1966 int hostapd_setup_interface(struct hostapd_iface *iface)
1970 ret = setup_interface(iface);
1973 iface->bss[0]->conf->iface);
2006 hapd->iface = hapd_iface;
2023 hapd->conf->iface);
2030 void hostapd_interface_deinit(struct hostapd_iface *iface)
2034 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
2035 if (iface == NULL)
2038 hostapd_set_state(iface, HAPD_IFACE_DISABLED);
2042 hostapd_stop_setup_timers(iface);
2043 eloop_cancel_timeout(ap_ht2040_timeout, iface, NULL);
2046 eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
2047 iface->wait_channel_update = 0;
2050 if (iface->fst) {
2051 fst_detach(iface->fst);
2052 iface->fst = NULL;
2056 for (j = iface->num_bss - 1; j >= 0; j--) {
2057 if (!iface->bss)
2059 hostapd_bss_deinit(iface->bss[j]);
2064 void hostapd_interface_free(struct hostapd_iface *iface)
2067 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
2068 for (j = 0; j < iface->num_bss; j++) {
2069 if (!iface->bss)
2072 __func__, iface->bss[j]);
2073 os_free(iface->bss[j]);
2075 hostapd_cleanup_iface(iface);
2148 wpa_printf(MSG_DEBUG, "%s: free iface %p",
2161 struct hostapd_iface *iface = interfaces->iface[i];
2162 for (j = 0; j < iface->num_bss; j++) {
2163 struct hostapd_data *hapd = iface->bss[j];
2164 if (os_strcmp(ifname, hapd->conf->iface) == 0)
2188 struct hostapd_iface *new_iface = NULL, *iface = NULL;
2197 if (os_strcmp(interfaces->iface[i]->phy, phy) == 0) {
2198 iface = interfaces->iface[i];
2204 config_fname, phy, iface ? "" : " --> new PHY");
2205 if (iface) {
2212 /* Add new BSS to existing iface */
2222 ifname = conf->bss[0]->iface;
2231 iface->conf->bss, iface->conf->num_bss + 1,
2233 tmp_bss = os_realloc_array(iface->bss, iface->num_bss + 1,
2236 iface->bss = tmp_bss;
2238 iface->conf->bss = tmp_conf;
2239 iface->conf->last_bss = tmp_conf[0];
2245 bss = iface->conf->bss[iface->conf->num_bss] = conf->bss[0];
2246 iface->conf->num_bss++;
2248 hapd = hostapd_alloc_bss_data(iface, iface->conf, bss);
2250 iface->conf->num_bss--;
2254 iface->conf->last_bss = bss;
2255 iface->bss[iface->num_bss] = hapd;
2258 bss_idx = iface->num_bss++;
2263 /* Add a new iface with the first BSS */
2264 new_iface = iface = hostapd_init(interfaces, config_fname);
2265 if (!iface)
2267 os_strlcpy(iface->phy, phy, sizeof(iface->phy));
2268 iface->interfaces = interfaces;
2273 if (iface->bss[bss_idx]->conf->logger_stdout_level > 0)
2274 iface->bss[bss_idx]->conf->logger_stdout_level--;
2277 if (iface->conf->bss[bss_idx]->iface[0] == '\0' &&
2278 !hostapd_drv_none(iface->bss[bss_idx])) {
2286 return iface;
2290 void hostapd_interface_deinit_free(struct hostapd_iface *iface)
2295 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
2296 if (iface == NULL)
2299 __func__, (unsigned int) iface->num_bss,
2300 (unsigned int) iface->conf->num_bss);
2301 driver = iface->bss[0]->driver;
2302 drv_priv = iface->bss[0]->drv_priv;
2303 hostapd_interface_deinit(iface);
2308 iface->bss[0]->drv_priv = NULL;
2310 hostapd_interface_free(iface);
2341 hapd_iface->conf->bss[0]->iface);
2346 hapd_iface->conf->bss[0]->iface);
2376 hapd_iface->conf->bss[0]->iface);
2402 hapd_iface->conf->bss[0]->iface);
2414 /* same as hostapd_interface_deinit without deinitializing ctrl-iface */
2429 hapd_iface->bss[0]->conf->iface);
2438 struct hostapd_iface **iface, *hapd_iface;
2440 iface = os_realloc_array(interfaces->iface, interfaces->count + 1,
2442 if (iface == NULL)
2444 interfaces->iface = iface;
2445 hapd_iface = interfaces->iface[interfaces->count] =
2499 os_strlcpy(bss->iface, ifname, sizeof(bss->iface));
2573 if (interfaces->iface[j] == hapd_iface)
2578 tmp = os_realloc_array(interfaces->iface,
2585 interfaces->iface = tmp;
2586 interfaces->iface[interfaces->count++] = hapd_iface;
2617 __func__, hapd, hapd->conf->iface);
2636 if (!os_strcmp(interfaces->iface[i]->conf->bss[0]->iface,
2655 os_strlcpy(conf->bss[0]->iface, buf,
2656 sizeof(conf->bss[0]->iface));
2682 hapd_iface->conf->bss[0]->iface);
2701 hapd->conf->iface);
2711 interfaces->iface[interfaces->count] = NULL;
2719 static int hostapd_remove_bss(struct hostapd_iface *iface, unsigned int idx)
2723 wpa_printf(MSG_INFO, "Remove BSS '%s'", iface->conf->bss[idx]->iface);
2726 if (idx < iface->num_bss) {
2727 struct hostapd_data *hapd = iface->bss[idx];
2731 __func__, hapd, hapd->conf->iface);
2736 iface->num_bss--;
2738 for (i = idx; i < iface->num_bss; i++)
2739 iface->bss[i] = iface->bss[i + 1];
2741 hostapd_config_free_bss(iface->conf->bss[idx]);
2742 iface->conf->bss[idx] = NULL;
2745 iface->conf->num_bss--;
2746 for (i = idx; i < iface->conf->num_bss; i++)
2747 iface->conf->bss[i] = iface->conf->bss[i + 1];
2759 hapd_iface = interfaces->iface[i];
2762 if (!os_strcmp(hapd_iface->conf->bss[0]->iface, buf)) {
2771 interfaces->iface[k] =
2772 interfaces->iface[k + 1];
2780 if (!os_strcmp(hapd_iface->conf->bss[j]->iface, buf)) {
2846 if (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_WIRED) {
2851 hapd->conf->iface, __func__,
2854 } else if (!(hapd->iface->drv_flags &
2859 hapd->conf->iface, __func__, MAC2STR(sta->addr),
2891 void hostapd_set_state(struct hostapd_iface *iface, enum hostapd_iface_state s)
2894 iface->conf ? iface->conf->bss[0]->iface : "N/A",
2895 hostapd_state_text(iface->state), hostapd_state_text(s));
2896 iface->state = s;
2900 int hostapd_csa_in_progress(struct hostapd_iface *iface)
2904 for (i = 0; i < iface->num_bss; i++)
2905 if (iface->bss[i]->csa_in_progress)
3091 struct hostapd_iface *iface = hapd->iface;
3097 if (!iface || !iface->freq || hapd->csa_in_progress)
3119 &hapd->iface->cs_oper_class,
3131 ret = hostapd_change_config_freq(iface->bss[0], iface->conf,
3140 hostapd_change_config_freq(iface->bss[0], iface->conf,
3184 if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA)) {
3209 hostapd_switch_channel_fallback(struct hostapd_iface *iface,
3243 iface->freq = freq_params->freq;
3244 iface->conf->channel = freq_params->channel;
3245 iface->conf->secondary_channel = freq_params->sec_channel_offset;
3246 iface->conf->vht_oper_centr_freq_seg0_idx = vht_seg0_idx;
3247 iface->conf->vht_oper_centr_freq_seg1_idx = vht_seg1_idx;
3248 iface->conf->vht_oper_chwidth = vht_bw;
3249 iface->conf->ieee80211n = freq_params->ht_enabled;
3250 iface->conf->ieee80211ac = freq_params->vht_enabled;
3256 for (i = 0; i < iface->num_bss; i++)
3257 hostapd_cleanup_cs_params(iface->bss[i]);
3259 hostapd_disable_iface(iface);
3260 hostapd_enable_iface(iface);
3272 struct hostapd_iface *iface = interfaces->iface[i];
3274 for (j = 0; j < iface->num_bss; j++) {
3275 struct hostapd_data *hapd = iface->bss[j];
3277 if (os_strcmp(ifname, hapd->conf->iface) == 0)
3286 void hostapd_periodic_iface(struct hostapd_iface *iface)
3290 ap_list_timer(iface);
3292 for (i = 0; i < iface->num_bss; i++) {
3293 struct hostapd_data *hapd = iface->bss[i];