wifi: ignore disabled frequencies

Frequencies with the 'disabled' flag are supported by the driver but
disabled in the current regulatory domain. Don't add them to the list
of supported frequencies since they are not usable.

This is especially needed since commit f18bf17dea ('wifi: cleanup
ensure_hotspot_frequency()'), as now NetworkManager explicitly sets a
random, stable channel for Wi-Fi hotspots. If the choosen channel is
disabled, the hotspot fails to start.

Disabled channels are displayed in the 'iw phy' output as '(disabled)':

                [...]
                Frequencies:
                        * 2412 MHz [1] (30.0 dBm)
                        * 2417 MHz [2] (30.0 dBm)
                        * 2422 MHz [3] (30.0 dBm)
                        * 2427 MHz [4] (30.0 dBm)
                        * 2432 MHz [5] (30.0 dBm)
                        * 2437 MHz [6] (30.0 dBm)
                        * 2442 MHz [7] (30.0 dBm)
                        * 2447 MHz [8] (30.0 dBm)
                        * 2452 MHz [9] (30.0 dBm)
                        * 2457 MHz [10] (30.0 dBm)
                        * 2462 MHz [11] (30.0 dBm)
                        * 2467 MHz [12] (disabled)
                        * 2472 MHz [13] (disabled)
                        * 2484 MHz [14] (disabled)

Note that currently NM loads the list only at startup and therefore,
in case of a change of regulatory domain, a restart of the daemon is
needed to have the list updated. This needs to be improved.

https://bugzilla.redhat.com/show_bug.cgi?id=2062785

Fixes: f18bf17dea ('wifi: cleanup ensure_hotspot_frequency()')
This commit is contained in:
Beniamino Galvani
2022-03-10 18:01:43 +01:00
parent 3a41f6539e
commit 5abb113386

View File

@@ -671,6 +671,9 @@ nl80211_wiphy_info_handler(struct nl_msg *msg, void *arg)
if (!tb_freq[NL80211_FREQUENCY_ATTR_FREQ])
continue;
if (tb_freq[NL80211_FREQUENCY_ATTR_DISABLED])
continue;
if (info->num_freqs >= num_alloc) {
num_alloc *= 2;
info->freqs = g_renew(guint32, info->freqs, num_alloc);