aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2008-12-08 18:57:59 (GMT)
committerJouni Malinen <j@w1.fi>2008-12-08 18:57:59 (GMT)
commiteef7d7a138b3d8d0a08439345e321b7b541db390 (patch)
tree21e6dd29e322b8c8a262cf9bcf00f01bf3747497 /wpa_supplicant
parent7e45830ab7ad3424f4d963fb23d2a4387919331d (diff)
downloadhostap-06-eef7d7a138b3d8d0a08439345e321b7b541db390.zip
hostap-06-eef7d7a138b3d8d0a08439345e321b7b541db390.tar.gz
hostap-06-eef7d7a138b3d8d0a08439345e321b7b541db390.tar.bz2
WPS: Added [WPS], [WPS-PIN], [WPS-PBC] flags for scan results
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/README-WPS12
-rw-r--r--wpa_supplicant/ctrl_iface.c31
2 files changed, 43 insertions, 0 deletions
diff --git a/wpa_supplicant/README-WPS b/wpa_supplicant/README-WPS
index 6a6a941..6d2419d 100644
--- a/wpa_supplicant/README-WPS
+++ b/wpa_supplicant/README-WPS
@@ -136,3 +136,15 @@ wpa_cli:
wpa_cli wps_reg <AP BSSID> <AP PIN>
(example: wpa_cli wps_reg 02:34:56:78:9a:bc 12345670)
+
+
+Scanning
+--------
+
+Scan results ('wpa_cli scan_results' or 'wpa_cli bss <idx>') include a
+flags field that is used to indicate whether the BSS support WPS. If
+the AP support WPS, but has not recently activated a Registrar, [WPS]
+flag will be included. If PIN method has been recently selected,
+[WPS-PIN] is shown instead. Similarly, [WPS-PBC] is shown if PBC mode
+is in progress. GUI programs can use these as triggers for suggesting
+a guided WPS configuration to the user.
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 3615dd8..619de4e 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -28,6 +28,7 @@
#include "eap_peer/eap.h"
#include "ieee802_11_defs.h"
#include "wps_supplicant.h"
+#include "wps/wps.h"
static int wpa_supplicant_global_iface_interfaces(struct wpa_global *global,
@@ -614,6 +615,34 @@ static char * wpa_supplicant_ie_txt(char *pos, char *end, const char *proto,
return pos;
}
+static char * wpa_supplicant_wps_ie_txt(char *pos, char *end,
+ const struct wpa_scan_res *res)
+{
+#ifdef CONFIG_WPS
+ struct wpabuf *wps_ie;
+ int ret;
+ const char *txt;
+
+ wps_ie = wpa_scan_get_vendor_ie_multi(res, WPS_IE_VENDOR_TYPE);
+ if (wps_ie == NULL)
+ return pos;
+
+ if (wps_is_selected_pbc_registrar(wps_ie))
+ txt = "[WPS-PBC]";
+ else if (wps_is_selected_pin_registrar(wps_ie))
+ txt = "[WPS-PIN]";
+ else
+ txt = "[WPS]";
+
+ ret = os_snprintf(pos, end - pos, "%s", txt);
+ if (ret >= 0 && ret < end - pos)
+ pos += ret;
+ wpabuf_free(wps_ie);
+#endif /* CONFIG_WPS */
+
+ return pos;
+}
+
/* Format one result on one text line into a buffer. */
static int wpa_supplicant_ctrl_iface_scan_result(
@@ -637,6 +666,7 @@ static int wpa_supplicant_ctrl_iface_scan_result(
ie2 = wpa_scan_get_ie(res, WLAN_EID_RSN);
if (ie2)
pos = wpa_supplicant_ie_txt(pos, end, "WPA2", ie2, 2 + ie2[1]);
+ pos = wpa_supplicant_wps_ie_txt(pos, end, res);
if (!ie && !ie2 && res->caps & IEEE80211_CAP_PRIVACY) {
ret = os_snprintf(pos, end - pos, "[WEP]");
if (ret < 0 || ret >= end - pos)
@@ -1400,6 +1430,7 @@ static int wpa_supplicant_ctrl_iface_bss(struct wpa_supplicant *wpa_s,
ie2 = wpa_scan_get_ie(bss, WLAN_EID_RSN);
if (ie2)
pos = wpa_supplicant_ie_txt(pos, end, "WPA2", ie2, 2 + ie2[1]);
+ pos = wpa_supplicant_wps_ie_txt(pos, end, bss);
if (!ie && !ie2 && bss->caps & IEEE80211_CAP_PRIVACY) {
ret = os_snprintf(pos, end - pos, "[WEP]");
if (ret < 0 || ret >= end - pos)