Lines Matching refs:iface
41 static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd);
43 static int setup_interface2(struct hostapd_iface *iface);
48 int (*cb)(struct hostapd_iface *iface, in hostapd_for_each_interface() argument
55 ret = cb(interfaces->iface[i], ctx); in hostapd_for_each_interface()
88 hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 1); in hostapd_reload_bss()
90 hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 0); in hostapd_reload_bss()
108 hostapd_setup_encryption(hapd->conf->iface, hapd); in hostapd_reload_bss()
121 wpa_printf(MSG_DEBUG, "Reconfigured interface %s", hapd->conf->iface); in hostapd_reload_bss()
125 static void hostapd_clear_old(struct hostapd_iface *iface) in hostapd_clear_old() argument
133 for (j = 0; j < iface->num_bss; j++) { in hostapd_clear_old()
134 hostapd_flush_old_stations(iface->bss[j], in hostapd_clear_old()
136 hostapd_broadcast_wep_clear(iface->bss[j]); in hostapd_clear_old()
141 radius_client_flush(iface->bss[j]->radius, 0); in hostapd_clear_old()
147 int hostapd_reload_config(struct hostapd_iface *iface) in hostapd_reload_config() argument
149 struct hostapd_data *hapd = iface->bss[0]; in hostapd_reload_config()
153 if (iface->config_fname == NULL) { in hostapd_reload_config()
155 hostapd_clear_old(iface); in hostapd_reload_config()
156 for (j = 0; j < iface->num_bss; j++) in hostapd_reload_config()
157 hostapd_reload_bss(iface->bss[j]); in hostapd_reload_config()
161 if (iface->interfaces == NULL || in hostapd_reload_config()
162 iface->interfaces->config_read_cb == NULL) in hostapd_reload_config()
164 newconf = iface->interfaces->config_read_cb(iface->config_fname); in hostapd_reload_config()
168 hostapd_clear_old(iface); in hostapd_reload_config()
171 iface->conf = newconf; in hostapd_reload_config()
173 for (j = 0; j < iface->num_bss; j++) { in hostapd_reload_config()
174 hapd = iface->bss[j]; in hostapd_reload_config()
229 hostapd_broadcast_key_clear_iface(hapd, hapd->conf->iface); in hostapd_broadcast_wep_clear()
241 hostapd_drv_set_key(hapd->conf->iface, in hostapd_broadcast_wep_set()
257 __func__, hapd->conf->iface); in hostapd_free_hapd_data()
262 wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface); in hostapd_free_hapd_data()
282 if (hostapd_if_remove(hapd, WPA_IF_AP_BSS, hapd->conf->iface)) { in hostapd_free_hapd_data()
285 hapd->conf->iface); in hostapd_free_hapd_data()
333 hapd->conf->iface); in hostapd_cleanup()
334 if (hapd->iface->interfaces && in hostapd_cleanup()
335 hapd->iface->interfaces->ctrl_iface_deinit) in hostapd_cleanup()
336 hapd->iface->interfaces->ctrl_iface_deinit(hapd); in hostapd_cleanup()
341 static void hostapd_cleanup_iface_partial(struct hostapd_iface *iface) in hostapd_cleanup_iface_partial() argument
343 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); in hostapd_cleanup_iface_partial()
344 hostapd_free_hw_features(iface->hw_features, iface->num_hw_features); in hostapd_cleanup_iface_partial()
345 iface->hw_features = NULL; in hostapd_cleanup_iface_partial()
346 os_free(iface->current_rates); in hostapd_cleanup_iface_partial()
347 iface->current_rates = NULL; in hostapd_cleanup_iface_partial()
348 os_free(iface->basic_rates); in hostapd_cleanup_iface_partial()
349 iface->basic_rates = NULL; in hostapd_cleanup_iface_partial()
350 ap_list_deinit(iface); in hostapd_cleanup_iface_partial()
361 static void hostapd_cleanup_iface(struct hostapd_iface *iface) in hostapd_cleanup_iface() argument
363 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); in hostapd_cleanup_iface()
364 eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); in hostapd_cleanup_iface()
366 hostapd_cleanup_iface_partial(iface); in hostapd_cleanup_iface()
367 hostapd_config_free(iface->conf); in hostapd_cleanup_iface()
368 iface->conf = NULL; in hostapd_cleanup_iface()
370 os_free(iface->config_fname); in hostapd_cleanup_iface()
371 os_free(iface->bss); in hostapd_cleanup_iface()
372 wpa_printf(MSG_DEBUG, "%s: free iface=%p", __func__, iface); in hostapd_cleanup_iface()
373 os_free(iface); in hostapd_cleanup_iface()
379 if (hapd->drv_priv && !hapd->iface->driver_ap_teardown) { in hostapd_clear_wep()
386 static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd) in hostapd_setup_encryption() argument
405 hostapd_drv_set_key(iface, hapd, WPA_ALG_WEP, NULL, i, in hostapd_setup_encryption()
430 if (!hapd->iface->driver_ap_teardown) { in hostapd_flush_old_stations()
464 static int hostapd_validate_bssid_configuration(struct hostapd_iface *iface) in hostapd_validate_bssid_configuration() argument
467 struct hostapd_data *hapd = iface->bss[0]; in hostapd_validate_bssid_configuration()
468 unsigned int i = iface->conf->num_bss, bits = 0, j; in hostapd_validate_bssid_configuration()
482 for (j = 0; j < iface->conf->num_bss; j++) { in hostapd_validate_bssid_configuration()
483 if (hostapd_mac_comp_empty(iface->conf->bss[j]->bssid) == 0) { in hostapd_validate_bssid_configuration()
491 iface->conf->bss[j]->bssid[i] ^ in hostapd_validate_bssid_configuration()
530 (unsigned long) iface->conf->num_bss, MAC2STR(mask), bits); in hostapd_validate_bssid_configuration()
696 __func__, hapd, conf->iface, first); in hostapd_setup_bss()
707 __func__, conf->iface); in hostapd_setup_bss()
723 hapd->iface->bss[0]->own_addr) == in hostapd_setup_bss()
727 "the radio", conf->iface); in hostapd_setup_bss()
733 if (hostapd_if_add(hapd->iface->bss[0], WPA_IF_AP_BSS, in hostapd_setup_bss()
734 conf->iface, hapd->own_addr, hapd, in hostapd_setup_bss()
752 if (hostapd_setup_encryption(conf->iface, hapd)) in hostapd_setup_bss()
786 conf->iface, MAC2STR(hapd->own_addr), in hostapd_setup_bss()
896 static void hostapd_tx_queue_params(struct hostapd_iface *iface) in hostapd_tx_queue_params() argument
898 struct hostapd_data *hapd = iface->bss[0]; in hostapd_tx_queue_params()
903 p = &iface->conf->tx_queue[i]; in hostapd_tx_queue_params()
948 if (hapd->iface->drv_max_acl_mac_addrs == 0) in hostapd_set_acl()
975 if (!hapd->iface->interfaces || in start_ctrl_iface_bss()
976 !hapd->iface->interfaces->ctrl_iface_init) in start_ctrl_iface_bss()
979 if (hapd->iface->interfaces->ctrl_iface_init(hapd)) { in start_ctrl_iface_bss()
982 hapd->conf->iface); in start_ctrl_iface_bss()
990 static int start_ctrl_iface(struct hostapd_iface *iface) in start_ctrl_iface() argument
994 if (!iface->interfaces || !iface->interfaces->ctrl_iface_init) in start_ctrl_iface()
997 for (i = 0; i < iface->num_bss; i++) { in start_ctrl_iface()
998 struct hostapd_data *hapd = iface->bss[i]; in start_ctrl_iface()
999 if (iface->interfaces->ctrl_iface_init(hapd)) { in start_ctrl_iface()
1002 hapd->conf->iface); in start_ctrl_iface()
1013 struct hostapd_iface *iface = eloop_ctx; in channel_list_update_timeout() local
1015 if (!iface->wait_channel_update) { in channel_list_update_timeout()
1025 setup_interface2(iface); in channel_list_update_timeout()
1029 void hostapd_channel_list_updated(struct hostapd_iface *iface, int initiator) in hostapd_channel_list_updated() argument
1031 if (!iface->wait_channel_update || initiator != REGDOM_SET_BY_USER) in hostapd_channel_list_updated()
1035 eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); in hostapd_channel_list_updated()
1036 setup_interface2(iface); in hostapd_channel_list_updated()
1040 static int setup_interface(struct hostapd_iface *iface) in setup_interface() argument
1042 struct hostapd_data *hapd = iface->bss[0]; in setup_interface()
1052 iface->driver_ap_teardown = 0; in setup_interface()
1054 if (!iface->phy[0]) { in setup_interface()
1058 os_strlcpy(iface->phy, phy, sizeof(iface->phy)); in setup_interface()
1066 for (i = 1; i < iface->num_bss; i++) { in setup_interface()
1067 iface->bss[i]->driver = hapd->driver; in setup_interface()
1068 iface->bss[i]->drv_priv = hapd->drv_priv; in setup_interface()
1071 if (hostapd_validate_bssid_configuration(iface)) in setup_interface()
1079 if (start_ctrl_iface(iface)) in setup_interface()
1085 hostapd_set_state(iface, HAPD_IFACE_COUNTRY_UPDATE); in setup_interface()
1101 iface->wait_channel_update = 1; in setup_interface()
1104 iface, NULL); in setup_interface()
1109 return setup_interface2(iface); in setup_interface()
1113 static int setup_interface2(struct hostapd_iface *iface) in setup_interface2() argument
1115 iface->wait_channel_update = 0; in setup_interface2()
1117 if (hostapd_get_hw_features(iface)) { in setup_interface2()
1121 int ret = hostapd_select_hw_mode(iface); in setup_interface2()
1131 ret = hostapd_check_ht_capab(iface); in setup_interface2()
1140 if (iface->conf->ieee80211h) in setup_interface2()
1143 return hostapd_setup_interface_complete(iface, 0); in setup_interface2()
1146 hostapd_set_state(iface, HAPD_IFACE_DISABLED); in setup_interface2()
1147 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, AP_EVENT_DISABLED); in setup_interface2()
1148 if (iface->interfaces && iface->interfaces->terminate_on_error) in setup_interface2()
1162 int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err) in hostapd_setup_interface_complete() argument
1164 struct hostapd_data *hapd = iface->bss[0]; in hostapd_setup_interface_complete()
1172 if (iface->conf->channel) { in hostapd_setup_interface_complete()
1177 iface->freq = hostapd_hw_get_freq(hapd, iface->conf->channel); in hostapd_setup_interface_complete()
1180 hostapd_hw_mode_txt(iface->conf->hw_mode), in hostapd_setup_interface_complete()
1181 iface->conf->channel, iface->freq); in hostapd_setup_interface_complete()
1185 if (!(iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)) { in hostapd_setup_interface_complete()
1187 res = hostapd_handle_dfs(iface); in hostapd_setup_interface_complete()
1196 if (hostapd_set_freq(hapd, hapd->iconf->hw_mode, iface->freq, in hostapd_setup_interface_complete()
1210 if (iface->current_mode) { in hostapd_setup_interface_complete()
1211 if (hostapd_prepare_rates(iface, iface->current_mode)) { in hostapd_setup_interface_complete()
1237 for (j = 0; j < iface->num_bss; j++) { in hostapd_setup_interface_complete()
1238 hapd = iface->bss[j]; in hostapd_setup_interface_complete()
1243 hapd = iface->bss[j]; in hostapd_setup_interface_complete()
1252 hapd = iface->bss[0]; in hostapd_setup_interface_complete()
1254 hostapd_tx_queue_params(iface); in hostapd_setup_interface_complete()
1256 ap_list_init(iface); in hostapd_setup_interface_complete()
1272 for (j = 0; j < iface->num_bss; j++) { in hostapd_setup_interface_complete()
1273 if (hostapd_init_wps_complete(iface->bss[j])) in hostapd_setup_interface_complete()
1277 hostapd_set_state(iface, HAPD_IFACE_ENABLED); in hostapd_setup_interface_complete()
1278 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, AP_EVENT_ENABLED); in hostapd_setup_interface_complete()
1283 iface->bss[0]->conf->iface); in hostapd_setup_interface_complete()
1284 if (iface->interfaces && iface->interfaces->terminate_on_error > 0) in hostapd_setup_interface_complete()
1285 iface->interfaces->terminate_on_error--; in hostapd_setup_interface_complete()
1291 hostapd_set_state(iface, HAPD_IFACE_DISABLED); in hostapd_setup_interface_complete()
1293 if (iface->interfaces && iface->interfaces->terminate_on_error) in hostapd_setup_interface_complete()
1315 int hostapd_setup_interface(struct hostapd_iface *iface) in hostapd_setup_interface() argument
1319 ret = setup_interface(iface); in hostapd_setup_interface()
1322 iface->bss[0]->conf->iface); in hostapd_setup_interface()
1355 hapd->iface = hapd_iface; in hostapd_alloc_bss_data()
1366 hapd->conf->iface); in hostapd_bss_deinit()
1372 void hostapd_interface_deinit(struct hostapd_iface *iface) in hostapd_interface_deinit() argument
1376 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); in hostapd_interface_deinit()
1377 if (iface == NULL) in hostapd_interface_deinit()
1382 hostapd_stop_setup_timers(iface); in hostapd_interface_deinit()
1383 eloop_cancel_timeout(ap_ht2040_timeout, iface, NULL); in hostapd_interface_deinit()
1386 eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); in hostapd_interface_deinit()
1387 iface->wait_channel_update = 0; in hostapd_interface_deinit()
1389 for (j = iface->num_bss - 1; j >= 0; j--) in hostapd_interface_deinit()
1390 hostapd_bss_deinit(iface->bss[j]); in hostapd_interface_deinit()
1394 void hostapd_interface_free(struct hostapd_iface *iface) in hostapd_interface_free() argument
1397 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); in hostapd_interface_free()
1398 for (j = 0; j < iface->num_bss; j++) { in hostapd_interface_free()
1400 __func__, iface->bss[j]); in hostapd_interface_free()
1401 os_free(iface->bss[j]); in hostapd_interface_free()
1403 hostapd_cleanup_iface(iface); in hostapd_interface_free()
1475 struct hostapd_iface *iface = interfaces->iface[i]; in ifname_in_use() local
1476 for (j = 0; j < iface->num_bss; j++) { in ifname_in_use()
1477 struct hostapd_data *hapd = iface->bss[j]; in ifname_in_use()
1478 if (os_strcmp(ifname, hapd->conf->iface) == 0) in ifname_in_use()
1502 struct hostapd_iface *new_iface = NULL, *iface = NULL; in hostapd_interface_init_bss() local
1511 if (os_strcmp(interfaces->iface[i]->phy, phy) == 0) { in hostapd_interface_init_bss()
1512 iface = interfaces->iface[i]; in hostapd_interface_init_bss()
1518 config_fname, phy, iface ? "" : " --> new PHY"); in hostapd_interface_init_bss()
1519 if (iface) { in hostapd_interface_init_bss()
1536 ifname = conf->bss[0]->iface; in hostapd_interface_init_bss()
1545 iface->conf->bss, iface->conf->num_bss + 1, in hostapd_interface_init_bss()
1547 tmp_bss = os_realloc_array(iface->bss, iface->num_bss + 1, in hostapd_interface_init_bss()
1550 iface->bss = tmp_bss; in hostapd_interface_init_bss()
1552 iface->conf->bss = tmp_conf; in hostapd_interface_init_bss()
1553 iface->conf->last_bss = tmp_conf[0]; in hostapd_interface_init_bss()
1559 bss = iface->conf->bss[iface->conf->num_bss] = conf->bss[0]; in hostapd_interface_init_bss()
1560 iface->conf->num_bss++; in hostapd_interface_init_bss()
1562 hapd = hostapd_alloc_bss_data(iface, iface->conf, bss); in hostapd_interface_init_bss()
1564 iface->conf->num_bss--; in hostapd_interface_init_bss()
1568 iface->conf->last_bss = bss; in hostapd_interface_init_bss()
1569 iface->bss[iface->num_bss] = hapd; in hostapd_interface_init_bss()
1572 bss_idx = iface->num_bss++; in hostapd_interface_init_bss()
1578 new_iface = iface = hostapd_init(interfaces, config_fname); in hostapd_interface_init_bss()
1579 if (!iface) in hostapd_interface_init_bss()
1581 os_strlcpy(iface->phy, phy, sizeof(iface->phy)); in hostapd_interface_init_bss()
1582 iface->interfaces = interfaces; in hostapd_interface_init_bss()
1587 if (iface->bss[bss_idx]->conf->logger_stdout_level > 0) in hostapd_interface_init_bss()
1588 iface->bss[bss_idx]->conf->logger_stdout_level--; in hostapd_interface_init_bss()
1591 if (iface->conf->bss[bss_idx]->iface[0] == '\0' && in hostapd_interface_init_bss()
1592 !hostapd_drv_none(iface->bss[bss_idx])) { in hostapd_interface_init_bss()
1600 return iface; in hostapd_interface_init_bss()
1604 void hostapd_interface_deinit_free(struct hostapd_iface *iface) in hostapd_interface_deinit_free() argument
1609 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface); in hostapd_interface_deinit_free()
1610 if (iface == NULL) in hostapd_interface_deinit_free()
1613 __func__, (unsigned int) iface->num_bss, in hostapd_interface_deinit_free()
1614 (unsigned int) iface->conf->num_bss); in hostapd_interface_deinit_free()
1615 driver = iface->bss[0]->driver; in hostapd_interface_deinit_free()
1616 drv_priv = iface->bss[0]->drv_priv; in hostapd_interface_deinit_free()
1617 hostapd_interface_deinit(iface); in hostapd_interface_deinit_free()
1622 iface->bss[0]->drv_priv = NULL; in hostapd_interface_deinit_free()
1624 hostapd_interface_free(iface); in hostapd_interface_deinit_free()
1655 hapd_iface->conf->bss[0]->iface); in hostapd_enable_iface()
1660 hapd_iface->conf->bss[0]->iface); in hostapd_enable_iface()
1690 hapd_iface->conf->bss[0]->iface); in hostapd_reload_iface()
1716 hapd_iface->conf->bss[0]->iface); in hostapd_disable_iface()
1743 hapd_iface->bss[0]->conf->iface); in hostapd_disable_iface()
1752 struct hostapd_iface **iface, *hapd_iface; in hostapd_iface_alloc() local
1754 iface = os_realloc_array(interfaces->iface, interfaces->count + 1, in hostapd_iface_alloc()
1756 if (iface == NULL) in hostapd_iface_alloc()
1758 interfaces->iface = iface; in hostapd_iface_alloc()
1759 hapd_iface = interfaces->iface[interfaces->count] = in hostapd_iface_alloc()
1797 os_strlcpy(bss->iface, ifname, sizeof(bss->iface)); in hostapd_config_alloc()
1817 interfaces->iface[interfaces->count - 1]; in hostapd_data_alloc()
1867 if (interfaces->iface[j] == hapd_iface) in hostapd_add_iface()
1872 tmp = os_realloc_array(interfaces->iface, in hostapd_add_iface()
1879 interfaces->iface = tmp; in hostapd_add_iface()
1880 interfaces->iface[interfaces->count++] = hapd_iface; in hostapd_add_iface()
1906 __func__, hapd, hapd->conf->iface); in hostapd_add_iface()
1923 if (!os_strcmp(interfaces->iface[i]->conf->bss[0]->iface, in hostapd_add_iface()
1941 os_strlcpy(conf->bss[0]->iface, buf, in hostapd_add_iface()
1942 sizeof(conf->bss[0]->iface)); in hostapd_add_iface()
1961 wpa_printf(MSG_INFO, "Add interface '%s'", conf->bss[0]->iface); in hostapd_add_iface()
1980 hapd->conf->iface); in hostapd_add_iface()
1994 static int hostapd_remove_bss(struct hostapd_iface *iface, unsigned int idx) in hostapd_remove_bss() argument
1998 wpa_printf(MSG_INFO, "Remove BSS '%s'", iface->conf->bss[idx]->iface); in hostapd_remove_bss()
2001 if (idx < iface->num_bss) { in hostapd_remove_bss()
2002 struct hostapd_data *hapd = iface->bss[idx]; in hostapd_remove_bss()
2006 __func__, hapd, hapd->conf->iface); in hostapd_remove_bss()
2010 iface->num_bss--; in hostapd_remove_bss()
2012 for (i = idx; i < iface->num_bss; i++) in hostapd_remove_bss()
2013 iface->bss[i] = iface->bss[i + 1]; in hostapd_remove_bss()
2015 hostapd_config_free_bss(iface->conf->bss[idx]); in hostapd_remove_bss()
2016 iface->conf->bss[idx] = NULL; in hostapd_remove_bss()
2019 iface->conf->num_bss--; in hostapd_remove_bss()
2020 for (i = idx; i < iface->conf->num_bss; i++) in hostapd_remove_bss()
2021 iface->conf->bss[i] = iface->conf->bss[i + 1]; in hostapd_remove_bss()
2033 hapd_iface = interfaces->iface[i]; in hostapd_remove_iface()
2036 if (!os_strcmp(hapd_iface->conf->bss[0]->iface, buf)) { in hostapd_remove_iface()
2045 interfaces->iface[k] = in hostapd_remove_iface()
2046 interfaces->iface[k + 1]; in hostapd_remove_iface()
2054 if (!os_strcmp(hapd_iface->conf->bss[j]->iface, buf)) { in hostapd_remove_iface()
2119 if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_INACTIVITY_TIMER)) { in hostapd_new_assoc_sta()
2154 void hostapd_set_state(struct hostapd_iface *iface, enum hostapd_iface_state s) in hostapd_set_state() argument
2157 iface->conf->bss[0]->iface, hostapd_state_text(iface->state), in hostapd_set_state()
2159 iface->state = s; in hostapd_set_state()
2314 struct hostapd_iface *iface = hapd->iface; in hostapd_fill_csa_settings() local
2319 if (!iface || !iface->freq || hapd->csa_in_progress) in hostapd_fill_csa_settings()
2322 ret = hostapd_change_config_freq(iface->bss[0], iface->conf, in hostapd_fill_csa_settings()
2331 hostapd_change_config_freq(iface->bss[0], iface->conf, in hostapd_fill_csa_settings()
2390 hostapd_switch_channel_fallback(struct hostapd_iface *iface, in hostapd_switch_channel_fallback() argument
2424 iface->freq = freq_params->freq; in hostapd_switch_channel_fallback()
2425 iface->conf->channel = freq_params->channel; in hostapd_switch_channel_fallback()
2426 iface->conf->secondary_channel = freq_params->sec_channel_offset; in hostapd_switch_channel_fallback()
2427 iface->conf->vht_oper_centr_freq_seg0_idx = vht_seg0_idx; in hostapd_switch_channel_fallback()
2428 iface->conf->vht_oper_centr_freq_seg1_idx = vht_seg1_idx; in hostapd_switch_channel_fallback()
2429 iface->conf->vht_oper_chwidth = vht_bw; in hostapd_switch_channel_fallback()
2430 iface->conf->ieee80211n = freq_params->ht_enabled; in hostapd_switch_channel_fallback()
2431 iface->conf->ieee80211ac = freq_params->vht_enabled; in hostapd_switch_channel_fallback()
2437 for (i = 0; i < iface->num_bss; i++) in hostapd_switch_channel_fallback()
2438 hostapd_cleanup_cs_params(iface->bss[i]); in hostapd_switch_channel_fallback()
2440 hostapd_disable_iface(iface); in hostapd_switch_channel_fallback()
2441 hostapd_enable_iface(iface); in hostapd_switch_channel_fallback()