P2P: Preparations for adding P2P IE into Beacon/Probe Response frames

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

View file

@ -50,8 +50,48 @@ static int hostapd_set_ap_wps_ie(struct hostapd_data *hapd)
beacon = hapd->wps_beacon_ie;
proberesp = hapd->wps_probe_resp_ie;
#ifdef CONFIG_P2P
if (hapd->wps_beacon_ie == NULL && hapd->p2p_beacon_ie == NULL)
beacon = NULL;
else {
beacon = wpabuf_alloc((hapd->wps_beacon_ie ?
wpabuf_len(hapd->wps_beacon_ie) : 0) +
(hapd->p2p_beacon_ie ?
wpabuf_len(hapd->p2p_beacon_ie) : 0));
if (beacon == NULL)
return -1;
if (hapd->wps_beacon_ie)
wpabuf_put_buf(beacon, hapd->wps_beacon_ie);
if (hapd->p2p_beacon_ie)
wpabuf_put_buf(beacon, hapd->p2p_beacon_ie);
}
if (hapd->wps_probe_resp_ie == NULL && hapd->p2p_probe_resp_ie == NULL)
proberesp = NULL;
else {
proberesp = wpabuf_alloc(
(hapd->wps_probe_resp_ie ?
wpabuf_len(hapd->wps_probe_resp_ie) : 0) +
(hapd->p2p_probe_resp_ie ?
wpabuf_len(hapd->p2p_probe_resp_ie) : 0));
if (proberesp == NULL) {
wpabuf_free(beacon);
return -1;
}
if (hapd->wps_probe_resp_ie)
wpabuf_put_buf(proberesp, hapd->wps_probe_resp_ie);
if (hapd->p2p_probe_resp_ie)
wpabuf_put_buf(proberesp, hapd->p2p_probe_resp_ie);
}
#endif /* CONFIG_P2P */
ret = hapd->driver->set_ap_wps_ie(hapd->drv_priv, beacon, proberesp);
#ifdef CONFIG_P2P
wpabuf_free(beacon);
wpabuf_free(proberesp);
#endif /* CONFIG_P2P */
return ret;
}

View file

@ -235,6 +235,13 @@ static void hostapd_cleanup(struct hostapd_data *hapd)
os_free(hapd->probereq_cb);
hapd->probereq_cb = NULL;
#ifdef CONFIG_P2P
wpabuf_free(hapd->p2p_beacon_ie);
hapd->p2p_beacon_ie = NULL;
wpabuf_free(hapd->p2p_probe_resp_ie);
hapd->p2p_probe_resp_ie = NULL;
#endif /* CONFIG_P2P */
}

View file

@ -180,6 +180,11 @@ struct hostapd_data {
void (*wps_reg_success_cb)(void *ctx, const u8 *mac_addr,
const u8 *uuid_e);
void *wps_reg_success_cb_ctx;
#ifdef CONFIG_P2P
struct wpabuf *p2p_beacon_ie;
struct wpabuf *p2p_probe_resp_ie;
#endif /* CONFIG_P2P */
};