All of lore.kernel.org
 help / color / mirror / Atom feed
From: Finn Behrens <fin@nyantec.com>
To: linux-wireless@vger.kernel.org
Subject: [PATCH] nl80211: reset regdom when reloading regdb
Date: Sat, 21 Nov 2020 13:45:03 +0100	[thread overview]
Message-ID: <8c3e46ac-331b-0922-5379-0cb1ef61a83b@nyantec.com> (raw)

reset the regdom when NL80211_CMD_RELOAD_REGDB is send

Signed-off-by: Finn Behrens <fin@nyantec.com>
---
include/net/regulatory.h | 1 +
net/wireless/reg.c | 31 +++++++++++++++++++++++++++++--
2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/include/net/regulatory.h b/include/net/regulatory.h
index 47f06f6f5a67..0cf9335431e0 100644
--- a/include/net/regulatory.h
+++ b/include/net/regulatory.h
@@ -83,6 +83,7 @@ struct regulatory_request {
enum nl80211_dfs_regions dfs_region;
bool intersect;
bool processed;
+ bool reload;
enum environment_cap country_ie_env;
struct list_head list;
};
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index a04fdfb35f07..50314916b020 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -199,6 +199,7 @@ static struct regulatory_request *get_last_request(void)
/* Used to queue up regulatory hints */
static LIST_HEAD(reg_requests_list);
static spinlock_t reg_requests_lock;
+static void queue_regulatory_request(struct regulatory_request *request);
/* Used to queue up beacon hints for review */
static LIST_HEAD(reg_pending_beacons);
@@ -1081,10 +1082,13 @@ int reg_reload_regdb(void)
int err;
err = request_firmware(&fw, "regulatory.db", &reg_pdev->dev);
- if (err)
+ if (err) {
+ pr_info("failed to load regulatory.db\n");
return err;
+ }
if (!valid_regdb(fw->data, fw->size)) {
+ pr_info("loaded regulatory.db is malformed or signature is
missing/invalid\n");
err = -ENODATA;
goto out;
}
@@ -1101,6 +1105,28 @@ int reg_reload_regdb(void)
regdb = db;
rtnl_unlock();
+ // reset regulatory
+ const struct ieee80211_regdomain *current_regdomain = NULL;
+
+ current_regdomain = get_cfg80211_regdom();
+
+ struct regulatory_request *request = NULL;
+
+ request = kzalloc(sizeof(*request), GFP_KERNEL);
+ if (!request) {
+ err = -ENOMEM;
+ goto out;
+ }
+
+ request->wiphy_idx = WIPHY_IDX_INVALID;
+ request->alpha2[0] = current_regdomain->alpha2[0];
+ request->alpha2[1] = current_regdomain->alpha2[1];
+ request->initiator = NL80211_USER_REG_HINT_USER;
+ request->user_reg_hint_type = NL80211_USER_REG_HINT_USER;
+ request->reload = true;
+
+ queue_regulatory_request(request);
+
out:
release_firmware(fw);
return err;
@@ -2657,7 +2683,8 @@ reg_process_hint_user(struct regulatory_request
*user_request)
treatment = __reg_process_hint_user(user_request);
if (treatment == REG_REQ_IGNORE ||
- treatment == REG_REQ_ALREADY_SET)
+ treatment == REG_REQ_ALREADY_SET &&
+ !user_request->reload)
return REG_REQ_IGNORE;
user_request->intersect = treatment == REG_REQ_INTERSECT;

-- 
2.29.2



             reply	other threads:[~2020-11-21 12:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-21 12:45 Finn Behrens [this message]
2020-11-26 10:39 ` [PATCH v2] nl80211: reset regdom when reloading regdb Finn Behrens
2020-11-26 12:58   ` kernel test robot
2020-11-26 12:58     ` kernel test robot
2020-12-04 11:39   ` Johannes Berg
2021-11-13 10:54   ` [PATCH v4] " Finn Behrens
2021-11-26 12:08     ` Johannes Berg
2021-11-27 10:28     ` [PATCH v5] " Finn Behrens
2021-11-30 16:02       ` Nathan Chancellor
2021-11-30 16:50         ` Finn Behrens
2021-11-30 18:32           ` Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8c3e46ac-331b-0922-5379-0cb1ef61a83b@nyantec.com \
    --to=fin@nyantec.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.