Clean up IE processing in hostapd_notif_assoc()

This commit is contained in:
Jouni Malinen 2011-10-16 17:49:02 +03:00
parent fa15d405c7
commit 2bb20281cb
1 changed files with 8 additions and 10 deletions

View File

@ -38,15 +38,13 @@
int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr, int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
const u8 *ie, size_t ielen, int reassoc) const u8 *req_ies, size_t req_ies_len, int reassoc)
{ {
struct sta_info *sta; struct sta_info *sta;
int new_assoc, res; int new_assoc, res;
struct ieee802_11_elems elems; struct ieee802_11_elems elems;
#if defined(CONFIG_P2P) || defined(CONFIG_WPS) const u8 *ie;
const u8 *all_ies = ie; size_t ielen;
size_t all_ies_len = ielen;
#endif /* CONFIG_P2P || CONFIG_WPS */
if (addr == NULL) { if (addr == NULL) {
/* /*
@ -65,7 +63,7 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211, hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
HOSTAPD_LEVEL_INFO, "associated"); HOSTAPD_LEVEL_INFO, "associated");
ieee802_11_parse_elems(ie, ielen, &elems, 0); ieee802_11_parse_elems(req_ies, req_ies_len, &elems, 0);
if (elems.wps_ie) { if (elems.wps_ie) {
ie = elems.wps_ie - 2; ie = elems.wps_ie - 2;
ielen = elems.wps_ie_len + 2; ielen = elems.wps_ie_len + 2;
@ -98,7 +96,7 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
if (elems.p2p) { if (elems.p2p) {
wpabuf_free(sta->p2p_ie); wpabuf_free(sta->p2p_ie);
sta->p2p_ie = ieee802_11_vendor_ie_concat(all_ies, all_ies_len, sta->p2p_ie = ieee802_11_vendor_ie_concat(req_ies, req_ies_len,
P2P_IE_VENDOR_TYPE); P2P_IE_VENDOR_TYPE);
} }
#endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */
@ -173,8 +171,8 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
} else if (hapd->conf->wps_state) { } else if (hapd->conf->wps_state) {
#ifdef CONFIG_WPS #ifdef CONFIG_WPS
struct wpabuf *wps; struct wpabuf *wps;
if (all_ies) if (req_ies)
wps = ieee802_11_vendor_ie_concat(all_ies, all_ies_len, wps = ieee802_11_vendor_ie_concat(req_ies, req_ies_len,
WPS_IE_VENDOR_TYPE); WPS_IE_VENDOR_TYPE);
else else
wps = NULL; wps = NULL;
@ -213,7 +211,7 @@ skip_wpa_check:
#ifdef CONFIG_P2P #ifdef CONFIG_P2P
p2p_group_notif_assoc(hapd->p2p_group, sta->addr, p2p_group_notif_assoc(hapd->p2p_group, sta->addr,
all_ies, all_ies_len); req_ies, req_ies_len);
#endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */
return 0; return 0;