diff mbox

[10/10] P2PS: Save intended interface address after P2PS PD

Message ID 1435823108-25514-11-git-send-email-ilan.peer@intel.com
State Accepted
Headers show

Commit Message

Peer, Ilan July 2, 2015, 7:45 a.m. UTC
From: Andrei Otcheretianski <andrei.otcheretianski@intel.com>

One possible outcome of the P2PS PD is P2P GO/P2P CLI. In this case
one peer becomes a P2P GO and the P2P CLI joins it. Since multiple
GOs may run simultaneously on the same P2P device, the P2P client should
join using the intended interface address.

In order to be able to find the device by the intended interface address,
save it during the PD.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
---
 src/p2p/p2p_i.h  | 2 ++
 src/p2p/p2p_pd.c | 6 ++++++
 2 files changed, 8 insertions(+)
diff mbox

Patch

diff --git a/src/p2p/p2p_i.h b/src/p2p/p2p_i.h
index a1042d2..0460e1b 100644
--- a/src/p2p/p2p_i.h
+++ b/src/p2p/p2p_i.h
@@ -53,6 +53,8 @@  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 in order to store the intended
+	 * GO address of this device.
 	 */
 	u8 interface_addr[ETH_ALEN];
 
diff --git a/src/p2p/p2p_pd.c b/src/p2p/p2p_pd.c
index be167bd..33bc93e 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);
@@ -1121,6 +1125,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;