hostapd: Share a single function for BSS deinit

hostapd_bss_deinit() takes care of freeing the associated stations and
calling hostapd_cleanup() to deinit per-BSS services.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2013-11-06 12:48:24 +02:00 committed by Jouni Malinen
parent 6d1ca81ee8
commit 54246f8d44

View file

@ -1252,6 +1252,17 @@ hostapd_alloc_bss_data(struct hostapd_iface *hapd_iface,
} }
static void hostapd_bss_deinit(struct hostapd_data *hapd)
{
wpa_printf(MSG_DEBUG, "%s: deinit bss %s", __func__,
hapd->conf->iface);
hostapd_free_stas(hapd);
hostapd_flush_old_stations(hapd, WLAN_REASON_DEAUTH_LEAVING);
hostapd_clear_wep(hapd);
hostapd_cleanup(hapd);
}
void hostapd_interface_deinit(struct hostapd_iface *iface) void hostapd_interface_deinit(struct hostapd_iface *iface)
{ {
int j; int j;
@ -1263,15 +1274,8 @@ void hostapd_interface_deinit(struct hostapd_iface *iface)
eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); eloop_cancel_timeout(channel_list_update_timeout, iface, NULL);
iface->wait_channel_update = 0; iface->wait_channel_update = 0;
for (j = iface->num_bss - 1; j >= 0; j--) { for (j = iface->num_bss - 1; j >= 0; j--)
struct hostapd_data *hapd = iface->bss[j]; hostapd_bss_deinit(iface->bss[j]);
wpa_printf(MSG_DEBUG, "%s: deinit bss %s", __func__,
hapd->conf->iface);
hostapd_free_stas(hapd);
hostapd_flush_old_stations(hapd, WLAN_REASON_DEAUTH_LEAVING);
hostapd_clear_wep(hapd);
hostapd_cleanup(hapd);
}
} }
@ -1851,10 +1855,7 @@ static int hostapd_remove_bss(struct hostapd_iface *iface, unsigned int idx)
if (idx < iface->num_bss) { if (idx < iface->num_bss) {
struct hostapd_data *hapd = iface->bss[idx]; struct hostapd_data *hapd = iface->bss[idx];
hostapd_free_stas(hapd); hostapd_bss_deinit(hapd);
hostapd_flush_old_stations(hapd, WLAN_REASON_DEAUTH_LEAVING);
hostapd_clear_wep(hapd);
hostapd_cleanup(hapd);
wpa_printf(MSG_DEBUG, "%s: free hapd %p (%s)", wpa_printf(MSG_DEBUG, "%s: free hapd %p (%s)",
__func__, hapd, hapd->conf->iface); __func__, hapd, hapd->conf->iface);
hostapd_config_free_bss(hapd->conf); hostapd_config_free_bss(hapd->conf);