]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Save a copy of P2P IE(s) data from (Re)Association Request
authorJouni Malinen <jouni.malinen@atheros.com>
Sun, 18 Jul 2010 21:30:25 +0000 (14:30 -0700)
committerJouni Malinen <j@w1.fi>
Thu, 9 Sep 2010 14:17:17 +0000 (07:17 -0700)
src/ap/drv_callbacks.c
src/ap/ieee802_11.c
src/ap/sta_info.c
src/ap/sta_info.h

index 1e027068bc9f0d87e1fb8553d506e46b36a9edef..9db84d800ad3afdd80740b247def2dc474fd38c9 100644 (file)
@@ -40,6 +40,10 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
        struct sta_info *sta;
        int new_assoc, res;
        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) {
                /*
@@ -87,6 +91,14 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
        }
        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 (ie == NULL || ielen == 0) {
                        if (hapd->conf->wps_state) {
index 5681bb568d02ab3c07e8439a625074096a81d0d7..990d73759b1bf12745835822c980b22efdcfb4b3 100644 (file)
@@ -773,6 +773,17 @@ static u16 check_assoc_ies(struct hostapd_data *hapd, struct sta_info *sta,
        } else
                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;
 }
 
index 335c9a5bd7240a043a88fd6c37e8359d25ab10d5..b0c80f5048a5e39dd66971f856acd33bd07d3542 100644 (file)
@@ -200,6 +200,7 @@ void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
 #endif /* CONFIG_IEEE80211W */
 
        wpabuf_free(sta->wps_ie);
+       wpabuf_free(sta->p2p_ie);
 
        os_free(sta->ht_capabilities);
 
index 55faa5a28c5e98331a4e47977a6f6d81b858a3a3..e65ddef0e19d6102703598bc98442bc6eaba283b 100644 (file)
@@ -104,6 +104,7 @@ struct sta_info {
 #endif /* CONFIG_IEEE80211W */
 
        struct wpabuf *wps_ie; /* WPS IE from (Re)Association Request */
+       struct wpabuf *p2p_ie; /* P2P IE from (Re)Association Request */
 };