[PATCH 18/19] P2PS: add a wildcard with other advertised service info

Ilan Peer ilan.peer
Wed Jun 10 01:43:48 PDT 2015


From: Max Stepanov <Max.Stepanov at intel.com>

Quoting WFDS spec: "If multiple Service Hash values are included in the
Probe Request frame the ASP shall find a match for each Service Hash,
and it shall send a Probe Response frame with the information listed for
all matched Service Hashes." This patch changes a handling of a wildcard
hash matching by adding a wildcard 'org.wi-fi.wfds' info together with other
hash matches.

Signed-off-by: Max Stepanov <Max.Stepanov at intel.com>
Reviewed-by: Ilan Peer <ilan.peer at intel.com>
---
 src/p2p/p2p_build.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/p2p/p2p_build.c b/src/p2p/p2p_build.c
index 03bd458..21c9a6a 100644
--- a/src/p2p/p2p_build.c
+++ b/src/p2p/p2p_build.c
@@ -552,8 +552,6 @@ void p2p_buf_add_service_instance(struct wpabuf *buf, struct p2p_data *p2p,
 		return;
 
 	p2ps_wildcard  = p2p_p2ps_wildcard_hash(p2p, hash, hash_count);
-	if (p2ps_wildcard)
-		goto end;
 
 	/* Allocate temp buffer, allowing for overflow of 1 instance */
 	tmp_buf = wpabuf_alloc(MAX_SVC_ADV_IE_LEN + 256 + P2PS_HASH_LEN);
@@ -573,6 +571,13 @@ void p2p_buf_add_service_instance(struct wpabuf *buf, struct p2p_data *p2p,
 	p2p_buf_update_ie_hdr(tmp_buf, ie_len);
 	pos = wpabuf_put(tmp_buf, 0);
 
+	if (p2ps_wildcard) {
+		p2p_buf_add_service_info(tmp_buf, p2p,
+					 0, 0, P2PS_WILD_HASH_STR,
+					 &ie_len, &pos, &total_len, attr_len);
+		p2ps_wildcard = 0;
+	}
+
 	/* add advertised service info of matching services */
 	for (adv = adv_list; adv && total_len <= MAX_SVC_ADV_LEN;
 	     adv = adv->next) {
@@ -604,10 +609,8 @@ void p2p_buf_add_service_instance(struct wpabuf *buf, struct p2p_data *p2p,
 
 end:
 	if (p2ps_wildcard) {
-		/* Add the attibute with P2PS wildcard if either a
-		 * wildcard hash was present in a probe request hash
-		 * attribute or we failed to add at least one matching
-		 * advertisement.
+		/* Add a singe attibute with P2PS wildcard if we failed
+		 * to add at least one matching advertisement.
 		 */
 		ie_len = p2p_buf_add_ie_hdr(buf);
 		wpabuf_put_u8(buf, P2P_ATTR_ADVERTISED_SERVICE);
-- 
1.9.1




More information about the Hostap mailing list