wifi: fix using out-dated scan timer

Commit 'wifi_drv: re-arm scan timer when enabled again' allowed for
re-arming the scan timer but still uses the old timer value the first
time around. If the timer was disabled, by setting the interval to 0,
it was not enabled again.

We now check if the interval has changed beforehand and potentially
arm the scan timer afterwards.

Fixes #5178.
This commit is contained in:
Josef Söntgen 2024-04-09 17:26:39 +02:00 committed by Christian Helmuth
parent dc0e78cdf8
commit 0ad6faeeaa

View File

@ -386,24 +386,32 @@ struct Wifi::Frontend : Wifi::Rfkill_notification_handler
_verbose = config.attribute_value("verbose", _verbose);
_verbose_state = config.attribute_value("verbose_state", _verbose_state);
Genode::uint64_t connected_scan_interval =
Genode::uint64_t const connected_scan_interval =
Util::check_time(config.attribute_value("connected_scan_interval",
_connected_scan_interval),
0, 15*60);
Genode::uint64_t scan_interval =
Genode::uint64_t const scan_interval =
Util::check_time(config.attribute_value("scan_interval",
_scan_interval),
5, 15*60);
if ( connected_scan_interval > _connected_scan_interval
|| scan_interval > _scan_interval) {
_arm_scan_timer(_connected_ap.bssid_valid());
}
bool const new_connected_scan_interval =
connected_scan_interval != _connected_scan_interval;
bool const new_scan_interval =
connected_scan_interval != _scan_interval;
_connected_scan_interval = connected_scan_interval;
_scan_interval = scan_interval;
/*
* Arm again if intervals changed, implicitly discards
* an already scheduled timer.
*/
if (new_connected_scan_interval || new_scan_interval)
_arm_scan_timer(_connected_ap.bssid_valid());
/*
* Always handle rfkill, regardless in which state we are currently in.
* When we come back from rfkill, will most certainly will be IDLE anyway.