summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChenming Huang <quic_chenhuan@quicinc.com>2023-03-08 15:39:22 +0800
committerJouni Malinen <j@w1.fi>2023-03-09 20:59:20 +0200
commita34b8477a73f095cbd80b8a5051fcf1cefd9dbfa (patch)
treeb33b3abfb01787ed38d3be65e51513ea298d51c6 /src
parent1491fc64a820ac8949f318ab4e710c26e7d14fee (diff)
downloadhostap-a34b8477a73f095cbd80b8a5051fcf1cefd9dbfa.tar.gz
ml80211: Put wiphy idx to obtain correct country code
If wiphy idx not provided, kernel returns global reg domain when processing NL80211_CMD_GET_REG. To obtain the correct country code for the self-managed regulatory cases, put wiphy idx into nl_msg when sending this command to kernel. Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
Diffstat (limited to 'src')
-rw-r--r--src/drivers/driver_nl80211.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index c32822cc9..db1d73f2f 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1900,6 +1900,16 @@ static int wpa_driver_nl80211_get_country(void *priv, char *alpha2)
return -ENOMEM;
nl80211_cmd(drv, msg, 0, NL80211_CMD_GET_REG);
+
+ if (drv->capa.flags & WPA_DRIVER_FLAGS_SELF_MANAGED_REGULATORY) {
+ /* put wiphy idx to get the interface specific country code
+ * instead of the global one. */
+ if (nla_put_u32(msg, NL80211_ATTR_WIPHY, drv->wiphy_idx)) {
+ nlmsg_free(msg);
+ return -1;
+ }
+ }
+
alpha2[0] = '\0';
ret = send_and_recv_msgs(drv, msg, nl80211_get_country, alpha2,
NULL, NULL);