From 224eddb03b95434cdd1efbbb1aed1c1d81b019eb Mon Sep 17 00:00:00 2001 From: Peng Xu Date: Thu, 18 Oct 2018 12:03:25 -0700 Subject: [PATCH] nl80211: Read reg-domain information from a specific wiphy If driver supports self-managed regulatory domain, read reg-domain information for that specific wiphy interface instead the global information which may be different which such drivers. This fixes issues where a regulatory update with a self-managed regulatory domain driver ended up building incorrect list of supported channels for upper layer hostapd/wpa_supplicant operations. Signed-off-by: Jouni Malinen --- src/drivers/driver_nl80211_capa.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c index c751713e7..7b360d209 100644 --- a/src/drivers/driver_nl80211_capa.c +++ b/src/drivers/driver_nl80211_capa.c @@ -1921,6 +1921,13 @@ static int nl80211_set_regulatory_flags(struct wpa_driver_nl80211_data *drv, return -ENOMEM; nl80211_cmd(drv, msg, 0, NL80211_CMD_GET_REG); + if (drv->capa.flags & WPA_DRIVER_FLAGS_SELF_MANAGED_REGULATORY) { + if (nla_put_u32(msg, NL80211_ATTR_WIPHY, drv->wiphy_idx)) { + nlmsg_free(msg); + return -1; + } + } + return send_and_recv_msgs(drv, msg, nl80211_get_reg, results); }