p2p: Send the right UUID-E in probe request WSC IEs
PATCH 1/3 p2p: Send the right UUID-E in probe request WSC IEs
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(-)
src/p2p.c +9 -1
@@ -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;
Signature · 1 line
2.25.1
PATCH 2/3 p2p: Fix the WSC Config Methods in GO Negotiation Response
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(+)
src/p2p.c +1 -0
@@ -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) {
Signature · 1 line
2.25.1
PATCH 3/3 p2p: Build our Probe Response using connection data
In reply to Andrew ZaborowskiWhen 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(-)
src/p2p.c +21 -7
@@ -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; }
Signature · 1 line
2.25.1
Hi Andrew,
Quoted 4 lines · Andrew Zaborowski
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.cwill be using to in the registration protocol.
Quoted 8 lines
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