Browse Source

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>
Mikael Kanstrup 10 years ago
parent
commit
431dd8bb11
1 changed files with 14 additions and 6 deletions
  1. 14 6
      wpa_supplicant/p2p_supplicant.c

+ 14 - 6
wpa_supplicant/p2p_supplicant.c

@@ -5507,13 +5507,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;
 	}