From b843a8b8a6150d1364efb7d9c05bec913b65c3bd Mon Sep 17 00:00:00 2001 From: Andrei Otcheretianski Date: Thu, 2 Jul 2015 10:45:08 +0300 Subject: [PATCH] P2PS: Save intended interface address after P2PS PD One possible outcome of the P2PS PD is P2P GO/P2P Client. In this case, one peer becomes a P2P GO and the P2P Client joins it. Since multiple GOs may run simultaneously on the same P2P Device, the P2P Client should join using the intended interface address. To be able to find the device by the intended interface address, save it during the PD. Signed-off-by: Andrei Otcheretianski Reviewed-by: Max Stepanov Reviewed-by: Ilan Peer --- src/p2p/p2p_i.h | 3 +++ src/p2p/p2p_pd.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/p2p/p2p_i.h b/src/p2p/p2p_i.h index a1042d230..f4b24058b 100644 --- a/src/p2p/p2p_i.h +++ b/src/p2p/p2p_i.h @@ -53,6 +53,9 @@ struct p2p_device { * from Beacon/Probe Response), the interface address is stored here. * p2p_device_addr must still be set in such a case to the unique * identifier for the P2P Device. + * + * This field is also used during P2PS PD to store the intended GO + * address of the peer. */ u8 interface_addr[ETH_ALEN]; diff --git a/src/p2p/p2p_pd.c b/src/p2p/p2p_pd.c index 134223198..5366d8db7 100644 --- a/src/p2p/p2p_pd.c +++ b/src/p2p/p2p_pd.c @@ -821,6 +821,10 @@ out: dev->wps_prov_info = 0; break; } + + if (msg.intended_addr) + os_memcpy(dev->interface_addr, + msg.intended_addr, ETH_ALEN); } } p2p_parse_free(&msg); @@ -1120,6 +1124,8 @@ void p2p_process_prov_disc_resp(struct p2p_data *p2p, const u8 *sa, /* Store the provisioning info */ dev->wps_prov_info = msg.wps_config_methods; + if (msg.intended_addr) + os_memcpy(dev->interface_addr, msg.intended_addr, ETH_ALEN); p2p_parse_free(&msg); success = 1;