P2P: Check Device ID match in Probe Request frames in Listen state
Do not reply to Probe Request frames that include a Device ID that does not match with our own P2P Device Address.
This commit is contained in:
parent
04a85e4401
commit
97c5b3c45b
1 changed files with 20 additions and 7 deletions
|
@ -1651,7 +1651,7 @@ static void p2p_reply_probe(struct p2p_data *p2p, const u8 *addr,
|
||||||
struct ieee802_11_elems elems;
|
struct ieee802_11_elems elems;
|
||||||
struct wpabuf *buf;
|
struct wpabuf *buf;
|
||||||
struct ieee80211_mgmt *resp;
|
struct ieee80211_mgmt *resp;
|
||||||
struct wpabuf *wps;
|
struct p2p_message msg;
|
||||||
struct wpabuf *ies;
|
struct wpabuf *ies;
|
||||||
|
|
||||||
if (!p2p->in_listen || !p2p->drv_in_listen) {
|
if (!p2p->in_listen || !p2p->drv_in_listen) {
|
||||||
|
@ -1689,14 +1689,27 @@ static void p2p_reply_probe(struct p2p_data *p2p, const u8 *addr,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check Requested Device Type match */
|
os_memset(&msg, 0, sizeof(msg));
|
||||||
wps = ieee802_11_vendor_ie_concat(ie, ie_len, WPS_DEV_OUI_WFA);
|
if (p2p_parse_ies(ie, ie_len, &msg) < 0) {
|
||||||
if (wps && !p2p_match_dev_type(p2p, wps)) {
|
/* Could not parse P2P attributes */
|
||||||
wpabuf_free(wps);
|
|
||||||
/* No match with Requested Device Type */
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wpabuf_free(wps);
|
|
||||||
|
if (msg.device_id &&
|
||||||
|
os_memcmp(msg.device_id, p2p->cfg->dev_addr, ETH_ALEN != 0)) {
|
||||||
|
/* Device ID did not match */
|
||||||
|
p2p_parse_free(&msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check Requested Device Type match */
|
||||||
|
if (msg.wps_attributes &&
|
||||||
|
!p2p_match_dev_type(p2p, msg.wps_attributes)) {
|
||||||
|
/* No match with Requested Device Type */
|
||||||
|
p2p_parse_free(&msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p2p_parse_free(&msg);
|
||||||
|
|
||||||
if (!p2p->cfg->send_probe_resp)
|
if (!p2p->cfg->send_probe_resp)
|
||||||
return; /* Response generated elsewhere */
|
return; /* Response generated elsewhere */
|
||||||
|
|
Loading…
Add table
Reference in a new issue