mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 23:40:16 +01:00
nmcli: don't set a fixed channel for wifi hotspots
Since commit f18bf17dea ('wifi: cleanup
ensure_hotspot_frequency()'), NetworkManager automatically selects a
stable channel for AP connections that don't specify a fixed one. The
advantage of this approach is that NM can select a channel that works
well in the current regulatory domain.
However, nmcli still sets fixed channels 1 for 2.4GHz and 7 for 5GHz
when using the "device wifi hotspot". In particular, channel 7 on 5GHz
seems a bad choice because according to [1] it is not usable anywhere
in the world.
It seems difficult to select channel that works everywhere in the 5GHz
band, so it's better to not set a channel in the profile and let NM
find a usable one. For consistency, do the same also for the 2.4GHz
band even if the default choice (channel 1) should always work; by
letting NM choose a channel, different hotspot created with nmcli have
the chance of using different bands and not interfere with each other.
[1] https://en.wikipedia.org/wiki/List_of_WLAN_channels
This commit is contained in:
parent
ac2fb0e93d
commit
e446d2b632
1 changed files with 4 additions and 7 deletions
|
|
@ -4271,6 +4271,8 @@ create_hotspot_conn(const GPtrArray *connections,
|
|||
NMSettingIPConfig *s_ip4, *s_ip6;
|
||||
NMSettingProxy *s_proxy;
|
||||
|
||||
nm_assert(channel_int == -1 || band);
|
||||
|
||||
connection = nm_simple_connection_new();
|
||||
s_con = (NMSettingConnection *) nm_setting_connection_new();
|
||||
nm_connection_add_setting(connection, NM_SETTING(s_con));
|
||||
|
|
@ -4301,6 +4303,8 @@ create_hotspot_conn(const GPtrArray *connections,
|
|||
NM_SETTING_WIRELESS_BAND,
|
||||
band,
|
||||
NULL);
|
||||
} else if (band) {
|
||||
g_object_set(s_wifi, NM_SETTING_WIRELESS_BAND, band, NULL);
|
||||
}
|
||||
|
||||
s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new();
|
||||
|
|
@ -4446,13 +4450,6 @@ do_device_wifi_hotspot(const NMCCommand *cmd, NmCli *nmc, int argc, const char *
|
|||
if (nmc->complete)
|
||||
return;
|
||||
|
||||
/* Verify band and channel parameters */
|
||||
if (!channel) {
|
||||
if (g_strcmp0(band, "bg") == 0)
|
||||
channel = "1";
|
||||
if (g_strcmp0(band, "a") == 0)
|
||||
channel = "7";
|
||||
}
|
||||
if (channel) {
|
||||
unsigned long int value;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue