diff mbox series

Implement wps-pin-active and wps-cancel events

Message ID 1566291374-28895-1-git-send-email-bilal.hatipoglu@airties.com
State Changes Requested
Headers show
Series Implement wps-pin-active and wps-cancel events | expand

Commit Message

Bilal Hatipoglu Aug. 20, 2019, 8:56 a.m. UTC
From: Bilal Hatipoglu <bilal.hatipoglu@airties.com>

WPS_EVENT_WPS_CANCEL and WPS_EVENT_AP_CANCEL is added to indicate cancellation
of WPS operation for any reason.

WPS-PIN-ACTIVE is added to indicate when a PIN operation is triggered
in supplicant.

Additionally, existing WPS_EVENT_AP_PIN_ENABLED is triggered in the correct
place.

Signed-off-by: Veli Demirel <veli.demirel@airties.com>
---
 src/ap/wps_hostapd.c            | 5 ++++-
 src/common/wpa_ctrl.h           | 3 +++
 wpa_supplicant/wps_supplicant.c | 3 +++
 3 files changed, 10 insertions(+), 1 deletion(-)

Comments

Bilal Hatipoglu Aug. 28, 2019, 10:02 a.m. UTC | #1
Hello,

Please discard this. I will send version 2 of the patch.

Regards.


Bilal Hatipoglu











From: Hostap <hostap-bounces@lists.infradead.org> on behalf of Bilal Hatipoglu <bilal.hatipoglu@airties.com>

Sent: Tuesday, August 20, 2019 11:56 AM

To: hostap@lists.infradead.org <hostap@lists.infradead.org>

Subject: [PATCH] Implement wps-pin-active and wps-cancel events

 


From: Bilal Hatipoglu <bilal.hatipoglu@airties.com>



WPS_EVENT_WPS_CANCEL and WPS_EVENT_AP_CANCEL is added to indicate cancellation

of WPS operation for any reason.



WPS-PIN-ACTIVE is added to indicate when a PIN operation is triggered

in supplicant.



Additionally, existing WPS_EVENT_AP_PIN_ENABLED is triggered in the correct

place.



Signed-off-by: Veli Demirel <veli.demirel@airties.com>

---

 src/ap/wps_hostapd.c            | 5 ++++-

 src/common/wpa_ctrl.h           | 3 +++

 wpa_supplicant/wps_supplicant.c | 3 +++

 3 files changed, 10 insertions(+), 1 deletion(-)



diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c

index 6161cdb..4b9ccfa 100644

--- a/src/ap/wps_hostapd.c

+++ b/src/ap/wps_hostapd.c

@@ -1347,8 +1347,10 @@ static int wps_add_pin(struct hostapd_data *hapd, void *ctx)

         ret = wps_registrar_add_pin(hapd->wps->registrar, data->addr,

                                     data->uuid, data->pin, data->pin_len,

                                     data->timeout);

-       if (ret == 0)

+       if (ret == 0) {

                 data->added++;

+               wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_AP_PIN_ENABLED);

+       }

         return ret;

 }

 

@@ -1423,6 +1425,7 @@ static int wps_cancel(struct hostapd_data *hapd, void *ctx)

 

         if (hapd->wps) {

                 data->count++;

+               wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_AP_CANCEL);

                 wps_registrar_wps_cancel(hapd->wps->registrar);

                 ap_for_each_sta(hapd, ap_sta_wps_cancel, NULL);

         }

diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h

index b24ae63..d180fac 100644

--- a/src/common/wpa_ctrl.h

+++ b/src/common/wpa_ctrl.h

@@ -143,6 +143,8 @@ extern "C" {

 #define WPS_EVENT_TIMEOUT "WPS-TIMEOUT "

 /* PBC mode was activated */

 #define WPS_EVENT_ACTIVE "WPS-PBC-ACTIVE "

+#define WPS_EVENT_PIN_ACTIVE "WPS-PIN-ACTIVE "

+#define WPS_EVENT_WPS_CANCEL "WPS-CANCEL "

 /* PBC mode was disabled */

 #define WPS_EVENT_DISABLE "WPS-PBC-DISABLE "

 

@@ -299,6 +301,7 @@ extern "C" {

 #define WPS_EVENT_AP_SETUP_UNLOCKED "WPS-AP-SETUP-UNLOCKED "

 #define WPS_EVENT_AP_PIN_ENABLED "WPS-AP-PIN-ENABLED "

 #define WPS_EVENT_AP_PIN_DISABLED "WPS-AP-PIN-DISABLED "

+#define WPS_EVENT_AP_CANCEL "WPS-AP-CANCEL "

 #define AP_STA_CONNECTED "AP-STA-CONNECTED "

 #define AP_STA_DISCONNECTED "AP-STA-DISCONNECTED "

 #define AP_STA_POSSIBLE_PSK_MISMATCH "AP-STA-POSSIBLE-PSK-MISMATCH "

diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c

index 0579274..f61ebfe 100644

--- a/wpa_supplicant/wps_supplicant.c

+++ b/wpa_supplicant/wps_supplicant.c

@@ -1286,6 +1286,7 @@ static int wpas_wps_start_dev_pw(struct wpa_supplicant *wpa_s,

                 wpa_printf(MSG_DEBUG, "WPS: Failed to set phase1 '%s'", val);

                 return -1;

         }

+       wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_PIN_ACTIVE);

         if (wpa_s->wps_fragment_size)

                 ssid->eap.fragment_size = wpa_s->wps_fragment_size;

         eloop_register_timeout(WPS_PBC_WALK_TIME, 0, wpas_wps_timeout,

@@ -1351,6 +1352,8 @@ int wpas_wps_cancel(struct wpa_supplicant *wpa_s)

                         wpas_clear_wps(wpa_s);

         }

 

+       wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_WPS_CANCEL);

+

         wpa_s->after_wps = 0;

 

         return 0;
diff mbox series

Patch

diff --git a/src/ap/wps_hostapd.c b/src/ap/wps_hostapd.c
index 6161cdb..4b9ccfa 100644
--- a/src/ap/wps_hostapd.c
+++ b/src/ap/wps_hostapd.c
@@ -1347,8 +1347,10 @@  static int wps_add_pin(struct hostapd_data *hapd, void *ctx)
 	ret = wps_registrar_add_pin(hapd->wps->registrar, data->addr,
 				    data->uuid, data->pin, data->pin_len,
 				    data->timeout);
-	if (ret == 0)
+	if (ret == 0) {
 		data->added++;
+		wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_AP_PIN_ENABLED);
+	}
 	return ret;
 }
 
@@ -1423,6 +1425,7 @@  static int wps_cancel(struct hostapd_data *hapd, void *ctx)
 
 	if (hapd->wps) {
 		data->count++;
+		wpa_msg(hapd->msg_ctx, MSG_INFO, WPS_EVENT_AP_CANCEL);
 		wps_registrar_wps_cancel(hapd->wps->registrar);
 		ap_for_each_sta(hapd, ap_sta_wps_cancel, NULL);
 	}
diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h
index b24ae63..d180fac 100644
--- a/src/common/wpa_ctrl.h
+++ b/src/common/wpa_ctrl.h
@@ -143,6 +143,8 @@  extern "C" {
 #define WPS_EVENT_TIMEOUT "WPS-TIMEOUT "
 /* PBC mode was activated */
 #define WPS_EVENT_ACTIVE "WPS-PBC-ACTIVE "
+#define WPS_EVENT_PIN_ACTIVE "WPS-PIN-ACTIVE "
+#define WPS_EVENT_WPS_CANCEL "WPS-CANCEL "
 /* PBC mode was disabled */
 #define WPS_EVENT_DISABLE "WPS-PBC-DISABLE "
 
@@ -299,6 +301,7 @@  extern "C" {
 #define WPS_EVENT_AP_SETUP_UNLOCKED "WPS-AP-SETUP-UNLOCKED "
 #define WPS_EVENT_AP_PIN_ENABLED "WPS-AP-PIN-ENABLED "
 #define WPS_EVENT_AP_PIN_DISABLED "WPS-AP-PIN-DISABLED "
+#define WPS_EVENT_AP_CANCEL "WPS-AP-CANCEL "
 #define AP_STA_CONNECTED "AP-STA-CONNECTED "
 #define AP_STA_DISCONNECTED "AP-STA-DISCONNECTED "
 #define AP_STA_POSSIBLE_PSK_MISMATCH "AP-STA-POSSIBLE-PSK-MISMATCH "
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index 0579274..f61ebfe 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -1286,6 +1286,7 @@  static int wpas_wps_start_dev_pw(struct wpa_supplicant *wpa_s,
 		wpa_printf(MSG_DEBUG, "WPS: Failed to set phase1 '%s'", val);
 		return -1;
 	}
+	wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_PIN_ACTIVE);
 	if (wpa_s->wps_fragment_size)
 		ssid->eap.fragment_size = wpa_s->wps_fragment_size;
 	eloop_register_timeout(WPS_PBC_WALK_TIME, 0, wpas_wps_timeout,
@@ -1351,6 +1352,8 @@  int wpas_wps_cancel(struct wpa_supplicant *wpa_s)
 			wpas_clear_wps(wpa_s);
 	}
 
+	wpa_msg(wpa_s, MSG_INFO, WPS_EVENT_WPS_CANCEL);
+
 	wpa_s->after_wps = 0;
 
 	return 0;