[PATCH] wpa_supplicant: Update Proximity Detection channels on channel list change
Emily Xia
xiayucheng at google.com
Sun Aug 16 08:32:16 PDT 2026
Refresh Proximity Detection (PD) channel lists, active 6 GHz capability,
and country code upon receiving EVENT_CHANNEL_LIST_CHANGED.
Check active regulatory 6 GHz enablement via wpas_is_6ghz_supported(wpa_s, true)
rather than static driver capabilities so 6 GHz channels are not offered
in regulatory domains where 6 GHz is disallowed.
Synchronize the PD country string with the active device country code and
indicate IEEE 802.11 Table E-4 Global Operating Classes (country[2] = 0x04).
Signed-off-by: Emily Xia <xiayucheng at google.com>
---
wpa_supplicant/events.c | 1 +
wpa_supplicant/pr_supplicant.c | 49 +++++++++++++++++++++++++++++++---
wpa_supplicant/pr_supplicant.h | 5 ++++
3 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index fdd822354..5f58c7414 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -6059,6 +6059,7 @@ void wpa_supplicant_update_channel_list(struct wpa_supplicant *wpa_s,
}
wpas_p2p_update_channel_list(wpa_s, WPAS_P2P_CHANNEL_UPDATE_DRIVER);
+ wpas_pr_update_channel_list(wpa_s);
}
diff --git a/wpa_supplicant/pr_supplicant.c b/wpa_supplicant/pr_supplicant.c
index dac2626fa..262e3b649 100644
--- a/wpa_supplicant/pr_supplicant.c
+++ b/wpa_supplicant/pr_supplicant.c
@@ -678,6 +678,8 @@ int wpas_pr_init(struct wpa_global *global, struct wpa_supplicant *wpa_s,
pr.pd_preamble_bitmap = capa->pd_preambles;
pr.max_rx_antenna = capa->max_rx_antenna;
pr.max_tx_antenna = capa->max_tx_antenna;
+ pr.support_6ghz = capa->support_6ghz &&
+ wpas_is_6ghz_supported(wpa_s, true);
wpas_pr_setup_edca_channels(wpa_s, &pr.edca_channels,
capa->pd_bandwidths,
@@ -707,8 +709,6 @@ int wpas_pr_init(struct wpa_global *global, struct wpa_supplicant *wpa_s,
pr.pr_max_peer_rsta_role = capa->rsta.max_peers;
pr.max_ftms_per_burst = capa->max_ftms_per_burst;
- pr.support_6ghz = capa->support_6ghz;
-
pr.pasn_send_mgmt = wpas_pr_pasn_send_mgmt;
pr.negotiation_started = wpas_pr_pasn_negotiation_started;
pr.pasn_result = wpas_pr_pasn_result;
@@ -723,7 +723,10 @@ int wpas_pr_init(struct wpa_global *global, struct wpa_supplicant *wpa_s,
capa->pd_bandwidths, capa->pd_preambles,
pr.support_6ghz);
- if (wpa_s->conf->country[0] && wpa_s->conf->country[1]) {
+ if (wpa_s->device_country[0] && wpa_s->device_country[1]) {
+ os_memcpy(pr.country, wpa_s->device_country, 2);
+ pr.country[2] = 0x04;
+ } else if (wpa_s->conf->country[0] && wpa_s->conf->country[1]) {
os_memcpy(pr.country, wpa_s->conf->country, 2);
pr.country[2] = 0x04;
} else {
@@ -770,6 +773,46 @@ int wpas_pr_init(struct wpa_global *global, struct wpa_supplicant *wpa_s,
}
+void wpas_pr_update_channel_list(struct wpa_supplicant *wpa_s)
+{
+ struct pr_data *pr;
+
+ if (!wpa_s->global || !wpa_s->global->pr)
+ return;
+
+ pr = wpa_s->global->pr;
+ if (!pr->cfg)
+ return;
+
+ wpa_s->is_6ghz_enabled = wpas_is_6ghz_supported(wpa_s, true);
+ pr->cfg->support_6ghz = wpa_s->support_6ghz && wpa_s->is_6ghz_enabled;
+
+ if (wpa_s->device_country[0] && wpa_s->device_country[1]) {
+ os_memcpy(pr->cfg->country, wpa_s->device_country, 2);
+ pr->cfg->country[2] = 0x04;
+ } else if (wpa_s->conf->country[0] && wpa_s->conf->country[1]) {
+ os_memcpy(pr->cfg->country, wpa_s->conf->country, 2);
+ pr->cfg->country[2] = 0x04;
+ }
+
+ wpa_printf(MSG_DEBUG,
+ "PR: Update channel list (support_6ghz=%d, country=%.2s)",
+ pr->cfg->support_6ghz, pr->cfg->country);
+
+ os_memset(&pr->cfg->edca_channels, 0, sizeof(pr->cfg->edca_channels));
+ wpas_pr_setup_edca_channels(wpa_s, &pr->cfg->edca_channels,
+ pr->cfg->pd_format_bw_bitmap,
+ pr->cfg->pd_preamble_bitmap,
+ pr->cfg->support_6ghz);
+
+ os_memset(&pr->cfg->ntb_channels, 0, sizeof(pr->cfg->ntb_channels));
+ wpas_pr_setup_ntb_channels(wpa_s, &pr->cfg->ntb_channels,
+ pr->cfg->pd_format_bw_bitmap,
+ pr->cfg->pd_preamble_bitmap,
+ pr->cfg->support_6ghz);
+}
+
+
void wpas_pr_flush(struct wpa_supplicant *wpa_s)
{
struct pr_data *pr = wpa_s->global->pr;
diff --git a/wpa_supplicant/pr_supplicant.h b/wpa_supplicant/pr_supplicant.h
index e2f05316a..f12da959b 100644
--- a/wpa_supplicant/pr_supplicant.h
+++ b/wpa_supplicant/pr_supplicant.h
@@ -47,6 +47,7 @@ void wpas_pr_measurement_complete(struct wpa_supplicant *wpa_s,
struct peer_measurement_complete *complete);
void wpas_pr_measurement_result(struct wpa_supplicant *wpa_s,
struct peer_measurement_result *result);
+void wpas_pr_update_channel_list(struct wpa_supplicant *wpa_s);
#else /* CONFIG_PR */
@@ -143,6 +144,10 @@ wpas_pr_measurement_result(struct wpa_supplicant *wpa_s,
{
}
+static inline void wpas_pr_update_channel_list(struct wpa_supplicant *wpa_s)
+{
+}
+
#endif /* CONFIG_PR */
#endif /* PR_SUPPLICANT_H */
--
2.55.0.699.gb54405d56f-goog
More information about the Hostap
mailing list