mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-01-03 02:02:33 +01:00
p2p: Build our Probe Response using connection data
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.
This commit is contained in:
parent
619a5ed43b
commit
a4fa91a695
28
src/p2p.c
28
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,
|
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));
|
uint8_t resp_buf[64] __attribute__ ((aligned));
|
||||||
size_t resp_len = 0;
|
size_t resp_len = 0;
|
||||||
@ -3181,14 +3182,21 @@ static void p2p_device_send_probe_resp(struct p2p_device *dev,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wsc_info.state = WSC_STATE_CONFIGURED;
|
if (to_conn_peer) {
|
||||||
wsc_info.response_type = WSC_RESPONSE_TYPE_ENROLLEE_OPEN_8021X;
|
wsc_info.device_password_id = dev->conn_password_id;
|
||||||
wsc_info.uuid_e[15] = 0x01;
|
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.serial_number[0] = '0';
|
||||||
wsc_info.primary_device_type = dev->device_info.primary_device_type;
|
wsc_info.primary_device_type = dev->device_info.primary_device_type;
|
||||||
l_strlcpy(wsc_info.device_name, dev->device_info.device_name,
|
l_strlcpy(wsc_info.device_name, dev->device_info.device_name,
|
||||||
sizeof(wsc_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.rf_bands = 0x01; /* 2.4GHz */
|
||||||
wsc_info.version2 = true;
|
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[iov_len].iov_len = wsc_ie_size;
|
||||||
iov_len++;
|
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_base = wfd_ie;
|
||||||
iov[iov_len].iov_len = p2p_build_wfd_ie(p2p_own_wfd, wfd_ie);
|
iov[iov_len].iov_len = p2p_build_wfd_ie(p2p_own_wfd, wfd_ie);
|
||||||
iov_len++;
|
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
|
* DSSS Channel etc. in the Probe Request, and to build the
|
||||||
* Response body.
|
* 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;
|
goto p2p_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user