diff options
author | Jouni Malinen <jouni@qca.qualcomm.com> | 2011-09-02 21:29:06 +0300 |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2011-09-02 21:29:06 +0300 |
commit | 98aa7ca5d8cd14dcefd2d7a27d5ade2b3facba7e (patch) | |
tree | eab702d7fb5e23be6d5eb3588c74bbee985f1f15 | |
parent | 64fa840a9745e398311a8241a94d03b506d2d230 (diff) | |
download | external_wpa_supplicant_8_ti-98aa7ca5d8cd14dcefd2d7a27d5ade2b3facba7e.zip external_wpa_supplicant_8_ti-98aa7ca5d8cd14dcefd2d7a27d5ade2b3facba7e.tar.gz external_wpa_supplicant_8_ti-98aa7ca5d8cd14dcefd2d7a27d5ade2b3facba7e.tar.bz2 |
WPS: Add 'wpa_cli wps_pin get' for generating random PINs
This can be used, e.g., in a UI to generate a PIN without
starting WPS (or P2P) operation.
-rw-r--r-- | wpa_supplicant/README-WPS | 5 | ||||
-rw-r--r-- | wpa_supplicant/ctrl_iface.c | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/wpa_supplicant/README-WPS b/wpa_supplicant/README-WPS index 313e873..bf75cb4 100644 --- a/wpa_supplicant/README-WPS +++ b/wpa_supplicant/README-WPS @@ -127,6 +127,11 @@ This starts the WPS negotiation in the same way as above with the generated PIN. +If a random PIN is needed for a user interface, "wpa_cli wps_pin get" +can be used to generate a new PIN without starting WPS negotiation. +This random PIN can then be passed as an argument to another wps_pin +call when the actual operation should be started. + If the client design wants to support optional WPS PBC mode, this can be enabled by either a physical button in the client device or a virtual button in the user interface. The PBC operation requires that diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index b58d40d..2b0b081 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -340,7 +340,10 @@ static int wpa_supplicant_ctrl_iface_wps_pin(struct wpa_supplicant *wpa_s, if (os_strcmp(cmd, "any") == 0) _bssid = NULL; - else if (hwaddr_aton(cmd, bssid)) { + else if (os_strcmp(cmd, "get") == 0) { + ret = wps_generate_pin(); + goto done; + } else if (hwaddr_aton(cmd, bssid)) { wpa_printf(MSG_DEBUG, "CTRL_IFACE WPS_PIN: invalid BSSID '%s'", cmd); return -1; @@ -367,6 +370,7 @@ static int wpa_supplicant_ctrl_iface_wps_pin(struct wpa_supplicant *wpa_s, if (ret < 0) return -1; +done: /* Return the generated PIN */ ret = os_snprintf(buf, buflen, "%08d", ret); if (ret < 0 || (size_t) ret >= buflen) |