privsep: Support frequency list for scan requests
Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
da818ee5e9
commit
865081c307
3 changed files with 21 additions and 0 deletions
|
@ -30,10 +30,14 @@ enum privsep_cmd {
|
|||
PRIVSEP_CMD_AUTHENTICATE,
|
||||
};
|
||||
|
||||
#define PRIVSEP_MAX_SCAN_FREQS 50
|
||||
|
||||
struct privsep_cmd_scan {
|
||||
unsigned int num_ssids;
|
||||
u8 ssids[WPAS_MAX_SCAN_SSIDS][32];
|
||||
u8 ssid_lens[WPAS_MAX_SCAN_SSIDS];
|
||||
unsigned int num_freqs;
|
||||
u16 freqs[PRIVSEP_MAX_SCAN_FREQS];
|
||||
};
|
||||
|
||||
struct privsep_cmd_authenticate {
|
||||
|
|
|
@ -116,6 +116,11 @@ static int wpa_driver_privsep_scan(void *priv,
|
|||
scan.ssid_lens[i]);
|
||||
}
|
||||
|
||||
for (i = 0; i < PRIVSEP_MAX_SCAN_FREQS &&
|
||||
params->freqs && params->freqs[i]; i++)
|
||||
scan.freqs[i] = params->freqs[i];
|
||||
scan.num_freqs = i;
|
||||
|
||||
return wpa_priv_cmd(drv, PRIVSEP_CMD_SCAN, &scan, sizeof(scan),
|
||||
NULL, NULL);
|
||||
}
|
||||
|
|
|
@ -139,6 +139,7 @@ static void wpa_priv_cmd_scan(struct wpa_priv_interface *iface,
|
|||
struct wpa_driver_scan_params params;
|
||||
struct privsep_cmd_scan *scan;
|
||||
unsigned int i;
|
||||
int freqs[PRIVSEP_MAX_SCAN_FREQS + 1];
|
||||
|
||||
if (iface->drv_priv == NULL)
|
||||
return;
|
||||
|
@ -161,6 +162,17 @@ static void wpa_priv_cmd_scan(struct wpa_priv_interface *iface,
|
|||
params.ssids[i].ssid_len = scan->ssid_lens[i];
|
||||
}
|
||||
|
||||
if (scan->num_freqs > PRIVSEP_MAX_SCAN_FREQS) {
|
||||
wpa_printf(MSG_DEBUG, "Invalid scan request (num_freqs)");
|
||||
return;
|
||||
}
|
||||
if (scan->num_freqs) {
|
||||
for (i = 0; i < scan->num_freqs; i++)
|
||||
freqs[i] = scan->freqs[i];
|
||||
freqs[i] = 0;
|
||||
params.freqs = freqs;
|
||||
}
|
||||
|
||||
if (iface->driver->scan2)
|
||||
iface->driver->scan2(iface->drv_priv, ¶ms);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue