From a2de634d1cd4cdd3eff0146ee57718cd87986972 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 24 Dec 2009 23:30:32 +0200 Subject: [PATCH] Removed hostapd_new_assoc_sta() from driver wrapper API This is not called directly by any of the driver wrappers anymore, so the function can be removed from driver.h and drv_callbacks.c. --- hostapd/drv_callbacks.c | 88 ----------------------------------------- hostapd/hostapd.c | 88 +++++++++++++++++++++++++++++++++++++++++ hostapd/hostapd.h | 2 + src/drivers/driver.h | 2 - 4 files changed, 90 insertions(+), 90 deletions(-) diff --git a/hostapd/drv_callbacks.c b/hostapd/drv_callbacks.c index bb6e5f976..abedd0737 100644 --- a/hostapd/drv_callbacks.c +++ b/hostapd/drv_callbacks.c @@ -29,94 +29,6 @@ #include "wps_hostapd.h" -struct prune_data { - struct hostapd_data *hapd; - const u8 *addr; -}; - -static int prune_associations(struct hostapd_iface *iface, void *ctx) -{ - struct prune_data *data = ctx; - struct sta_info *osta; - struct hostapd_data *ohapd; - size_t j; - - for (j = 0; j < iface->num_bss; j++) { - ohapd = iface->bss[j]; - if (ohapd == data->hapd) - continue; - osta = ap_get_sta(ohapd, data->addr); - if (!osta) - continue; - - ap_sta_disassociate(ohapd, osta, WLAN_REASON_UNSPECIFIED); - } - - return 0; -} - -/** - * hostapd_prune_associations - Remove extraneous associations - * @hapd: Pointer to BSS data for the most recent association - * @sta: Pointer to the associated STA data - * - * This function looks through all radios and BSS's for previous - * (stale) associations of STA. If any are found they are removed. - */ -static void hostapd_prune_associations(struct hostapd_data *hapd, - struct sta_info *sta) -{ - struct prune_data data; - data.hapd = hapd; - data.addr = sta->addr; - hostapd_for_each_interface(hapd->iface->interfaces, - prune_associations, &data); -} - - -/** - * hostapd_new_assoc_sta - Notify that a new station associated with the AP - * @hapd: Pointer to BSS data - * @sta: Pointer to the associated STA data - * @reassoc: 1 to indicate this was a re-association; 0 = first association - * - * This function will be called whenever a station associates with the AP. It - * can be called from ieee802_11.c for drivers that export MLME to hostapd and - * from driver_*.c for drivers that take care of management frames (IEEE 802.11 - * authentication and association) internally. - */ -void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, - int reassoc) -{ - if (hapd->tkip_countermeasures) { - hostapd_sta_deauth(hapd, sta->addr, - WLAN_REASON_MICHAEL_MIC_FAILURE); - return; - } - - hostapd_prune_associations(hapd, sta); - - /* IEEE 802.11F (IAPP) */ - if (hapd->conf->ieee802_11f) - iapp_new_station(hapd->iapp, sta); - - /* Start accounting here, if IEEE 802.1X and WPA are not used. - * IEEE 802.1X/WPA code will start accounting after the station has - * been authorized. */ - if (!hapd->conf->ieee802_1x && !hapd->conf->wpa) - accounting_sta_start(hapd, sta); - - /* Start IEEE 802.1X authentication process for new stations */ - ieee802_1x_new_station(hapd, sta); - if (reassoc) { - if (sta->auth_alg != WLAN_AUTH_FT && - !(sta->flags & (WLAN_STA_WPS | WLAN_STA_MAYBE_WPS))) - wpa_auth_sm_event(sta->wpa_sm, WPA_REAUTH); - } else - wpa_auth_sta_associated(hapd->wpa_auth, sta->wpa_sm); -} - - int hostapd_notif_new_sta(struct hostapd_data *hapd, const u8 *addr) { struct sta_info *sta = ap_get_sta(hapd, addr); diff --git a/hostapd/hostapd.c b/hostapd/hostapd.c index 4e53a40d1..0027850b0 100644 --- a/hostapd/hostapd.c +++ b/hostapd/hostapd.c @@ -1486,3 +1486,91 @@ int hostapd_register_probereq_cb(struct hostapd_data *hapd, return 0; } + + +struct prune_data { + struct hostapd_data *hapd; + const u8 *addr; +}; + +static int prune_associations(struct hostapd_iface *iface, void *ctx) +{ + struct prune_data *data = ctx; + struct sta_info *osta; + struct hostapd_data *ohapd; + size_t j; + + for (j = 0; j < iface->num_bss; j++) { + ohapd = iface->bss[j]; + if (ohapd == data->hapd) + continue; + osta = ap_get_sta(ohapd, data->addr); + if (!osta) + continue; + + ap_sta_disassociate(ohapd, osta, WLAN_REASON_UNSPECIFIED); + } + + return 0; +} + +/** + * hostapd_prune_associations - Remove extraneous associations + * @hapd: Pointer to BSS data for the most recent association + * @sta: Pointer to the associated STA data + * + * This function looks through all radios and BSS's for previous + * (stale) associations of STA. If any are found they are removed. + */ +static void hostapd_prune_associations(struct hostapd_data *hapd, + struct sta_info *sta) +{ + struct prune_data data; + data.hapd = hapd; + data.addr = sta->addr; + hostapd_for_each_interface(hapd->iface->interfaces, + prune_associations, &data); +} + + +/** + * hostapd_new_assoc_sta - Notify that a new station associated with the AP + * @hapd: Pointer to BSS data + * @sta: Pointer to the associated STA data + * @reassoc: 1 to indicate this was a re-association; 0 = first association + * + * This function will be called whenever a station associates with the AP. It + * can be called from ieee802_11.c for drivers that export MLME to hostapd and + * from drv_callbacks.c based on driver events for drivers that take care of + * management frames (IEEE 802.11 authentication and association) internally. + */ +void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, + int reassoc) +{ + if (hapd->tkip_countermeasures) { + hostapd_sta_deauth(hapd, sta->addr, + WLAN_REASON_MICHAEL_MIC_FAILURE); + return; + } + + hostapd_prune_associations(hapd, sta); + + /* IEEE 802.11F (IAPP) */ + if (hapd->conf->ieee802_11f) + iapp_new_station(hapd->iapp, sta); + + /* Start accounting here, if IEEE 802.1X and WPA are not used. + * IEEE 802.1X/WPA code will start accounting after the station has + * been authorized. */ + if (!hapd->conf->ieee802_1x && !hapd->conf->wpa) + accounting_sta_start(hapd, sta); + + /* Start IEEE 802.1X authentication process for new stations */ + ieee802_1x_new_station(hapd, sta); + if (reassoc) { + if (sta->auth_alg != WLAN_AUTH_FT && + !(sta->flags & (WLAN_STA_WPS | WLAN_STA_MAYBE_WPS))) + wpa_auth_sm_event(sta->wpa_sm, WPA_REAUTH); + } else + wpa_auth_sta_associated(hapd->wpa_auth, sta->wpa_sm); +} diff --git a/hostapd/hostapd.h b/hostapd/hostapd.h index 3e456f4ae..005d7de66 100644 --- a/hostapd/hostapd.h +++ b/hostapd/hostapd.h @@ -219,5 +219,7 @@ int hostapd_register_probereq_cb(struct hostapd_data *hapd, int eap_server_register_methods(void); void hostapd_set_driver_ops(struct hostapd_driver_ops *ops); +void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, + int reassoc); #endif /* HOSTAPD_H */ diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 47cf2c391..f774de901 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -1992,8 +1992,6 @@ void wpa_scan_sort_results(struct wpa_scan_results *res); struct sta_info; struct ieee80211_hdr; -void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta, - int reassoc); int hostapd_notif_new_sta(struct hostapd_data *hapd, const u8 *addr); int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr, const u8 *ie, size_t ielen);