[PATCH] Adding new mode - WPAS_MODE_P2P_CLIENT for P2P client.

Janusz Dziedzic janusz.dziedzic
Fri Apr 8 12:02:07 PDT 2011


 wpa_supplicant/ap.c             |    1 +
 wpa_supplicant/config_ssid.h    |    1 +
 wpa_supplicant/ctrl_iface.c     |    5 +++++
 wpa_supplicant/p2p_supplicant.c |    1 +
 4 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index 95279d3..ec61d99 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -328,6 +328,7 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s,
 	params.ssid_len = ssid->ssid_len;
 	switch (ssid->mode) {
 	case WPAS_MODE_INFRA:
+	case WPAS_MODE_P2P_CLIENT:
 		params.mode = IEEE80211_MODE_INFRA;
 		break;
 	case WPAS_MODE_IBSS:
diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h
index 8419f43..826dc6e 100644
--- a/wpa_supplicant/config_ssid.h
+++ b/wpa_supplicant/config_ssid.h
@@ -294,6 +294,7 @@ struct wpa_ssid {
 		WPAS_MODE_AP = 2,
 		WPAS_MODE_P2P_GO = 3,
 		WPAS_MODE_P2P_GROUP_FORMATION = 4,
+		WPAS_MODE_P2P_CLIENT = 5,
 	} mode;

 	/**
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 5488ea4..5f11057 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -812,6 +812,11 @@ static int
wpa_supplicant_ctrl_iface_status(struct wpa_supplicant *wpa_s,
 						  "mode=P2P GO - group "
 						  "formation\n");
 				break;
+
+			case WPAS_MODE_P2P_CLIENT:
+				ret = os_snprintf(pos, end - pos,
+						  "mode=P2P CLIENT\n");
+				break;
 			default:
 				ret = 0;
 				break;
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index cfa6510..0630662 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -3772,6 +3772,7 @@ void wpas_p2p_completed(struct wpa_supplicant *wpa_s)
 	if (ssid->passphrase == NULL && ssid->psk_set) {
 		char psk[65];
 		wpa_snprintf_hex(psk, sizeof(psk), ssid->psk, 32);
+		ssid->mode = WPAS_MODE_P2P_CLIENT;
 		wpa_msg(wpa_s->parent, MSG_INFO, P2P_EVENT_GROUP_STARTED
 			"%s client ssid=\"%s\" freq=%d psk=%s go_dev_addr="
 			MACSTR "%s",
-- 
1.7.1



More information about the Hostap mailing list