[PATCH v2 2/3] P2P: Add a testing option to force P2P GO CSA

Ilan Peer ilan.peer at intel.com
Sun Nov 22 05:57:51 PST 2015


Add a testing option to force a P2P GO CSA on successful
invitation to join an active P2P GO.

Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 wpa_supplicant/ctrl_iface.c       |  2 ++
 wpa_supplicant/p2p_supplicant.c   | 14 +++++++++++++-
 wpa_supplicant/wpa_supplicant_i.h |  1 +
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 6113db6..f10a85a 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -467,6 +467,8 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
 		wpa_s->extra_roc_dur = atoi(value);
 	} else if (os_strcasecmp(cmd, "test_failure") == 0) {
 		wpa_s->test_failure = atoi(value);
+	} else if (os_strcasecmp(cmd, "p2p_go_csa_on_inv") == 0) {
+		wpa_s->p2p_go_csa_on_inv = !!atoi(value);
 #endif /* CONFIG_TESTING_OPTIONS */
 #ifndef CONFIG_NO_CONFIG_BLOBS
 	} else if (os_strcmp(cmd, "blob") == 0) {
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index fd2c5ce..d2a4535 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -3111,8 +3111,20 @@ static void wpas_invitation_result(void *ctx, int status, const u8 *bssid,
 		 */
 		if (status == P2P_SC_SUCCESS &&
 		    group_if && group_if->current_ssid &&
-		    group_if->current_ssid->mode == WPAS_MODE_P2P_GO)
+		    group_if->current_ssid->mode == WPAS_MODE_P2P_GO) {
 			os_get_reltime(&wpa_s->global->p2p_go_wait_client);
+#ifdef CONFIG_TESTING_OPTIONS
+			if (group_if->p2p_go_csa_on_inv) {
+				wpa_printf(MSG_DEBUG,
+					   "Testing: force P2P GO CSA after invitation");
+				eloop_cancel_timeout(wpas_p2p_reconsider_moving_go,
+						     wpa_s, NULL);
+				eloop_register_timeout(0, 50000,
+						       wpas_p2p_reconsider_moving_go,
+						       wpa_s, NULL);
+			}
+#endif /* CONFIG_TESTING_OPTIONS */
+		}
 		return;
 	}
 
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 6d2786b..f4edc92 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -982,6 +982,7 @@ struct wpa_supplicant {
 	struct l2_packet_data *l2_test;
 	unsigned int extra_roc_dur;
 	enum wpa_supplicant_test_failure test_failure;
+	unsigned int p2p_go_csa_on_inv;
 #endif /* CONFIG_TESTING_OPTIONS */
 
 	struct wmm_ac_assoc_data *wmm_ac_assoc_info;
-- 
1.9.1




More information about the Hostap mailing list