privsep: Support multiple scan SSIDs
Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
002b504d19
commit
da818ee5e9
3 changed files with 39 additions and 8 deletions
|
@ -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];
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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(¶ms, 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)
|
||||
|
|
Loading…
Reference in a new issue