Recovering from failing bgscan

Dirk-Jan C. Binnema djcb.bulk at gmail.com
Wed Apr 7 08:09:43 BST 2021


Dear List,

While debugging some network issue, I noticed that in some failure
cases, it seems wpa_supplicant does not recover from a background-scan
failure; I'm seeing something like the following in my logs:

,----
| Apr  6 10:52:37 daemon.debug wpa_supplicant[103]: bgscan simple: Request a background scan
| Apr  6 10:52:37 daemon.debug wpa_supplicant[103]: wlan0: Add radio work 'scan'@0x1b95610
| Apr  6 10:52:37 daemon.debug wpa_supplicant[103]: wlan0: First radio work item in the queue - schedule start immediately
| Apr  6 10:52:37 daemon.debug wpa_supplicant[103]: wlan0: Starting radio work 'scan'@0x1b95610 after 0.000075 second wait
| Apr  6 10:52:37 daemon.debug wpa_supplicant[103]: wlan0: nl80211: scan request
| Apr  6 10:52:38 daemon.debug wpa_supplicant[103]: nl80211: Scan trigger failed: ret=-11 (Resource temporarily unavailable)
| Apr  6 10:52:38 daemon.notice wpa_supplicant[103]: wlan0: CTRL-EVENT-SCAN-FAILED ret=-11
`----

When this happens, it seems that this also stops any _future_ attempts
to background scan.... now it seems it can "fix" this by making a small
change to scan.c, to special-case the -11 (ie., -EAGAIN) as "do it again".

,----
| modified   wpa_supplicant/scan.c
| @@ -231,8 +231,8 @@ static void wpas_trigger_scan_cb(struct wpa_radio_work *work, int deinit)
|       wpa_scan_free_params(params);
|       work->ctx = NULL;
|       if (ret) {
| -		int retry = wpa_s->last_scan_req != MANUAL_SCAN_REQ &&
| -			!wpa_s->beacon_rep_data.token;
| +		int retry = (wpa_s->last_scan_req != MANUAL_SCAN_REQ &&
| +			!wpa_s->beacon_rep_data.token) || ret == -EAGAIN;
|
|               if (wpa_s->disconnected)
|                       retry = 0;
`----

This seems to fix the problem for me, but I wonder if there is any
downsides or reason *not* to do this.

Thanks for any insights!

Kind regards,
Dirk.

--
Dirk-Jan C. Binnema                  Helsinki, Finland
e:djcb at djcbsoftware.nl           w:www.djcbsoftware.nl
gpg: 6987 9CED 1745 9375 0F14 DA98 11DD FEA9 DCC4 A036



More information about the Hostap mailing list