aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2016-12-03 16:17:28 (GMT)
committerJouni Malinen <j@w1.fi>2016-12-03 16:17:28 (GMT)
commitda818ee5e981fcb9048ef1467c9a66e937eabd38 (patch)
tree83469f00037b7dfe8b59477e09d6a74e25c67314
parent002b504d19a90ddb0dda751ffd80a44a89ea880b (diff)
downloadhostap-da818ee5e981fcb9048ef1467c9a66e937eabd38.zip
hostap-da818ee5e981fcb9048ef1467c9a66e937eabd38.tar.gz
hostap-da818ee5e981fcb9048ef1467c9a66e937eabd38.tar.bz2
privsep: Support multiple scan SSIDs
Signed-off-by: Jouni Malinen <j@w1.fi>
-rw-r--r--src/common/privsep_commands.h7
-rw-r--r--src/drivers/driver_privsep.c17
-rw-r--r--wpa_supplicant/wpa_priv.c23
3 files changed, 39 insertions, 8 deletions
diff --git a/src/common/privsep_commands.h b/src/common/privsep_commands.h
index 68656dc..fa350cb 100644
--- a/src/common/privsep_commands.h
+++ b/src/common/privsep_commands.h
@@ -9,6 +9,7 @@
#ifndef PRIVSEP_COMMANDS_H
#define PRIVSEP_COMMANDS_H
+#include "drivers/driver.h"
#include "common/ieee802_11_defs.h"
enum privsep_cmd {
@@ -29,6 +30,12 @@ enum privsep_cmd {
PRIVSEP_CMD_AUTHENTICATE,
};
+struct privsep_cmd_scan {
+ unsigned int num_ssids;
+ u8 ssids[WPAS_MAX_SCAN_SSIDS][32];
+ u8 ssid_lens[WPAS_MAX_SCAN_SSIDS];
+};
+
struct privsep_cmd_authenticate {
int freq;
u8 bssid[ETH_ALEN];
diff --git a/src/drivers/driver_privsep.c b/src/drivers/driver_privsep.c
index 68fd261..5a22a14 100644
--- a/src/drivers/driver_privsep.c
+++ b/src/drivers/driver_privsep.c
@@ -102,10 +102,21 @@ static int wpa_driver_privsep_scan(void *priv,
struct wpa_driver_scan_params *params)
{
struct wpa_driver_privsep_data *drv = priv;
- const u8 *ssid = params->ssids[0].ssid;
- size_t ssid_len = params->ssids[0].ssid_len;
+ struct privsep_cmd_scan scan;
+ size_t i;
+
wpa_printf(MSG_DEBUG, "%s: priv=%p", __func__, priv);
- return wpa_priv_cmd(drv, PRIVSEP_CMD_SCAN, ssid, ssid_len,
+ os_memset(&scan, 0, sizeof(scan));
+ scan.num_ssids = params->num_ssids;
+ for (i = 0; i < params->num_ssids; i++) {
+ if (!params->ssids[i].ssid)
+ continue;
+ scan.ssid_lens[i] = params->ssids[i].ssid_len;
+ os_memcpy(scan.ssids[i], params->ssids[i].ssid,
+ scan.ssid_lens[i]);
+ }
+
+ return wpa_priv_cmd(drv, PRIVSEP_CMD_SCAN, &scan, sizeof(scan),
NULL, NULL);
}
diff --git a/wpa_supplicant/wpa_priv.c b/wpa_supplicant/wpa_priv.c
index 328972f..61d43a6 100644
--- a/wpa_supplicant/wpa_priv.c
+++ b/wpa_supplicant/wpa_priv.c
@@ -134,18 +134,31 @@ static void wpa_priv_cmd_unregister(struct wpa_priv_interface *iface,
static void wpa_priv_cmd_scan(struct wpa_priv_interface *iface,
- char *buf, size_t len)
+ void *buf, size_t len)
{
struct wpa_driver_scan_params params;
+ struct privsep_cmd_scan *scan;
+ unsigned int i;
if (iface->drv_priv == NULL)
return;
+ if (len < sizeof(*scan)) {
+ wpa_printf(MSG_DEBUG, "Invalid scan request");
+ return;
+ }
+
+ scan = buf;
+
os_memset(&params, 0, sizeof(params));
- if (len) {
- params.ssids[0].ssid = (u8 *) buf;
- params.ssids[0].ssid_len = len;
- params.num_ssids = 1;
+ if (scan->num_ssids > WPAS_MAX_SCAN_SSIDS) {
+ wpa_printf(MSG_DEBUG, "Invalid scan request (num_ssids)");
+ return;
+ }
+ params.num_ssids = scan->num_ssids;
+ for (i = 0; i < scan->num_ssids; i++) {
+ params.ssids[i].ssid = scan->ssids[i];
+ params.ssids[i].ssid_len = scan->ssid_lens[i];
}
if (iface->driver->scan2)