diff mbox series

p2p: set ap_configured_cb during p2p group reform process

Message ID CALoVRkPqDBTg+MntjWzARMifMnFA8Em=N=mfS0xWQ3G+xrrB2A@mail.gmail.com
State Accepted
Headers show
Series p2p: set ap_configured_cb during p2p group reform process | expand

Commit Message

Jimmy Chen Aug. 27, 2020, 6:15 a.m. UTC
Hi,

We found that if REMOVE-AND-REFORM occurs before a group is started,
it would not send out GROUP-STARTED-EVENT after AP is enabled.

The reason is that ap_configured_cb is cleared in the remove-and-reform process.
If a group is not started, p2p_go_configured will not be called after
completing AP setup.

Best regards,
Jimmy

Comments

Jouni Malinen Oct. 11, 2020, 6:26 p.m. UTC | #1
On Thu, Aug 27, 2020 at 02:15:16PM +0800, Jimmy Chen wrote:
> In the remove-and-reform process, ap_configured_cb is cleared.
> If a group is not started, p2p_go_configured will not be called
> after completing AP setup.

Thanks, applied.
diff mbox series

Patch

From bfdae95156ca2da632e9fec8cdee38244e0ab669 Mon Sep 17 00:00:00 2001
From: Jimmy Chen <jimmycmchen@google.com>
Date: Wed, 26 Aug 2020 18:55:45 +0800
Subject: [PATCH] p2p: set ap_configured_cb during p2p group reform process

In the remove-and-reform process, ap_configured_cb is cleared.
If a group is not started, p2p_go_configured will not be called
after completing AP setup.

Signed-off-by: Jimmy Chen <jimmycmchen@google.com>
---
 wpa_supplicant/p2p_supplicant.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index e94bffe52..d7b81ceb0 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -9375,6 +9375,12 @@  static void wpas_p2p_move_go_no_csa(struct wpa_supplicant *wpa_s)
 	/* Stop the AP functionality */
 	/* TODO: Should do this in a way that does not indicated to possible
 	 * P2P Clients in the group that the group is terminated. */
+	/* If this action occurs before a group is started, the callback should be
+	 * preserved, or GROUP-STARTED event would loss. If this action occurs after
+	 * a group is started, these poiners are all NULL and harmless. */
+	void (*ap_configured_cb)(void *ctx, void *data) = wpa_s->ap_configured_cb;
+	void *ap_configured_cb_ctx = wpa_s->ap_configured_cb_ctx;;
+	void *ap_configured_cb_data = wpa_s->ap_configured_cb_data;
 	wpa_supplicant_ap_deinit(wpa_s);
 
 	/* Reselect the GO frequency */
@@ -9398,6 +9404,9 @@  static void wpas_p2p_move_go_no_csa(struct wpa_supplicant *wpa_s)
 		return;
 	}
 
+	wpa_s->ap_configured_cb = ap_configured_cb;
+	wpa_s->ap_configured_cb_ctx = ap_configured_cb_ctx;
+	wpa_s->ap_configured_cb_data = ap_configured_cb_data;
 	/* Update the frequency */
 	current_ssid->frequency = params.freq;
 	wpa_s->connect_without_scan = current_ssid;
-- 
2.28.0.297.g1956fa8f8d-goog