mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 04:30:09 +01:00
wifi: skip no-ir channels when determining AP channel
If the automatically selected channel for an AP is set as NO-IR in the
current regulatory domain, the hotspot connection will fail to
start. NO-IR means that any mechanisms that initiate radiation are not
permitted on this channel, this includes sending probe requests or
modes of operation that require beaconing such as AP. Skip channels
with the NO-IR flag.
(cherry picked from commit 1399aa925d)
This commit is contained in:
parent
c10b97d188
commit
7982a3d2eb
10 changed files with 23 additions and 15 deletions
|
|
@ -3227,7 +3227,8 @@ ensure_hotspot_frequency(NMDeviceWifi *self, NMSettingWireless *s_wifi, NMWifiAP
|
|||
|
||||
freq = nm_platform_wifi_find_frequency(nm_device_get_platform(device),
|
||||
nm_device_get_ifindex(device),
|
||||
rnd_freqs);
|
||||
rnd_freqs,
|
||||
TRUE);
|
||||
if (freq == 0)
|
||||
freq = rnd_freqs[0];
|
||||
|
||||
|
|
|
|||
|
|
@ -835,7 +835,7 @@ wifi_set_mode(NMPlatform *platform, int ifindex, _NM80211Mode mode)
|
|||
}
|
||||
|
||||
static guint32
|
||||
wifi_find_frequency(NMPlatform *platform, int ifindex, const guint32 *freqs)
|
||||
wifi_find_frequency(NMPlatform *platform, int ifindex, const guint32 *freqs, gboolean ap)
|
||||
{
|
||||
return freqs[0];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9291,11 +9291,11 @@ wifi_set_powersave(NMPlatform *platform, int ifindex, guint32 powersave)
|
|||
}
|
||||
|
||||
static guint32
|
||||
wifi_find_frequency(NMPlatform *platform, int ifindex, const guint32 *freqs)
|
||||
wifi_find_frequency(NMPlatform *platform, int ifindex, const guint32 *freqs, gboolean ap)
|
||||
{
|
||||
WIFI_GET_WIFI_DATA_NETNS(wifi_data, platform, ifindex, 0);
|
||||
|
||||
return nm_wifi_utils_find_freq(wifi_data, freqs);
|
||||
return nm_wifi_utils_find_freq(wifi_data, freqs, ap);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -3192,14 +3192,14 @@ nm_platform_wifi_set_powersave(NMPlatform *self, int ifindex, guint32 powersave)
|
|||
}
|
||||
|
||||
guint32
|
||||
nm_platform_wifi_find_frequency(NMPlatform *self, int ifindex, const guint32 *freqs)
|
||||
nm_platform_wifi_find_frequency(NMPlatform *self, int ifindex, const guint32 *freqs, gboolean ap)
|
||||
{
|
||||
_CHECK_SELF(self, klass, 0);
|
||||
|
||||
g_return_val_if_fail(ifindex > 0, 0);
|
||||
g_return_val_if_fail(freqs != NULL, 0);
|
||||
|
||||
return klass->wifi_find_frequency(self, ifindex, freqs);
|
||||
return klass->wifi_find_frequency(self, ifindex, freqs, ap);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -1183,7 +1183,10 @@ typedef struct {
|
|||
_NM80211Mode (*wifi_get_mode)(NMPlatform *self, int ifindex);
|
||||
void (*wifi_set_mode)(NMPlatform *self, int ifindex, _NM80211Mode mode);
|
||||
void (*wifi_set_powersave)(NMPlatform *self, int ifindex, guint32 powersave);
|
||||
guint32 (*wifi_find_frequency)(NMPlatform *self, int ifindex, const guint32 *freqs);
|
||||
guint32 (*wifi_find_frequency)(NMPlatform *self,
|
||||
int ifindex,
|
||||
const guint32 *freqs,
|
||||
gboolean ap);
|
||||
void (*wifi_indicate_addressing_running)(NMPlatform *self, int ifindex, gboolean running);
|
||||
_NMSettingWirelessWakeOnWLan (*wifi_get_wake_on_wlan)(NMPlatform *self, int ifindex);
|
||||
gboolean (*wifi_set_wake_on_wlan)(NMPlatform *self,
|
||||
|
|
@ -2063,7 +2066,8 @@ gboolean nm_platform_wifi_get_station(NMPlatform *self,
|
|||
_NM80211Mode nm_platform_wifi_get_mode(NMPlatform *self, int ifindex);
|
||||
void nm_platform_wifi_set_mode(NMPlatform *self, int ifindex, _NM80211Mode mode);
|
||||
void nm_platform_wifi_set_powersave(NMPlatform *self, int ifindex, guint32 powersave);
|
||||
guint32 nm_platform_wifi_find_frequency(NMPlatform *self, int ifindex, const guint32 *freqs);
|
||||
guint32
|
||||
nm_platform_wifi_find_frequency(NMPlatform *self, int ifindex, const guint32 *freqs, gboolean ap);
|
||||
void nm_platform_wifi_indicate_addressing_running(NMPlatform *self, int ifindex, gboolean running);
|
||||
_NMSettingWirelessWakeOnWLan nm_platform_wifi_get_wake_on_wlan(NMPlatform *self, int ifindex);
|
||||
gboolean
|
||||
|
|
|
|||
|
|
@ -385,7 +385,7 @@ wifi_nl80211_get_freq(NMWifiUtils *data)
|
|||
}
|
||||
|
||||
static guint32
|
||||
wifi_nl80211_find_freq(NMWifiUtils *data, const guint32 *freqs)
|
||||
wifi_nl80211_find_freq(NMWifiUtils *data, const guint32 *freqs, gboolean ap)
|
||||
{
|
||||
NMWifiUtilsNl80211 *self = (NMWifiUtilsNl80211 *) data;
|
||||
int i;
|
||||
|
|
@ -397,6 +397,8 @@ wifi_nl80211_find_freq(NMWifiUtils *data, const guint32 *freqs)
|
|||
for (i = 0; i < self->num_freqs; i++) {
|
||||
if (self->freqs[i].disabled)
|
||||
continue;
|
||||
if (ap && self->freqs[i].no_ir)
|
||||
continue;
|
||||
if (self->freqs[i].freq == freqs[j])
|
||||
return freqs[j];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,9 @@ typedef struct {
|
|||
/* Return current frequency in MHz (really associated BSS frequency) */
|
||||
guint32 (*get_freq)(NMWifiUtils *data);
|
||||
|
||||
/* Return first supported frequency in the zero-terminated list */
|
||||
guint32 (*find_freq)(NMWifiUtils *data, const guint32 *freqs);
|
||||
/* Return first supported frequency in the zero-terminated list. @ap
|
||||
* indicates that the frequency must be suited for AP mode. */
|
||||
guint32 (*find_freq)(NMWifiUtils *data, const guint32 *freqs, gboolean ap);
|
||||
|
||||
/*
|
||||
* @out_bssid: must be NULL or an ETH_ALEN-byte buffer
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ wifi_wext_get_freq(NMWifiUtils *data)
|
|||
}
|
||||
|
||||
static guint32
|
||||
wifi_wext_find_freq(NMWifiUtils *data, const guint32 *freqs)
|
||||
wifi_wext_find_freq(NMWifiUtils *data, const guint32 *freqs, gboolean ap)
|
||||
{
|
||||
NMWifiUtilsWext *wext = (NMWifiUtilsWext *) data;
|
||||
guint i;
|
||||
|
|
|
|||
|
|
@ -124,12 +124,12 @@ nm_wifi_utils_get_freq(NMWifiUtils *data)
|
|||
}
|
||||
|
||||
guint32
|
||||
nm_wifi_utils_find_freq(NMWifiUtils *data, const guint32 *freqs)
|
||||
nm_wifi_utils_find_freq(NMWifiUtils *data, const guint32 *freqs, gboolean ap)
|
||||
{
|
||||
g_return_val_if_fail(data != NULL, 0);
|
||||
g_return_val_if_fail(freqs != NULL, 0);
|
||||
|
||||
return NM_WIFI_UTILS_GET_CLASS(data)->find_freq(data, freqs);
|
||||
return NM_WIFI_UTILS_GET_CLASS(data)->find_freq(data, freqs, ap);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ guint32 nm_wifi_utils_get_freq(NMWifiUtils *data);
|
|||
|
||||
/* Return the first supported frequency in the zero-terminated list.
|
||||
* Frequencies are specified in MHz. */
|
||||
guint32 nm_wifi_utils_find_freq(NMWifiUtils *data, const guint32 *freqs);
|
||||
guint32 nm_wifi_utils_find_freq(NMWifiUtils *data, const guint32 *freqs, gboolean ap);
|
||||
|
||||
/*
|
||||
* @out_bssid: must be NULL or an ETH_ALEN-byte buffer
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue