Message ID | 5TLtkCSwaUx-RqmmGmjkvZYDuOoygMMyJo5CGL76zpDSc4DrPeUsskBfK_dfts8Uxl5Rk4BqrZD1L6uQKsSJWPSlNj__T7dHdz7zzVPo_J8=@protonmail.com |
---|---|
State | Changes Requested |
Headers | show |
Series | Scan other networks first to unlock 5GHz bands on Intel cards | expand |
On Wed, Jul 17, 2024 at 07:56:04PM +0000, Pedro Goncalves (developer account) wrote: > Subject: [PATCH] For intel Wi-Fi cards, force to scan other wireless networks so the drive is able to set the correct region - master > > Signed-off-by: Pedro Goncalves <pgoncalves-developer@protonmail.com> This would need much more detailed commit message to justify why this is needed and why this is appropriate behavior. How is this specific to Intel cards? Why would an AP be allowed to operate on the 5 GHz band based on just a single scan if it was not allowed to do so without that scan? > Index: src/ap/hostapd.h > IDEA additional info: > Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP > <+>UTF-8 > =================================================================== > diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h And this format is pretty strange and requires manual operations to apply with 'git am'.
Hi, Not the submitter of the patch, but I think this is needed because of Intel's Location Aware Regulatory (LAR). If a scan is not done beforehand, all 5GHz channels are marked as NO-IR. This is incredibly inconvenient, but indeed a quirk with Intel cards. There's also an open Bugzilla ticket about it: https://bugzilla.kernel.org/show_bug.cgi?id=206469 It also has the nasty side-effect of making 6GHz APs practically impossible to start. On 03/08/2024 11:55, Jouni Malinen wrote: > On Wed, Jul 17, 2024 at 07:56:04PM +0000, Pedro Goncalves (developer account) wrote: >> Subject: [PATCH] For intel Wi-Fi cards, force to scan other wireless networks so the drive is able to set the correct region - master >> >> Signed-off-by: Pedro Goncalves <pgoncalves-developer@protonmail.com> > This would need much more detailed commit message to justify why this is > needed and why this is appropriate behavior. How is this specific to > Intel cards? Why would an AP be allowed to operate on the 5 GHz band > based on just a single scan if it was not allowed to do so without that > scan? > >> Index: src/ap/hostapd.h >> IDEA additional info: >> Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP >> <+>UTF-8 >> =================================================================== >> diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h > And this format is pretty strange and requires manual operations to > apply with 'git am'. >
Hi, On 8/10/24 2:50 AM, Taavi Eomäe wrote: > Hi, > > Not the submitter of the patch, but I think this is needed because of > Intel's Location Aware Regulatory (LAR). If a scan is not done > beforehand, all 5GHz channels are marked as NO-IR. > > This is incredibly inconvenient, but indeed a quirk with Intel cards. > There's also an open Bugzilla ticket about it: > https://bugzilla.kernel.org/show_bug.cgi?id=206469 > > It also has the nasty side-effect of making 6GHz APs practically > impossible to start. My 2 cents: this is actually a common "feature" of many self-managed wifi cards. Until the regulatory domain is established frequencies are either disabled/NO-IR due to legal requirements. From the station side of things you already are scanning on startup, so things just work. Not sure how APs are supposed to deal with this, maybe "real" AP vendors use custom firmware that allows you to set the country explicitly? > > On 03/08/2024 11:55, Jouni Malinen wrote: >> On Wed, Jul 17, 2024 at 07:56:04PM +0000, Pedro Goncalves (developer >> account) wrote: >>> Subject: [PATCH] For intel Wi-Fi cards, force to scan other wireless >>> networks so the drive is able to set the correct region - master >>> >>> Signed-off-by: Pedro Goncalves <pgoncalves-developer@protonmail.com> >> This would need much more detailed commit message to justify why this is >> needed and why this is appropriate behavior. How is this specific to >> Intel cards? Why would an AP be allowed to operate on the 5 GHz band >> based on just a single scan if it was not allowed to do so without that >> scan? >> >>> Index: src/ap/hostapd.h >>> IDEA additional info: >>> Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP >>> <+>UTF-8 >>> =================================================================== >>> diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h >> And this format is pretty strange and requires manual operations to >> apply with 'git am'. >> > > _______________________________________________ > Hostap mailing list > Hostap@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/hostap
Subject: [PATCH] For intel Wi-Fi cards, force to scan other wireless networks so the drive is able to set the correct region - master Signed-off-by: Pedro Goncalves <pgoncalves-developer@protonmail.com> --- Index: src/ap/hostapd.h IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h --- a/src/ap/hostapd.h (revision e7172e26d3ebe962150a2e579e40d3a69e8f7304) +++ b/src/ap/hostapd.h (date 1721057509037) @@ -746,6 +746,7 @@ int hostapd_add_iface(struct hapd_interfaces *ifaces, char *buf); int hostapd_remove_iface(struct hapd_interfaces *ifaces, char *buf); void hostapd_channel_list_updated(struct hostapd_iface *iface, int initiator); +void hostapd_scan_results_updated(struct hostapd_iface *iface); void hostapd_set_state(struct hostapd_iface *iface, enum hostapd_iface_state s); const char * hostapd_state_text(enum hostapd_iface_state s); int hostapd_csa_in_progress(struct hostapd_iface *iface); Index: src/ap/hostapd.c IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c --- a/src/ap/hostapd.c (revision e7172e26d3ebe962150a2e579e40d3a69e8f7304) +++ b/src/ap/hostapd.c (date 1721241666773) @@ -1992,11 +1992,15 @@ NULL); return; } +} - if (!iface->wait_channel_update || initiator != REGDOM_SET_BY_USER) + +void hostapd_scan_results_updated(struct hostapd_iface *iface) +{ + if (!iface->wait_channel_update) return; - wpa_printf(MSG_DEBUG, "Channel list updated - continue setup"); + wpa_printf(MSG_DEBUG, "Scan results updated - continue setup"); eloop_cancel_timeout(channel_list_update_timeout, iface, NULL); setup_interface2(iface); } @@ -2064,7 +2068,8 @@ if (os_strncmp(previous_country, country, 2) != 0) { wpa_printf(MSG_DEBUG, "Continue interface setup after channel list update"); iface->wait_channel_update = 1; - eloop_register_timeout(5, 0, + int timeout = hostapd_scan_region_before_setting_channel(iface, NULL) ? 10 : 5; + eloop_register_timeout(timeout, 0, channel_list_update_timeout, iface, NULL); return 0; Index: src/ap/hw_features.h IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/src/ap/hw_features.h b/src/ap/hw_features.h --- a/src/ap/hw_features.h (revision e7172e26d3ebe962150a2e579e40d3a69e8f7304) +++ b/src/ap/hw_features.h (date 1721057961231) @@ -21,6 +21,7 @@ const char * hostapd_hw_mode_txt(int mode); int hostapd_hw_get_freq(struct hostapd_data *hapd, int chan); int hostapd_hw_get_channel(struct hostapd_data *hapd, int freq); +int hostapd_scan_region_before_setting_channel(struct hostapd_iface *iface, void *ctx); int hostapd_check_ht_capab(struct hostapd_iface *iface); int hostapd_check_edmg_capab(struct hostapd_iface *iface); int hostapd_check_he_6ghz_capab(struct hostapd_iface *iface); Index: src/ap/hw_features.c IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c --- a/src/ap/hw_features.c (revision e7172e26d3ebe962150a2e579e40d3a69e8f7304) +++ b/src/ap/hw_features.c (date 1721241733664) @@ -42,6 +42,14 @@ } +static void ieee80211n_region_scan_complete(struct hostapd_iface *iface) +{ + iface->scan_cb = NULL; + wpa_printf(MSG_DEBUG, "Region scan completed"); + hostapd_scan_results_updated(iface); +} + + #ifndef CONFIG_NO_STDOUT_DEBUG static char * dfs_info(struct hostapd_channel_data *chan) { @@ -85,6 +93,10 @@ if (hostapd_drv_none(hapd)) return -1; + + if (iface->scan_cb == ieee80211n_region_scan_complete) + return -1; + modes = hostapd_get_hw_feature_data(hapd, &num_modes, &flags, &dfs_domain); if (modes == NULL) { @@ -539,6 +551,34 @@ } +int hostapd_scan_region_before_setting_channel(struct hostapd_iface *iface, void *ctx) +{ + struct wpa_driver_scan_params params; + int ret; + + if (iface->scan_cb == ieee80211n_region_scan_complete) + return 0; + + if (iface->conf->hw_mode_set && iface->conf->hw_mode == HOSTAPD_MODE_IEEE80211A) + ieee80211n_scan_channels_5g(iface, ¶ms); + else + ieee80211n_scan_channels_2g4(iface, ¶ms); + + os_memset(¶ms, 0, sizeof(params)); + ret = hostapd_driver_scan(iface->bss[0], ¶ms); + if (ret == -EBUSY) { + wpa_printf(MSG_ERROR, + "Failed to request a scan of neighboring BSSes ret=%d (%s)!", + ret, strerror(-ret)); + return 0; + } + if (ret == 0) + iface->scan_cb = ieee80211n_region_scan_complete; + + return 1; +} + + void hostapd_stop_setup_timers(struct hostapd_iface *iface) { eloop_cancel_timeout(ap_ht40_scan_retry, iface, NULL);
Subject: [PATCH] For intel Wi-Fi cards, force to scan other wireless networks so the drive is able to set the correct region - master Signed-off-by: Pedro Goncalves <pgoncalves-developer@protonmail.com> ---