All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] p2p: Send the right UUID-E in probe request WSC IEs
@ 2020-08-25  2:45 Andrew Zaborowski
  2020-08-25  2:45 ` [PATCH 2/3] p2p: Fix the WSC Config Methods in GO Negotiation Response Andrew Zaborowski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrew Zaborowski @ 2020-08-25  2:45 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1633 bytes --]

When building the scan IEs for our provisioning scans, use the UUID-E
based on the Interface Address, not the Device Address, as that is what
wsc.c will be using to in the registration protocol.

Eventually we may have to base the UUID-E on the Device Address or
something else that is persistent, and pass the actual UUID-E to wsc.c,
as the Interface Address is randomly generated on every connect attempt.
IIRC the UUID-E is supposed to be persistent.
---
 src/p2p.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/p2p.c b/src/p2p.c
index 3b38f738..7772080b 100644
--- a/src/p2p.c
+++ b/src/p2p.c
@@ -329,6 +329,7 @@ static uint8_t *p2p_build_scan_ies(struct p2p_device *dev, uint8_t *buf,
 	size_t wsc_ie_size;
 	uint8_t wfd_ie[32];
 	size_t wfd_ie_size;
+	const uint8_t *addr;
 
 	p2p_info.capability = dev->capability;
 	memcpy(p2p_info.listen_channel.country, dev->listen_country, 3);
@@ -350,7 +351,14 @@ static uint8_t *p2p_build_scan_ies(struct p2p_device *dev, uint8_t *buf,
 	wsc_info.request_type = WSC_REQUEST_TYPE_ENROLLEE_INFO;
 	wsc_info.config_methods = dev->device_info.wsc_config_methods;
 
-	if (!wsc_uuid_from_addr(dev->addr, wsc_info.uuid_e))
+	/*
+	 * If we're doing the provisioning scan, we need to use the same UUID-E
+	 * that we'll use in the WSC enrollee registration protocol because the
+	 * GO might validate it.
+	 */
+	addr = dev->conn_peer ? dev->conn_addr : dev->addr;
+
+	if (!wsc_uuid_from_addr(addr, wsc_info.uuid_e))
 		return NULL;
 
 	wsc_info.primary_device_type = dev->device_info.primary_device_type;
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] p2p: Fix the WSC Config Methods in GO Negotiation Response
  2020-08-25  2:45 [PATCH 1/3] p2p: Send the right UUID-E in probe request WSC IEs Andrew Zaborowski
@ 2020-08-25  2:45 ` Andrew Zaborowski
  2020-08-25  2:45 ` [PATCH 3/3] p2p: Build our Probe Response using connection data Andrew Zaborowski
  2020-08-25 21:53 ` [PATCH 1/3] p2p: Send the right UUID-E in probe request WSC IEs Denis Kenzior
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Zaborowski @ 2020-08-25  2:45 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 659 bytes --]

When we send our GO Negotiation Response, send the Configuration Method
selected for the current connection rather than the accepted methods mask
that we hold in dev->device_info.
---
 src/p2p.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/p2p.c b/src/p2p.c
index 7772080b..f8ed88db 100644
--- a/src/p2p.c
+++ b/src/p2p.c
@@ -1840,6 +1840,7 @@ respond:
 
 	p2p_device_fill_channel_list(dev, &resp_info.channel_list);
 	resp_info.device_info = dev->device_info;
+	resp_info.device_info.wsc_config_methods = dev->conn_config_method;
 	resp_info.device_password_id = dev->conn_password_id;
 
 	if (dev->conn_own_wfd) {
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] p2p: Build our Probe Response using connection data
  2020-08-25  2:45 [PATCH 1/3] p2p: Send the right UUID-E in probe request WSC IEs Andrew Zaborowski
  2020-08-25  2:45 ` [PATCH 2/3] p2p: Fix the WSC Config Methods in GO Negotiation Response Andrew Zaborowski
@ 2020-08-25  2:45 ` Andrew Zaborowski
  2020-08-25 21:53 ` [PATCH 1/3] p2p: Send the right UUID-E in probe request WSC IEs Denis Kenzior
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Zaborowski @ 2020-08-25  2:45 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 2920 bytes --]

When we're sending our probe response to the same peer that we're
currently connected or connecting to, use current WSC Configuration
Methods, UUID-E and WFD IE selected for this connection attempt, not the
ones we'd use when discovering peers or being discovered by peers.
In the case of the WFD IE, the "Available for WFD Session" flag is going
to differ between the two cases -- we may be unavailable for other peers
but we're still available for the peer we're trying to start the WFD
session with.
---
 src/p2p.c | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/src/p2p.c b/src/p2p.c
index f8ed88db..34ff94bf 100644
--- a/src/p2p.c
+++ b/src/p2p.c
@@ -3115,7 +3115,8 @@ static void p2p_probe_resp_done(int error, void *user_data)
 }
 
 static void p2p_device_send_probe_resp(struct p2p_device *dev,
-					const uint8_t *dest_addr)
+					const uint8_t *dest_addr,
+					bool to_conn_peer)
 {
 	uint8_t resp_buf[64] __attribute__ ((aligned));
 	size_t resp_len = 0;
@@ -3181,14 +3182,21 @@ static void p2p_device_send_probe_resp(struct p2p_device *dev,
 		return;
 	}
 
-	wsc_info.state = WSC_STATE_CONFIGURED;
-	wsc_info.response_type = WSC_RESPONSE_TYPE_ENROLLEE_OPEN_8021X;
-	wsc_info.uuid_e[15] = 0x01;
+	if (to_conn_peer) {
+		wsc_info.device_password_id = dev->conn_password_id;
+		wsc_info.config_methods = dev->conn_config_method;
+		wsc_uuid_from_addr(dev->conn_addr, wsc_info.uuid_e);
+	} else {
+		wsc_info.config_methods = dev->device_info.wsc_config_methods;
+		wsc_uuid_from_addr(dev->addr, wsc_info.uuid_e);
+	}
+
+	wsc_info.state = WSC_STATE_NOT_CONFIGURED;
+	wsc_info.response_type = WSC_RESPONSE_TYPE_ENROLLEE_INFO;
 	wsc_info.serial_number[0] = '0';
 	wsc_info.primary_device_type = dev->device_info.primary_device_type;
 	l_strlcpy(wsc_info.device_name, dev->device_info.device_name,
 			sizeof(wsc_info.device_name));
-	wsc_info.config_methods = dev->device_info.wsc_config_methods;
 	wsc_info.rf_bands = 0x01;	/* 2.4GHz */
 	wsc_info.version2 = true;
 
@@ -3220,7 +3228,12 @@ static void p2p_device_send_probe_resp(struct p2p_device *dev,
 	iov[iov_len].iov_len = wsc_ie_size;
 	iov_len++;
 
-	if (p2p_own_wfd) {
+	if (to_conn_peer && dev->conn_own_wfd) {
+		iov[iov_len].iov_base = wfd_ie;
+		iov[iov_len].iov_len = p2p_build_wfd_ie(dev->conn_own_wfd,
+							wfd_ie);
+		iov_len++;
+	} else if (p2p_own_wfd) {
 		iov[iov_len].iov_base = wfd_ie;
 		iov[iov_len].iov_len = p2p_build_wfd_ie(p2p_own_wfd, wfd_ie);
 		iov_len++;
@@ -3308,7 +3321,8 @@ static void p2p_device_probe_cb(const struct mmpdu_header *mpdu,
 		 * DSSS Channel etc. in the Probe Request, and to build the
 		 * Response body.
 		 */
-		p2p_device_send_probe_resp(dev, mpdu->address_2);
+		p2p_device_send_probe_resp(dev, mpdu->address_2,
+						from_conn_peer);
 		goto p2p_free;
 	}
 
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] p2p: Send the right UUID-E in probe request WSC IEs
  2020-08-25  2:45 [PATCH 1/3] p2p: Send the right UUID-E in probe request WSC IEs Andrew Zaborowski
  2020-08-25  2:45 ` [PATCH 2/3] p2p: Fix the WSC Config Methods in GO Negotiation Response Andrew Zaborowski
  2020-08-25  2:45 ` [PATCH 3/3] p2p: Build our Probe Response using connection data Andrew Zaborowski
@ 2020-08-25 21:53 ` Denis Kenzior
  2 siblings, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2020-08-25 21:53 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 676 bytes --]

Hi Andrew,

On 8/24/20 9:45 PM, Andrew Zaborowski wrote:
> When building the scan IEs for our provisioning scans, use the UUID-E
> based on the Interface Address, not the Device Address, as that is what
> wsc.c will be using to in the registration protocol.
> 
> Eventually we may have to base the UUID-E on the Device Address or
> something else that is persistent, and pass the actual UUID-E to wsc.c,
> as the Interface Address is randomly generated on every connect attempt.
> IIRC the UUID-E is supposed to be persistent.
> ---
>   src/p2p.c | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
> 

All applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-25 21:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-25  2:45 [PATCH 1/3] p2p: Send the right UUID-E in probe request WSC IEs Andrew Zaborowski
2020-08-25  2:45 ` [PATCH 2/3] p2p: Fix the WSC Config Methods in GO Negotiation Response Andrew Zaborowski
2020-08-25  2:45 ` [PATCH 3/3] p2p: Build our Probe Response using connection data Andrew Zaborowski
2020-08-25 21:53 ` [PATCH 1/3] p2p: Send the right UUID-E in probe request WSC IEs Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.