wpa_supplicant: Use monotonic time for temp-disabled networks
Temporarily disabled networks are disabled for a certain duration, so the code should use monotonic time. Signed-hostap: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
151ab808fa
commit
4e1eae1dff
3 changed files with 5 additions and 5 deletions
|
@ -611,7 +611,7 @@ struct wpa_ssid {
|
|||
/**
|
||||
* disabled_until - Network block disabled until this time if non-zero
|
||||
*/
|
||||
struct os_time disabled_until;
|
||||
struct os_reltime disabled_until;
|
||||
|
||||
/**
|
||||
* parent_cred - Pointer to parent wpa_cred entry
|
||||
|
|
|
@ -53,12 +53,12 @@ static int wpas_select_network_from_last_scan(struct wpa_supplicant *wpa_s,
|
|||
static int wpas_temp_disabled(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_ssid *ssid)
|
||||
{
|
||||
struct os_time now;
|
||||
struct os_reltime now;
|
||||
|
||||
if (ssid == NULL || ssid->disabled_until.sec == 0)
|
||||
return 0;
|
||||
|
||||
os_get_time(&now);
|
||||
os_get_reltime(&now);
|
||||
if (ssid->disabled_until.sec > now.sec)
|
||||
return ssid->disabled_until.sec - now.sec;
|
||||
|
||||
|
|
|
@ -3979,7 +3979,7 @@ void wpas_auth_failed(struct wpa_supplicant *wpa_s)
|
|||
{
|
||||
struct wpa_ssid *ssid = wpa_s->current_ssid;
|
||||
int dur;
|
||||
struct os_time now;
|
||||
struct os_reltime now;
|
||||
|
||||
if (ssid == NULL) {
|
||||
wpa_printf(MSG_DEBUG, "Authentication failure but no known "
|
||||
|
@ -4016,7 +4016,7 @@ void wpas_auth_failed(struct wpa_supplicant *wpa_s)
|
|||
else
|
||||
dur = 10;
|
||||
|
||||
os_get_time(&now);
|
||||
os_get_reltime(&now);
|
||||
if (now.sec + dur <= ssid->disabled_until.sec)
|
||||
return;
|
||||
|
||||
|
|
Loading…
Reference in a new issue