aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wps_supplicant.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2013-04-02 15:29:23 (GMT)
committerJouni Malinen <j@w1.fi>2014-01-27 19:10:55 (GMT)
commit57630e658bd11b9a0c6ad5727e8317ff15c09779 (patch)
treea9f483447317f1a4b150a598f8bdb3e0090255fe /wpa_supplicant/wps_supplicant.c
parent5f4545573f1ee279fb14b5f35263f25ad962ce3b (diff)
downloadhostap-57630e658bd11b9a0c6ad5727e8317ff15c09779.zip
hostap-57630e658bd11b9a0c6ad5727e8317ff15c09779.tar.gz
hostap-57630e658bd11b9a0c6ad5727e8317ff15c09779.tar.bz2
WPS: Preparations for allowing SSID filtering for provisioning step
If the SSID of the WPS AP is known, it should be possible to limit AP selection based on this when searching for an active WPS AP. This commit adds a mechanism to specify SSID for this type of uses. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'wpa_supplicant/wps_supplicant.c')
-rw-r--r--wpa_supplicant/wps_supplicant.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index c32457b..80126b5 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -1074,7 +1074,8 @@ int wpas_wps_start_pbc(struct wpa_supplicant *wpa_s, const u8 *bssid,
static int wpas_wps_start_dev_pw(struct wpa_supplicant *wpa_s, const u8 *bssid,
const char *pin, int p2p_group, u16 dev_pw_id,
- const u8 *peer_pubkey_hash)
+ const u8 *peer_pubkey_hash,
+ const u8 *ssid_val, size_t ssid_len)
{
struct wpa_ssid *ssid;
char val[128 + 2 * WPS_OOB_PUBKEY_HASH_LEN];
@@ -1083,10 +1084,19 @@ static int wpas_wps_start_dev_pw(struct wpa_supplicant *wpa_s, const u8 *bssid,
wpas_clear_wps(wpa_s);
ssid = wpas_wps_add_network(wpa_s, 0, bssid);
- if (ssid == NULL)
+ if (ssid == NULL) {
+ wpa_printf(MSG_DEBUG, "WPS: Could not add network");
return -1;
+ }
ssid->temporary = 1;
ssid->p2p_group = p2p_group;
+ if (ssid_val) {
+ ssid->ssid = os_malloc(ssid_len);
+ if (ssid->ssid) {
+ os_memcpy(ssid->ssid, ssid_val, ssid_len);
+ ssid->ssid_len = ssid_len;
+ }
+ }
if (peer_pubkey_hash) {
os_memcpy(hash, " pkhash=", 8);
wpa_snprintf_hex_uppercase(hash + 8, sizeof(hash) - 8,
@@ -1131,7 +1141,7 @@ int wpas_wps_start_pin(struct wpa_supplicant *wpa_s, const u8 *bssid,
const char *pin, int p2p_group, u16 dev_pw_id)
{
return wpas_wps_start_dev_pw(wpa_s, bssid, pin, p2p_group, dev_pw_id,
- NULL);
+ NULL, NULL, 0);
}
@@ -2090,7 +2100,8 @@ struct wpabuf * wpas_wps_nfc_token(struct wpa_supplicant *wpa_s, int ndef)
int wpas_wps_start_nfc(struct wpa_supplicant *wpa_s, const u8 *bssid,
const struct wpabuf *dev_pw, u16 dev_pw_id,
- int p2p_group, const u8 *peer_pubkey_hash)
+ int p2p_group, const u8 *peer_pubkey_hash,
+ const u8 *ssid, size_t ssid_len)
{
struct wps_context *wps = wpa_s->wps;
char pw[32 * 2 + 1];
@@ -2130,7 +2141,7 @@ int wpas_wps_start_nfc(struct wpa_supplicant *wpa_s, const u8 *bssid,
wpa_snprintf_hex_uppercase(pw, sizeof(pw),
wpabuf_head(dev_pw), wpabuf_len(dev_pw));
return wpas_wps_start_dev_pw(wpa_s, bssid, pw, p2p_group, dev_pw_id,
- peer_pubkey_hash);
+ peer_pubkey_hash, ssid, ssid_len);
}