P2P: Filter Probe Request frames based on DA and BSSID in Listen state

Only accept Probe Request frames that have a Wildcard BSSID and a
destination address that matches with our P2P Device Address or is the
broadcast address per P2P specification 3.1.2.1.1.
This commit is contained in:
Jouni Malinen 2011-07-15 20:25:53 +03:00
parent 15f0961447
commit 04a85e4401
15 changed files with 72 additions and 22 deletions

View file

@ -1644,7 +1644,8 @@ struct wpabuf * p2p_build_probe_resp_ies(struct p2p_data *p2p)
}
static void p2p_reply_probe(struct p2p_data *p2p, const u8 *addr, const u8 *ie,
static void p2p_reply_probe(struct p2p_data *p2p, const u8 *addr,
const u8 *dst, const u8 *bssid, const u8 *ie,
size_t ie_len)
{
struct ieee802_11_elems elems;
@ -1669,6 +1670,18 @@ static void p2p_reply_probe(struct p2p_data *p2p, const u8 *addr, const u8 *ie,
return;
}
if (dst && !is_broadcast_ether_addr(dst) &&
os_memcmp(dst, p2p->cfg->dev_addr, ETH_ALEN) != 0) {
/* Not sent to the broadcast address or our P2P Device Address
*/
return;
}
if (bssid && !is_broadcast_ether_addr(bssid)) {
/* Not sent to the Wildcard BSSID */
return;
}
if (elems.ssid == NULL || elems.ssid_len != P2P_WILDCARD_SSID_LEN ||
os_memcmp(elems.ssid, P2P_WILDCARD_SSID, P2P_WILDCARD_SSID_LEN) !=
0) {
@ -1750,12 +1763,12 @@ static void p2p_reply_probe(struct p2p_data *p2p, const u8 *addr, const u8 *ie,
}
int p2p_probe_req_rx(struct p2p_data *p2p, const u8 *addr, const u8 *ie,
size_t ie_len)
int p2p_probe_req_rx(struct p2p_data *p2p, const u8 *addr, const u8 *dst,
const u8 *bssid, const u8 *ie, size_t ie_len)
{
p2p_add_dev_from_probe_req(p2p, addr, ie, ie_len);
p2p_reply_probe(p2p, addr, ie, ie_len);
p2p_reply_probe(p2p, addr, dst, bssid, ie, ie_len);
if ((p2p->state == P2P_CONNECT || p2p->state == P2P_CONNECT_LISTEN) &&
p2p->go_neg_peer &&