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 1e02706..9db84d8 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 5681bb5..990d737 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 335c9a5..b0c80f5 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 55faa5a..e65ddef 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 */
 };