aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wps_supplicant.c
diff options
context:
space:
mode:
authorArdong Chen <ardongchen@atheros.com>2010-09-06 17:51:06 (GMT)
committerJouni Malinen <j@w1.fi>2010-09-10 17:30:25 (GMT)
commit2f9929ffccf257eb70813e07990ee1c4536a4767 (patch)
tree5070f99ca783a6b6cc8f16a2f25063842e8f57d3 /wpa_supplicant/wps_supplicant.c
parentfbe702723935c378faa11ed7a1738558185c459d (diff)
downloadhostap-2f9929ffccf257eb70813e07990ee1c4536a4767.zip
hostap-2f9929ffccf257eb70813e07990ee1c4536a4767.tar.gz
hostap-2f9929ffccf257eb70813e07990ee1c4536a4767.tar.bz2
WPS: Allow pending WPS operation to be cancelled
A new ctrl_interface command, WPS_CANCEL, can now be used to cancel a pending or ongoing WPS operation. For now, this is only available with wpa_supplicant (either in station or AP mode). Similar functionality should be added for hostapd, too.
Diffstat (limited to 'wpa_supplicant/wps_supplicant.c')
-rw-r--r--wpa_supplicant/wps_supplicant.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index 3d9836b..8f4ed51 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -32,6 +32,7 @@
#include "blacklist.h"
#include "bss.h"
#include "scan.h"
+#include "ap.h"
#include "p2p/p2p.h"
#include "p2p_supplicant.h"
#include "wps_supplicant.h"
@@ -757,6 +758,32 @@ int wpas_wps_start_pin(struct wpa_supplicant *wpa_s, const u8 *bssid,
}
+/* Cancel the wps pbc/pin requests */
+int wpas_wps_cancel(struct wpa_supplicant *wpa_s)
+{
+#ifdef CONFIG_AP
+ if (wpa_s->ap_iface) {
+ wpa_printf(MSG_DEBUG, "WPS: Cancelling in AP mode");
+ return wpa_supplicant_ap_wps_cancel(wpa_s);
+ }
+#endif /* CONFIG_AP */
+
+ if (wpa_s->wpa_state == WPA_SCANNING) {
+ wpa_printf(MSG_DEBUG, "WPS: Cancel operation - cancel scan");
+ wpa_supplicant_cancel_scan(wpa_s);
+ wpas_clear_wps(wpa_s);
+ } else if (wpa_s->wpa_state >= WPA_ASSOCIATED) {
+ wpa_printf(MSG_DEBUG, "WPS: Cancel operation - "
+ "deauthenticate");
+ wpa_supplicant_deauthenticate(wpa_s,
+ WLAN_REASON_DEAUTH_LEAVING);
+ wpas_clear_wps(wpa_s);
+ }
+
+ return 0;
+}
+
+
#ifdef CONFIG_WPS_OOB
int wpas_wps_start_oob(struct wpa_supplicant *wpa_s, char *device_type,
char *path, char *method, char *name)