aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2012-01-08 17:35:33 (GMT)
committerJouni Malinen <j@w1.fi>2012-01-08 17:35:33 (GMT)
commit8017b538e70f2c27feefb8746ae1f876d2c42f37 (patch)
tree6ebcd3c8b32eb2b59cec44f135003c6ef10dad88
parent6d92fa6e9209172ae6f4aec5fb4d84ed5e27edb4 (diff)
downloadhostap-8017b538e70f2c27feefb8746ae1f876d2c42f37.zip
hostap-8017b538e70f2c27feefb8746ae1f876d2c42f37.tar.gz
hostap-8017b538e70f2c27feefb8746ae1f876d2c42f37.tar.bz2
P2P: Use Device ID attribute to filter Probe Request frames as GO
The Device ID attribute was already used in Listen state, but it was ignored in GO role. Verify that there is a match with Device ID in GO rule, too, before replying to the Probe Request frame. Signed-hostap: Jouni Malinen <j@w1.fi>
-rw-r--r--src/ap/beacon.c12
-rw-r--r--src/p2p/p2p.h5
-rw-r--r--src/p2p/p2p_group.c25
3 files changed, 42 insertions, 0 deletions
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 4d8b277..4ea8684 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -343,6 +343,18 @@ void handle_probe_req(struct hostapd_data *hapd,
}
wpabuf_free(wps);
}
+
+ if (hapd->p2p && elems.p2p) {
+ struct wpabuf *p2p;
+ p2p = ieee802_11_vendor_ie_concat(ie, ie_len, P2P_IE_VENDOR_TYPE);
+ if (p2p && !p2p_group_match_dev_id(hapd->p2p_group, p2p)) {
+ wpa_printf(MSG_MSGDUMP, "P2P: Ignore Probe Request "
+ "due to mismatch with Device ID");
+ wpabuf_free(p2p);
+ return;
+ }
+ wpabuf_free(p2p);
+ }
#endif /* CONFIG_P2P */
if (hapd->conf->ignore_broadcast_ssid && elems.ssid_len == 0) {
diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h
index 762499a..ce41ca8 100644
--- a/src/p2p/p2p.h
+++ b/src/p2p/p2p.h
@@ -1327,6 +1327,11 @@ int p2p_group_notif_noa(struct p2p_group *group, const u8 *noa,
int p2p_group_match_dev_type(struct p2p_group *group, struct wpabuf *wps);
/**
+ * p2p_group_match_dev_id - Match P2P Device Address in group with requested device id
+ */
+int p2p_group_match_dev_id(struct p2p_group *group, struct wpabuf *p2p);
+
+/**
* p2p_group_go_discover - Send GO Discoverability Request to a group client
* @group: P2P group context from p2p_group_init()
* Returns: 0 on success (frame scheduled); -1 if client was not found
diff --git a/src/p2p/p2p_group.c b/src/p2p/p2p_group.c
index 59d1507..6fa3e21 100644
--- a/src/p2p/p2p_group.c
+++ b/src/p2p/p2p_group.c
@@ -490,6 +490,31 @@ int p2p_group_match_dev_type(struct p2p_group *group, struct wpabuf *wps)
}
+int p2p_group_match_dev_id(struct p2p_group *group, struct wpabuf *p2p)
+{
+ struct p2p_group_member *m;
+ struct p2p_message msg;
+
+ os_memset(&msg, 0, sizeof(msg));
+ if (p2p_parse_p2p_ie(p2p, &msg))
+ return 1; /* Failed to parse - assume no filter on Device ID */
+
+ if (!msg.device_id)
+ return 1; /* No filter on Device ID */
+
+ if (os_memcmp(msg.device_id, group->p2p->cfg->dev_addr, ETH_ALEN) == 0)
+ return 1; /* Match with our P2P Device Address */
+
+ for (m = group->members; m; m = m->next) {
+ if (os_memcmp(msg.device_id, m->dev_addr, ETH_ALEN) == 0)
+ return 1; /* Match with group client P2P Device Address */
+ }
+
+ /* No match with Device ID */
+ return 0;
+}
+
+
void p2p_group_notif_formation_done(struct p2p_group *group)
{
if (group == NULL)