struct hostapd_data *hapd = iface->bss[0];
struct hostapd_config *newconf, *oldconf;
struct wpa_auth_config wpa_auth_conf;
+ size_t j;
newconf = hostapd_config_read(iface->config_fname);
if (newconf == NULL)
* Deauthenticate all stations since the new configuration may not
* allow them to use the BSS anymore.
*/
- hostapd_flush_old_stations(hapd);
+ for (j = 0; j < iface->num_bss; j++)
+ hostapd_flush_old_stations(iface->bss[j]);
/* TODO: update dynamic data based on changed configuration
* items (e.g., open/close sockets, etc.) */
{
hostapd_ctrl_iface_deinit(hapd);
- os_free(hapd->default_wep_key);
- hapd->default_wep_key = NULL;
iapp_deinit(hapd->iapp);
hapd->iapp = NULL;
accounting_deinit(hapd);
os_memcpy(m->bssid, hapd->own_addr, ETH_ALEN);
os_memcpy(&m->u, data, data_len);
- res = hostapd_send_mgmt_frame(hapd, (u8 *) m, mlen, 0);
+ res = hostapd_send_mgmt_frame(hapd, (u8 *) m, mlen);
os_free(m);
return res;
}
}
}
+ hostapd_flush_old_stations(hapd);
+ hostapd_set_privacy(hapd, 0);
+
+ hostapd_broadcast_wep_clear(hapd);
+ if (hostapd_setup_encryption(hapd->conf->iface, hapd))
+ return -1;
+
/*
* Fetch the SSID from the system and use it or,
* if one was specified in the config file, verify they
size_t i;
char country[4];
u8 *b = conf->bssid;
- int freq;
- size_t j;
- u8 *prev_addr;
/*
* Initialize the driver interface and make sure that all BSSes get
* configured with a pointer to this driver interface.
*/
- if (b[0] | b[1] | b[2] | b[3] | b[4] | b[5]) {
- hapd->drv_priv = hostapd_driver_init_bssid(hapd, b);
- } else {
- hapd->drv_priv = hostapd_driver_init(hapd);
- }
+ if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5]))
+ b = NULL;
+ hapd->drv_priv = hostapd_driver_init(hapd, b);
if (hapd->drv_priv == NULL) {
wpa_printf(MSG_ERROR, "%s driver initialization failed.",
iface->bss[i]->drv_priv = hapd->drv_priv;
}
+ if (hostapd_driver_set_mode(hapd, IEEE80211_MODE_AP)) {
+ wpa_printf(MSG_ERROR, "Failed to set driver in AP mode");
+ return -1;
+ }
+
if (hostapd_validate_bssid_configuration(iface))
return -1;
}
}
- if (hapd->iconf->ieee80211d &&
- hostapd_set_ieee80211d(hapd, 1) < 0) {
- wpa_printf(MSG_ERROR, "Failed to set ieee80211d (%d)",
- hapd->iconf->ieee80211d);
- return -1;
- }
-
if (hapd->iconf->bridge_packets != INTERNAL_BRIDGE_DO_NOT_CONTROL &&
hostapd_set_internal_bridge(hapd, hapd->iconf->bridge_packets)) {
wpa_printf(MSG_ERROR, "Failed to set bridge_packets for "
"channel. (%d)", ret);
return -1;
}
+ ret = hostapd_check_ht_capab(iface);
+ if (ret < 0)
+ return -1;
+ if (ret == 1) {
+ wpa_printf(MSG_DEBUG, "Interface initialization will "
+ "be completed in a callback");
+ return 0;
+ }
}
+ return hostapd_setup_interface_complete(iface, 0);
+}
- hostapd_flush_old_stations(hapd);
- hostapd_set_privacy(hapd, 0);
+int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err)
+{
+ struct hostapd_data *hapd = iface->bss[0];
+ int freq;
+ size_t j;
+ u8 *prev_addr;
+
+ if (err) {
+ wpa_printf(MSG_ERROR, "Interface initialization failed");
+ eloop_terminate();
+ return -1;
+ }
+
+ wpa_printf(MSG_DEBUG, "Completing interface initialization");
if (hapd->iconf->channel) {
freq = hostapd_hw_get_freq(hapd, hapd->iconf->channel);
wpa_printf(MSG_DEBUG, "Mode: %s Channel: %d "
}
}
- hostapd_broadcast_wep_clear(hapd);
- if (hostapd_setup_encryption(hapd->conf->iface, hapd))
- return -1;
-
hostapd_set_beacon_int(hapd, hapd->iconf->beacon_int);
- ieee802_11_set_beacon(hapd);
if (hapd->iconf->rts_threshold > -1 &&
hostapd_set_rts(hapd, hapd->iconf->rts_threshold)) {
return -1;
}
+ wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
+ iface->bss[0]->conf->iface);
+
return 0;
}
iface->bss[0]->conf->iface);
eloop_terminate();
return -1;
- } else if (!hostapd_drv_none(iface->bss[0])) {
- wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
- iface->bss[0]->conf->iface);
}
return 0;
hapd->conf = bss;
hapd->iface = hapd_iface;
- if (hapd->conf->individual_wep_key_len > 0) {
- /* use key0 in individual key and key1 in broadcast key */
- hapd->default_wep_key_idx = 1;
- }
-
#ifdef EAP_TLS_FUNCS
if (hapd->conf->eap_server &&
(hapd->conf->ca_cert || hapd->conf->server_cert ||