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.
Bug: 166276733
Test: atest CtsWifiTestCases
Change-Id: I0c791c2e6f27b7d41928bf5cfe6673a8276c629d
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index b0bea61..21151a8 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -9383,6 +9383,12 @@
/* 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 be lost. 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 */
@@ -9406,6 +9412,9 @@
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;