Lines Matching defs:iface

48 static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd);
50 static int setup_interface2(struct hostapd_iface *iface);
55 int (*cb)(struct hostapd_iface *iface,
62 ret = cb(interfaces->iface[i], ctx);
94 hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 1);
96 hostapd_set_drv_ieee8021x(hapd, hapd->conf->iface, 0);
114 hostapd_setup_encryption(hapd->conf->iface, hapd);
127 wpa_printf(MSG_DEBUG, "Reconfigured interface %s", hapd->conf->iface);
131 static void hostapd_clear_old(struct hostapd_iface *iface)
139 for (j = 0; j < iface->num_bss; j++) {
140 hostapd_flush_old_stations(iface->bss[j],
142 hostapd_broadcast_wep_clear(iface->bss[j]);
147 radius_client_flush(iface->bss[j]->radius, 0);
153 int hostapd_reload_config(struct hostapd_iface *iface)
155 struct hostapd_data *hapd = iface->bss[0];
159 if (iface->config_fname == NULL) {
161 hostapd_clear_old(iface);
162 for (j = 0; j < iface->num_bss; j++)
163 hostapd_reload_bss(iface->bss[j]);
167 if (iface->interfaces == NULL ||
168 iface->interfaces->config_read_cb == NULL)
170 newconf = iface->interfaces->config_read_cb(iface->config_fname);
174 hostapd_clear_old(iface);
177 iface->conf = newconf;
179 for (j = 0; j < iface->num_bss; j++) {
180 hapd = iface->bss[j];
236 hostapd_broadcast_key_clear_iface(hapd, hapd->conf->iface);
248 hostapd_drv_set_key(hapd->conf->iface,
275 __func__, hapd->conf->iface);
280 wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
300 if (hostapd_if_remove(hapd, WPA_IF_AP_BSS, hapd->conf->iface)) {
303 hapd->conf->iface);
351 hapd->conf->iface);
352 if (hapd->iface->interfaces &&
353 hapd->iface->interfaces->ctrl_iface_deinit)
354 hapd->iface->interfaces->ctrl_iface_deinit(hapd);
359 static void sta_track_deinit(struct hostapd_iface *iface)
363 if (!iface->num_sta_seen)
366 while ((info = dl_list_first(&iface->sta_seen, struct hostapd_sta_info,
369 iface->num_sta_seen--;
375 static void hostapd_cleanup_iface_partial(struct hostapd_iface *iface)
377 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
380 hostapd_stop_setup_timers(iface);
383 hostapd_free_hw_features(iface->hw_features, iface->num_hw_features);
384 iface->hw_features = NULL;
385 os_free(iface->current_rates);
386 iface->current_rates = NULL;
387 os_free(iface->basic_rates);
388 iface->basic_rates = NULL;
389 ap_list_deinit(iface);
390 sta_track_deinit(iface);
396 * @iface: Pointer to interface data
401 static void hostapd_cleanup_iface(struct hostapd_iface *iface)
403 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
404 eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
406 hostapd_cleanup_iface_partial(iface);
407 hostapd_config_free(iface->conf);
408 iface->conf = NULL;
410 os_free(iface->config_fname);
411 os_free(iface->bss);
412 wpa_printf(MSG_DEBUG, "%s: free iface=%p", __func__, iface);
413 os_free(iface);
419 if (hapd->drv_priv && !hapd->iface->driver_ap_teardown) {
426 static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd)
445 hostapd_drv_set_key(iface, hapd, WPA_ALG_WEP, NULL, i,
470 if (!hapd->iface->driver_ap_teardown) {
499 * @iface: Pointer to interface data
504 static int hostapd_validate_bssid_configuration(struct hostapd_iface *iface)
507 struct hostapd_data *hapd = iface->bss[0];
508 unsigned int i = iface->conf->num_bss, bits = 0, j;
522 for (j = 0; j < iface->conf->num_bss; j++) {
523 if (hostapd_mac_comp_empty(iface->conf->bss[j]->bssid) == 0) {
531 iface->conf->bss[j]->bssid[i] ^
570 (unsigned long) iface->conf->num_bss, MAC2STR(mask), bits);
891 __func__, hapd, conf->iface, first);
902 __func__, conf->iface);
918 hapd->iface->bss[0]->own_addr) ==
922 "the radio", conf->iface);
928 if (hostapd_if_add(hapd->iface->bss[0], WPA_IF_AP_BSS,
929 conf->iface, hapd->own_addr, hapd,
944 if (hapd->iface->mconf == NULL)
954 if (hostapd_setup_encryption(conf->iface, hapd))
988 conf->iface, MAC2STR(hapd->own_addr),
1123 static void hostapd_tx_queue_params(struct hostapd_iface *iface)
1125 struct hostapd_data *hapd = iface->bss[0];
1130 if (iface->mconf == NULL)
1135 p = &iface->conf->tx_queue[i];
1180 if (hapd->iface->drv_max_acl_mac_addrs == 0)
1207 if (!hapd->iface->interfaces ||
1208 !hapd->iface->interfaces->ctrl_iface_init)
1211 if (hapd->iface->interfaces->ctrl_iface_init(hapd)) {
1214 hapd->conf->iface);
1222 static int start_ctrl_iface(struct hostapd_iface *iface)
1226 if (!iface->interfaces || !iface->interfaces->ctrl_iface_init)
1229 for (i = 0; i < iface->num_bss; i++) {
1230 struct hostapd_data *hapd = iface->bss[i];
1231 if (iface->interfaces->ctrl_iface_init(hapd)) {
1234 hapd->conf->iface);
1245 struct hostapd_iface *iface = eloop_ctx;
1247 if (!iface->wait_channel_update) {
1257 setup_interface2(iface);
1261 void hostapd_channel_list_updated(struct hostapd_iface *iface, int initiator)
1263 if (!iface->wait_channel_update || initiator != REGDOM_SET_BY_USER)
1267 eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
1268 setup_interface2(iface);
1272 static int setup_interface(struct hostapd_iface *iface)
1274 struct hostapd_data *hapd = iface->bss[0];
1284 iface->driver_ap_teardown = 0;
1286 if (!iface->phy[0]) {
1290 os_strlcpy(iface->phy, phy, sizeof(iface->phy));
1298 for (i = 1; i < iface->num_bss; i++) {
1299 iface->bss[i]->driver = hapd->driver;
1300 iface->bss[i]->drv_priv = hapd->drv_priv;
1303 if (hostapd_validate_bssid_configuration(iface))
1311 if (start_ctrl_iface(iface))
1317 hostapd_set_state(iface, HAPD_IFACE_COUNTRY_UPDATE);
1333 iface->wait_channel_update = 1;
1336 iface, NULL);
1341 return setup_interface2(iface);
1345 static int setup_interface2(struct hostapd_iface *iface)
1347 iface->wait_channel_update = 0;
1349 if (hostapd_get_hw_features(iface)) {
1353 int ret = hostapd_select_hw_mode(iface);
1363 ret = hostapd_check_ht_capab(iface);
1372 if (iface->conf->ieee80211h)
1375 return hostapd_setup_interface_complete(iface, 0);
1378 hostapd_set_state(iface, HAPD_IFACE_DISABLED);
1379 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, AP_EVENT_DISABLED);
1380 if (iface->interfaces && iface->interfaces->terminate_on_error)
1402 *hw_mode = ieee80211_freq_to_chan(hapd->iface->freq, channel);
1410 if (hapd->iface->fst_ies != fst_ies) {
1411 hapd->iface->fst_ies = fst_ies;
1423 return hostapd_drv_send_action(hapd, hapd->iface->freq, 0, da,
1520 int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err)
1522 struct hostapd_data *hapd = iface->bss[0];
1532 if (iface->conf->channel) {
1537 iface->freq = hostapd_hw_get_freq(hapd, iface->conf->channel);
1540 hostapd_hw_mode_txt(iface->conf->hw_mode),
1541 iface->conf->channel, iface->freq);
1545 if (!(iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD)) {
1547 res = hostapd_handle_dfs(iface);
1555 res_dfs_offload = hostapd_handle_dfs_offload(iface);
1574 if (iface->mconf != NULL) {
1577 iface->bss[0]->conf->iface);
1583 hostapd_set_freq(hapd, hapd->iconf->hw_mode, iface->freq,
1597 if (iface->current_mode) {
1598 if (hostapd_prepare_rates(iface, iface->current_mode)) {
1624 for (j = 0; j < iface->num_bss; j++) {
1625 hapd = iface->bss[j];
1630 hapd = iface->bss[j];
1639 hapd = iface->bss[0];
1641 hostapd_tx_queue_params(iface);
1643 ap_list_init(iface);
1644 dl_list_init(&iface->sta_seen);
1660 for (j = 0; j < iface->num_bss; j++) {
1661 if (hostapd_init_wps_complete(iface->bss[j]))
1665 if ((iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) &&
1684 iface->fst = fst_attach(hapd->conf->iface, hapd->own_addr,
1686 if (!iface->fst) {
1694 hostapd_set_state(iface, HAPD_IFACE_ENABLED);
1695 wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, AP_EVENT_ENABLED);
1700 iface->bss[0]->conf->iface);
1701 if (iface->interfaces && iface->interfaces->terminate_on_error > 0)
1702 iface->interfaces->terminate_on_error--;
1708 hostapd_set_state(iface, HAPD_IFACE_DISABLED);
1711 if (iface->fst) {
1712 fst_detach(iface->fst);
1713 iface->fst = NULL;
1716 if (iface->interfaces && iface->interfaces->terminate_on_error)
1724 * @iface: Pointer to interface data.
1738 int hostapd_setup_interface(struct hostapd_iface *iface)
1742 ret = setup_interface(iface);
1745 iface->bss[0]->conf->iface);
1778 hapd->iface = hapd_iface;
1789 hapd->conf->iface);
1796 void hostapd_interface_deinit(struct hostapd_iface *iface)
1800 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
1801 if (iface == NULL)
1804 hostapd_set_state(iface, HAPD_IFACE_DISABLED);
1808 hostapd_stop_setup_timers(iface);
1809 eloop_cancel_timeout(ap_ht2040_timeout, iface, NULL);
1812 eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
1813 iface->wait_channel_update = 0;
1816 if (iface->fst) {
1817 fst_detach(iface->fst);
1818 iface->fst = NULL;
1822 for (j = iface->num_bss - 1; j >= 0; j--)
1823 hostapd_bss_deinit(iface->bss[j]);
1827 void hostapd_interface_free(struct hostapd_iface *iface)
1830 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
1831 for (j = 0; j < iface->num_bss; j++) {
1833 __func__, iface->bss[j]);
1834 os_free(iface->bss[j]);
1836 hostapd_cleanup_iface(iface);
1895 wpa_printf(MSG_DEBUG, "%s: free iface %p",
1908 struct hostapd_iface *iface = interfaces->iface[i];
1909 for (j = 0; j < iface->num_bss; j++) {
1910 struct hostapd_data *hapd = iface->bss[j];
1911 if (os_strcmp(ifname, hapd->conf->iface) == 0)
1935 struct hostapd_iface *new_iface = NULL, *iface = NULL;
1944 if (os_strcmp(interfaces->iface[i]->phy, phy) == 0) {
1945 iface = interfaces->iface[i];
1951 config_fname, phy, iface ? "" : " --> new PHY");
1952 if (iface) {
1959 /* Add new BSS to existing iface */
1969 ifname = conf->bss[0]->iface;
1978 iface->conf->bss, iface->conf->num_bss + 1,
1980 tmp_bss = os_realloc_array(iface->bss, iface->num_bss + 1,
1983 iface->bss = tmp_bss;
1985 iface->conf->bss = tmp_conf;
1986 iface->conf->last_bss = tmp_conf[0];
1992 bss = iface->conf->bss[iface->conf->num_bss] = conf->bss[0];
1993 iface->conf->num_bss++;
1995 hapd = hostapd_alloc_bss_data(iface, iface->conf, bss);
1997 iface->conf->num_bss--;
2001 iface->conf->last_bss = bss;
2002 iface->bss[iface->num_bss] = hapd;
2005 bss_idx = iface->num_bss++;
2010 /* Add a new iface with the first BSS */
2011 new_iface = iface = hostapd_init(interfaces, config_fname);
2012 if (!iface)
2014 os_strlcpy(iface->phy, phy, sizeof(iface->phy));
2015 iface->interfaces = interfaces;
2020 if (iface->bss[bss_idx]->conf->logger_stdout_level > 0)
2021 iface->bss[bss_idx]->conf->logger_stdout_level--;
2024 if (iface->conf->bss[bss_idx]->iface[0] == '\0' &&
2025 !hostapd_drv_none(iface->bss[bss_idx])) {
2033 return iface;
2037 void hostapd_interface_deinit_free(struct hostapd_iface *iface)
2042 wpa_printf(MSG_DEBUG, "%s(%p)", __func__, iface);
2043 if (iface == NULL)
2046 __func__, (unsigned int) iface->num_bss,
2047 (unsigned int) iface->conf->num_bss);
2048 driver = iface->bss[0]->driver;
2049 drv_priv = iface->bss[0]->drv_priv;
2050 hostapd_interface_deinit(iface);
2055 iface->bss[0]->drv_priv = NULL;
2057 hostapd_interface_free(iface);
2088 hapd_iface->conf->bss[0]->iface);
2093 hapd_iface->conf->bss[0]->iface);
2123 hapd_iface->conf->bss[0]->iface);
2149 hapd_iface->conf->bss[0]->iface);
2161 /* same as hostapd_interface_deinit without deinitializing ctrl-iface */
2176 hapd_iface->bss[0]->conf->iface);
2185 struct hostapd_iface **iface, *hapd_iface;
2187 iface = os_realloc_array(interfaces->iface, interfaces->count + 1,
2189 if (iface == NULL)
2191 interfaces->iface = iface;
2192 hapd_iface = interfaces->iface[interfaces->count] =
2246 os_strlcpy(bss->iface, ifname, sizeof(bss->iface));
2320 if (interfaces->iface[j] == hapd_iface)
2325 tmp = os_realloc_array(interfaces->iface,
2332 interfaces->iface = tmp;
2333 interfaces->iface[interfaces->count++] = hapd_iface;
2364 __func__, hapd, hapd->conf->iface);
2383 if (!os_strcmp(interfaces->iface[i]->conf->bss[0]->iface,
2402 os_strlcpy(conf->bss[0]->iface, buf,
2403 sizeof(conf->bss[0]->iface));
2429 hapd_iface->conf->bss[0]->iface);
2448 hapd->conf->iface);
2458 interfaces->iface[interfaces->count] = NULL;
2466 static int hostapd_remove_bss(struct hostapd_iface *iface, unsigned int idx)
2470 wpa_printf(MSG_INFO, "Remove BSS '%s'", iface->conf->bss[idx]->iface);
2473 if (idx < iface->num_bss) {
2474 struct hostapd_data *hapd = iface->bss[idx];
2478 __func__, hapd, hapd->conf->iface);
2483 iface->num_bss--;
2485 for (i = idx; i < iface->num_bss; i++)
2486 iface->bss[i] = iface->bss[i + 1];
2488 hostapd_config_free_bss(iface->conf->bss[idx]);
2489 iface->conf->bss[idx] = NULL;
2492 iface->conf->num_bss--;
2493 for (i = idx; i < iface->conf->num_bss; i++)
2494 iface->conf->bss[i] = iface->conf->bss[i + 1];
2506 hapd_iface = interfaces->iface[i];
2509 if (!os_strcmp(hapd_iface->conf->bss[0]->iface, buf)) {
2518 interfaces->iface[k] =
2519 interfaces->iface[k + 1];
2527 if (!os_strcmp(hapd_iface->conf->bss[j]->iface, buf)) {
2592 if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_INACTIVITY_TIMER)) {
2627 void hostapd_set_state(struct hostapd_iface *iface, enum hostapd_iface_state s)
2630 iface->conf->bss[0]->iface, hostapd_state_text(iface->state),
2632 iface->state = s;
2787 struct hostapd_iface *iface = hapd->iface;
2792 if (!iface || !iface->freq || hapd->csa_in_progress)
2795 ret = hostapd_change_config_freq(iface->bss[0], iface->conf,
2804 hostapd_change_config_freq(iface->bss[0], iface->conf,
2844 if (!(hapd->iface->drv_flags & WPA_DRIVER_FLAGS_AP_CSA)) {
2869 hostapd_switch_channel_fallback(struct hostapd_iface *iface,
2903 iface->freq = freq_params->freq;
2904 iface->conf->channel = freq_params->channel;
2905 iface->conf->secondary_channel = freq_params->sec_channel_offset;
2906 iface->conf->vht_oper_centr_freq_seg0_idx = vht_seg0_idx;
2907 iface->conf->vht_oper_centr_freq_seg1_idx = vht_seg1_idx;
2908 iface->conf->vht_oper_chwidth = vht_bw;
2909 iface->conf->ieee80211n = freq_params->ht_enabled;
2910 iface->conf->ieee80211ac = freq_params->vht_enabled;
2916 for (i = 0; i < iface->num_bss; i++)
2917 hostapd_cleanup_cs_params(iface->bss[i]);
2919 hostapd_disable_iface(iface);
2920 hostapd_enable_iface(iface);
2930 struct hostapd_iface *iface = interfaces->iface[i];
2932 for (j = 0; j < iface->num_bss; j++) {
2933 struct hostapd_data *hapd = iface->bss[j];
2935 if (os_strcmp(ifname, hapd->conf->iface) == 0)
2946 void hostapd_periodic_iface(struct hostapd_iface *iface)
2950 ap_list_timer(iface);
2952 for (i = 0; i < iface->num_bss; i++) {
2953 struct hostapd_data *hapd = iface->bss[i];