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(+)
@@ -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