[PATCH 09/10] P2PS: Set intended interface address correctly for new group
Ilan Peer
ilan.peer
Thu Jul 2 00:45:07 PDT 2015
From: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
If a device may be explicit GO, it adds GO details in PD request. First
we try to reuse an active GO. If it is not present, we try to reuse
a non-active persistent group. In later case, if dedicated p2p interface is
needed, the intended address should be that of the pending interface.
However the wpas_get_go_info() provided ssid->bssid address, which is the
address of the p2p device. This might result in an incorrect intended
interface attribute in PD request in case a separate group interface
is used.
Fix this by setting group_iface variable to true only if a dedicated
interface should be used and set the attribute accordingly.
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
Reviewed-by: Max Stepanov <Max.Stepanov at intel.com>
Reviewed-by: Ilan Peer <ilan.peer at intel.com>
---
src/p2p/p2p_pd.c | 6 +++++-
wpa_supplicant/p2p_supplicant.c | 15 +++++++++++----
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/src/p2p/p2p_pd.c b/src/p2p/p2p_pd.c
index 217311a..be167bd 100644
--- a/src/p2p/p2p_pd.c
+++ b/src/p2p/p2p_pd.c
@@ -57,7 +57,11 @@ static void p2ps_add_new_group_info(struct p2p_data *p2p, struct wpabuf *buf)
if (found) {
p2p_buf_add_group_id(buf, p2p->cfg->dev_addr,
ssid, ssid_len);
- p2p_buf_add_intended_addr(buf, intended_addr);
+
+ if (group_iface)
+ p2p_buf_add_intended_addr(buf, p2p->intended_addr);
+ else
+ p2p_buf_add_intended_addr(buf, intended_addr);
} else {
if (!p2p->ssid_set) {
p2p_build_ssid(p2p, p2p->ssid, &p2p->ssid_len);
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 388e200..f5e8add 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -3545,17 +3545,24 @@ static int wpas_get_go_info(void *ctx, u8 *intended_addr,
struct wpa_ssid *s;
u8 bssid[ETH_ALEN];
+ /*
+ * group_iface will be set to 1 only if a dedicated interface for p2p
+ * role is required. First we try to reuse an active GO, however
+ * if it is not present, we will try to reactivate an existing
+ * persistent group and set group_iface to 1, so the caller will know
+ * that the pending interface should be used.
+ */
+ *group_iface = 0;
s = wpas_p2p_group_go_ssid(wpa_s, bssid);
if (!s) {
s = wpas_p2p_get_persistent_go(wpa_s);
+ *group_iface = wpas_p2p_create_iface(wpa_s);
if (s)
os_memcpy(bssid, s->bssid, ETH_ALEN);
+ else
+ return 0;
}
- *group_iface = wpas_p2p_create_iface(wpa_s);
- if (!s)
- return 0;
-
os_memcpy(intended_addr, bssid, ETH_ALEN);
os_memcpy(ssid, s->ssid, s->ssid_len);
*ssid_len = s->ssid_len;
--
1.9.1
More information about the Hostap
mailing list