From f403dcd648e81beae097d54058ef9acdd881ed46 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 22 Nov 2012 00:19:17 +0200 Subject: [PATCH] HS 2.0: Maintain a copy of HS 2.0 Indication from Association Request This allows the AP to figure out whether a station is a HS 2.0 STA during the association and access any information that the STA may have included in this element. Signed-hostap: Jouni Malinen --- src/ap/drv_callbacks.c | 9 +++++++++ src/ap/ieee802_11.c | 9 +++++++++ src/ap/sta_info.c | 1 + src/ap/sta_info.h | 1 + 4 files changed, 20 insertions(+) diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c index 5517294f0..86139752f 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c @@ -109,6 +109,15 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr, } #endif /* CONFIG_P2P */ +#ifdef CONFIG_HS20 + wpabuf_free(sta->hs20_ie); + if (elems.hs20 && elems.hs20_len > 4) { + sta->hs20_ie = wpabuf_alloc_copy(elems.hs20 + 4, + elems.hs20_len - 4); + } else + sta->hs20_ie = NULL; +#endif /* CONFIG_HS20 */ + if (hapd->conf->wpa) { if (ie == NULL || ielen == 0) { #ifdef CONFIG_WPS diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index 8d5268ed8..075317652 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -962,6 +962,15 @@ static u16 check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta, p2p_group_notif_assoc(hapd->p2p_group, sta->addr, ies, ies_len); #endif /* CONFIG_P2P */ +#ifdef CONFIG_HS20 + wpabuf_free(sta->hs20_ie); + if (elems.hs20 && elems.hs20_len > 4) { + sta->hs20_ie = wpabuf_alloc_copy(elems.hs20 + 4, + elems.hs20_len - 4); + } else + sta->hs20_ie = NULL; +#endif /* CONFIG_HS20 */ + return WLAN_STATUS_SUCCESS; } diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c index d61177fd6..4f57af5dc 100644 --- a/src/ap/sta_info.c +++ b/src/ap/sta_info.c @@ -232,6 +232,7 @@ void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta) wpabuf_free(sta->wps_ie); wpabuf_free(sta->p2p_ie); + wpabuf_free(sta->hs20_ie); os_free(sta->ht_capabilities); os_free(sta->psk); diff --git a/src/ap/sta_info.h b/src/ap/sta_info.h index abf19cb41..132830f99 100644 --- a/src/ap/sta_info.h +++ b/src/ap/sta_info.h @@ -121,6 +121,7 @@ struct sta_info { struct wpabuf *wps_ie; /* WPS IE from (Re)Association Request */ struct wpabuf *p2p_ie; /* P2P IE from (Re)Association Request */ + struct wpabuf *hs20_ie; /* HS 2.0 IE from (Re)Association Request */ struct os_time connected_time;