From 5abb1133868ff34fb1de633eb25937670389f18a Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Thu, 10 Mar 2022 18:01:43 +0100 Subject: [PATCH] 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 f18bf17deaa5 ('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: f18bf17deaa5 ('wifi: cleanup ensure_hotspot_frequency()') --- src/libnm-platform/wifi/nm-wifi-utils-nl80211.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libnm-platform/wifi/nm-wifi-utils-nl80211.c b/src/libnm-platform/wifi/nm-wifi-utils-nl80211.c index b064ff2942..475b8a390a 100644 --- a/src/libnm-platform/wifi/nm-wifi-utils-nl80211.c +++ b/src/libnm-platform/wifi/nm-wifi-utils-nl80211.c @@ -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);