mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 00:38:24 -05:00
Add freq= parameter to 'set pno' command
This allows channels-to-be-scanned to be specified for PNO similarly to the scan command. Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
This commit is contained in:
parent
b998236543
commit
d3c9c35f32
@ -46,6 +46,8 @@ static int wpa_supplicant_global_iface_list(struct wpa_global *global,
|
||||
char *buf, int len);
|
||||
static int wpa_supplicant_global_iface_interfaces(struct wpa_global *global,
|
||||
char *buf, int len);
|
||||
static int * freq_range_to_channel_list(struct wpa_supplicant *wpa_s,
|
||||
char *val);
|
||||
|
||||
static int set_bssid_filter(struct wpa_supplicant *wpa_s, char *val)
|
||||
{
|
||||
@ -245,6 +247,33 @@ static int wpas_ctrl_set_blob(struct wpa_supplicant *wpa_s, char *pos)
|
||||
}
|
||||
#endif /* CONFIG_NO_CONFIG_BLOBS */
|
||||
|
||||
|
||||
static int wpas_ctrl_pno(struct wpa_supplicant *wpa_s, char *cmd)
|
||||
{
|
||||
char *params;
|
||||
char *pos;
|
||||
int *freqs = NULL;
|
||||
int ret;
|
||||
|
||||
if (atoi(cmd)) {
|
||||
params = os_strchr(cmd, ' ');
|
||||
os_free(wpa_s->manual_sched_scan_freqs);
|
||||
if (params) {
|
||||
params++;
|
||||
pos = os_strstr(params, "freq=");
|
||||
if (pos)
|
||||
freqs = freq_range_to_channel_list(wpa_s,
|
||||
pos + 5);
|
||||
}
|
||||
wpa_s->manual_sched_scan_freqs = freqs;
|
||||
ret = wpas_start_pno(wpa_s);
|
||||
} else {
|
||||
ret = wpas_stop_pno(wpa_s);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
|
||||
char *cmd)
|
||||
{
|
||||
@ -328,10 +357,7 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
|
||||
wpa_tdls_enable(wpa_s->wpa, !disabled);
|
||||
#endif /* CONFIG_TDLS */
|
||||
} else if (os_strcasecmp(cmd, "pno") == 0) {
|
||||
if (atoi(value))
|
||||
ret = wpas_start_pno(wpa_s);
|
||||
else
|
||||
ret = wpas_stop_pno(wpa_s);
|
||||
ret = wpas_ctrl_pno(wpa_s, value);
|
||||
} else if (os_strcasecmp(cmd, "radio_disabled") == 0) {
|
||||
int disabled = atoi(value);
|
||||
if (wpa_drv_radio_disable(wpa_s, disabled) < 0)
|
||||
|
@ -1923,6 +1923,11 @@ int wpas_start_pno(struct wpa_supplicant *wpa_s)
|
||||
interval = wpa_s->conf->sched_scan_interval ?
|
||||
wpa_s->conf->sched_scan_interval : 10;
|
||||
|
||||
if (params.freqs == NULL && wpa_s->manual_sched_scan_freqs) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, "Limit sched scan to specified channels");
|
||||
params.freqs = wpa_s->manual_sched_scan_freqs;
|
||||
}
|
||||
|
||||
ret = wpa_supplicant_start_sched_scan(wpa_s, ¶ms, interval);
|
||||
os_free(params.filter_ssids);
|
||||
if (ret == 0)
|
||||
|
@ -460,6 +460,9 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s)
|
||||
os_free(wpa_s->manual_scan_freqs);
|
||||
wpa_s->manual_scan_freqs = NULL;
|
||||
|
||||
os_free(wpa_s->manual_sched_scan_freqs);
|
||||
wpa_s->manual_sched_scan_freqs = NULL;
|
||||
|
||||
gas_query_deinit(wpa_s->gas);
|
||||
wpa_s->gas = NULL;
|
||||
|
||||
|
@ -547,6 +547,7 @@ struct wpa_supplicant {
|
||||
int scan_runs; /* number of scan runs since WPS was started */
|
||||
int *next_scan_freqs;
|
||||
int *manual_scan_freqs;
|
||||
int *manual_sched_scan_freqs;
|
||||
unsigned int manual_scan_passive:1;
|
||||
unsigned int manual_scan_use_id:1;
|
||||
unsigned int manual_scan_only_new:1;
|
||||
|
Loading…
Reference in New Issue
Block a user