Share a common helper function for restarting sched_scan

This code sequence was already used at two different places (and an
additional one has been proposed), so add a common helper function to
avoid having to copy-paste this functionality in multiple locations.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2016-09-27 00:09:33 +03:00 committed by Jouni Malinen
parent be7ebd892e
commit 5bb7327a69
3 changed files with 13 additions and 10 deletions

View file

@ -8564,10 +8564,7 @@ static int wpas_ctrl_iface_mac_rand_scan(struct wpa_supplicant *wpa_s,
}
} else if (wpa_s->sched_scanning &&
(type & MAC_ADDR_RAND_SCHED_SCAN)) {
/* simulate timeout to restart the sched scan */
wpa_s->sched_scan_timed_out = 1;
wpa_s->prev_sched_ssid = NULL;
wpa_supplicant_cancel_sched_scan(wpa_s);
wpas_scan_restart_sched_scan(wpa_s);
}
return 0;
}
@ -8593,12 +8590,8 @@ static int wpas_ctrl_iface_mac_rand_scan(struct wpa_supplicant *wpa_s,
wpas_mac_addr_rand_scan_set(wpa_s, MAC_ADDR_RAND_SCHED_SCAN,
addr, mask);
if (wpa_s->sched_scanning && !wpa_s->pno) {
/* simulate timeout to restart the sched scan */
wpa_s->sched_scan_timed_out = 1;
wpa_s->prev_sched_ssid = NULL;
wpa_supplicant_cancel_sched_scan(wpa_s);
}
if (wpa_s->sched_scanning && !wpa_s->pno)
wpas_scan_restart_sched_scan(wpa_s);
}
if (type & MAC_ADDR_RAND_PNO) {

View file

@ -2745,3 +2745,12 @@ void wpas_scan_reset_sched_scan(struct wpa_supplicant *wpa_s)
wpa_supplicant_cancel_sched_scan(wpa_s);
}
}
void wpas_scan_restart_sched_scan(struct wpa_supplicant *wpa_s)
{
/* simulate timeout to restart the sched scan */
wpa_s->sched_scan_timed_out = 1;
wpa_s->prev_sched_ssid = NULL;
wpa_supplicant_cancel_sched_scan(wpa_s);
}

View file

@ -45,6 +45,7 @@ void wpa_scan_free_params(struct wpa_driver_scan_params *params);
int wpas_start_pno(struct wpa_supplicant *wpa_s);
int wpas_stop_pno(struct wpa_supplicant *wpa_s);
void wpas_scan_reset_sched_scan(struct wpa_supplicant *wpa_s);
void wpas_scan_restart_sched_scan(struct wpa_supplicant *wpa_s);
void wpas_mac_addr_rand_scan_clear(struct wpa_supplicant *wpa_s,
unsigned int type);