P2P: Preparations for adding P2P IE into Beacon/Probe Response frames
This commit is contained in:
parent
b305c684b8
commit
c2af2afb3b
3 changed files with 52 additions and 0 deletions
|
@ -50,8 +50,48 @@ static int hostapd_set_ap_wps_ie(struct hostapd_data *hapd)
|
||||||
beacon = hapd->wps_beacon_ie;
|
beacon = hapd->wps_beacon_ie;
|
||||||
proberesp = hapd->wps_probe_resp_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);
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -235,6 +235,13 @@ static void hostapd_cleanup(struct hostapd_data *hapd)
|
||||||
|
|
||||||
os_free(hapd->probereq_cb);
|
os_free(hapd->probereq_cb);
|
||||||
hapd->probereq_cb = NULL;
|
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 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -180,6 +180,11 @@ struct hostapd_data {
|
||||||
void (*wps_reg_success_cb)(void *ctx, const u8 *mac_addr,
|
void (*wps_reg_success_cb)(void *ctx, const u8 *mac_addr,
|
||||||
const u8 *uuid_e);
|
const u8 *uuid_e);
|
||||||
void *wps_reg_success_cb_ctx;
|
void *wps_reg_success_cb_ctx;
|
||||||
|
|
||||||
|
#ifdef CONFIG_P2P
|
||||||
|
struct wpabuf *p2p_beacon_ie;
|
||||||
|
struct wpabuf *p2p_probe_resp_ie;
|
||||||
|
#endif /* CONFIG_P2P */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue