diff mbox

P2P: Use neg_freq when re-establish persistent group as GC

Message ID CACZXzRCryfyBo0D-b8m=r0XdrxmbHWCNi8NmVQxS53L8-1DiXg@mail.gmail.com
State Accepted
Headers show

Commit Message

Mikael Kanstrup Oct. 22, 2014, 10:01 a.m. UTC
When GC receives invitation response and tries to re-establish
connection to a persistent group channels from passive list should
be allowed. A missing check for operation mode triggered reselection
of operating channel from active channels only to happen and thus fail
the connect attempt.

Add a check for operation mode and if GC instead use negotiated
frequency (i.e. GO operating channel from invitation response).

Signed-off-by: Mikael Kanstrup <mikael.kanstrup@sonymobile.com>
---
 wpa_supplicant/p2p_supplicant.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

Comments

Jouni Malinen Oct. 25, 2014, 8:56 p.m. UTC | #1
On Wed, Oct 22, 2014 at 12:01:54PM +0200, Mikael Kanstrup wrote:
> When GC receives invitation response and tries to re-establish
> connection to a persistent group channels from passive list should
> be allowed. A missing check for operation mode triggered reselection
> of operating channel from active channels only to happen and thus fail
> the connect attempt.
> 
> Add a check for operation mode and if GC instead use negotiated
> frequency (i.e. GO operating channel from invitation response).

Thanks, applied.
diff mbox

Patch

From 7bf41f560b02eafbc0c7bf9991184c85fdc5b384 Mon Sep 17 00:00:00 2001
From: Mikael Kanstrup <mikael.kanstrup@sonymobile.com>
Date: Tue, 21 Oct 2014 12:08:30 +0200
Subject: [PATCH] P2P: Use neg_freq when re-establish persistent group as GC

When GC receives invitation response and tries to re-establish
connection to a persistent group channels from passive list should
be allowed. A missing check for operation mode triggered reselection
of operating channel from active channels only to happen and thus fail
the connect attempt.

Add a check for operation mode and if GC instead use negotiated
frequency (i.e. GO operating channel from invitation response).

Signed-off-by: Mikael Kanstrup <mikael.kanstrup@sonymobile.com>
---
 wpa_supplicant/p2p_supplicant.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index d0e9e05..36d3bac 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -5487,13 +5487,21 @@  int wpas_p2p_group_add_persistent(struct wpa_supplicant *wpa_s,
 
 	wpa_s->p2p_fallback_to_go_neg = 0;
 
-	if (force_freq > 0) {
-		freq = wpas_p2p_select_go_freq(wpa_s, force_freq);
-		if (freq < 0)
-			return -1;
+	if (ssid->mode == WPAS_MODE_P2P_GO) {
+		if (force_freq > 0) {
+			freq = wpas_p2p_select_go_freq(wpa_s, force_freq);
+			if (freq < 0)
+				return -1;
+		} else {
+			freq = wpas_p2p_select_go_freq(wpa_s, neg_freq);
+			if (freq < 0 ||
+			    (freq > 0 && !freq_included(channels, freq)))
+				freq = 0;
+		}
 	} else {
-		freq = wpas_p2p_select_go_freq(wpa_s, neg_freq);
-		if (freq < 0 || (freq > 0 && !freq_included(channels, freq)))
+		freq = neg_freq;
+		if (freq < 0 ||
+		    (freq > 0 && !freq_included(channels, freq)))
 			freq = 0;
 	}
 
-- 
1.8.2.2