P2P: Save a copy of P2P IE(s) data from (Re)Association Request

This commit is contained in:
Jouni Malinen 2010-07-18 14:30:25 -07:00 committed by Jouni Malinen
parent fdadd5fe03
commit b305c684b8
4 changed files with 25 additions and 0 deletions

View file

@ -40,6 +40,10 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
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;
#ifdef CONFIG_P2P
const u8 *all_ies = ie;
size_t all_ies_len = ielen;
#endif /* CONFIG_P2P */
if (addr == NULL) { if (addr == NULL) {
/* /*
@ -87,6 +91,14 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
} }
sta->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS); sta->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS);
#ifdef CONFIG_P2P
if (elems.p2p) {
wpabuf_free(sta->p2p_ie);
sta->p2p_ie = ieee802_11_vendor_ie_concat(all_ies, all_ies_len,
P2P_IE_VENDOR_TYPE);
}
#endif /* CONFIG_P2P */
if (hapd->conf->wpa) { if (hapd->conf->wpa) {
if (ie == NULL || ielen == 0) { if (ie == NULL || ielen == 0) {
if (hapd->conf->wps_state) { if (hapd->conf->wps_state) {

View file

@ -773,6 +773,17 @@ static u16 check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta,
} else } else
wpa_auth_sta_no_wpa(sta->wpa_sm); wpa_auth_sta_no_wpa(sta->wpa_sm);
#ifdef CONFIG_P2P
if (elems.p2p) {
wpabuf_free(sta->p2p_ie);
sta->p2p_ie = ieee802_11_vendor_ie_concat(ies, ies_len,
P2P_IE_VENDOR_TYPE);
} else {
wpabuf_free(sta->p2p_ie);
sta->p2p_ie = NULL;
}
#endif /* CONFIG_P2P */
return WLAN_STATUS_SUCCESS; return WLAN_STATUS_SUCCESS;
} }

View file

@ -200,6 +200,7 @@ void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
#endif /* CONFIG_IEEE80211W */ #endif /* CONFIG_IEEE80211W */
wpabuf_free(sta->wps_ie); wpabuf_free(sta->wps_ie);
wpabuf_free(sta->p2p_ie);
os_free(sta->ht_capabilities); os_free(sta->ht_capabilities);

View file

@ -104,6 +104,7 @@ struct sta_info {
#endif /* CONFIG_IEEE80211W */ #endif /* CONFIG_IEEE80211W */
struct wpabuf *wps_ie; /* WPS IE from (Re)Association Request */ struct wpabuf *wps_ie; /* WPS IE from (Re)Association Request */
struct wpabuf *p2p_ie; /* P2P IE from (Re)Association Request */
}; };