Skip to contentSkip to conversation

nl80211: reset regdom when reloading regdb

PATCH Superseded Finn Behrens 5 participants 10 messages Nov 21, 2020 – Nov 30, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nl80211: reset regdom when reloading regdb

reset the regdom when NL80211_CMD_RELOAD_REGDB is send

---
include/net/regulatory.h | 1 + net/wireless/reg.c | 31 +++++++++++++++++++++++++++++--

2 files changed, 30 insertions(+), 2 deletions(-)
include/net/regulatory.h +0 -0
index 47f06f6f5a67..0cf9335431e0 100644
@@ -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;
};

net/wireless/reg.c +0 -0
index a04fdfb35f07..50314916b020 100644
@@ -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;

Signature · 1 line
2.29.2
#1 lore raw

PATCH v2 1/1 nl80211: reset regdom when reloading regdb

reset the regdom when NL80211_CMD_RELOAD_REGDB is send

---
resend, as patchwork showed it malformed.

 include/net/regulatory.h |  1 +
 net/wireless/reg.c       | 31 +++++++++++++++++++++++++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)
include/net/regulatory.h +1 -0
index 47f06f6f5a67..0cf9335431e0 100644
@@ -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;
 };
net/wireless/reg.c +29 -2
index a04fdfb35f07..50314916b020 100644
@@ -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;
Signature · 1 line
2.29.2
#2 lore raw
Thank you for the patch! Perhaps something to improve:

Hi Finn,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mac80211-next/master]
[also build test WARNING on mac80211/master linus/master v5.10-rc5 next-20201126] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Finn-Behrens/nl80211-reset-regdom-when-reloading-regdb/20201126-184229
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/60f644b62d0171339bf90cbb65245a171d2edc2a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Finn-Behrens/nl80211-reset-regdom-when-reloading-regdb/20201126-184229 git checkout 60f644b62d0171339bf90cbb65245a171d2edc2a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

In file included from include/linux/kernel.h:11,

                    from net/wireless/reg.c:50:
   include/linux/scatterlist.h: In function 'sg_set_buf':
   arch/m68k/include/asm/page_mm.h:169:49: warning: ordered comparison of pointer with null pointer [-Wextra]
     169 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
         |                                                 ^~
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON'
     143 |  BUG_ON(!virt_addr_valid(buf));
         |  ^~~~~~
   include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid'
     143 |  BUG_ON(!virt_addr_valid(buf));
         |          ^~~~~~~~~~~~~~~
   net/wireless/reg.c: In function 'reg_reload_regdb':
>> net/wireless/reg.c:1109:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    1109 |  const struct ieee80211_regdomain *current_regdomain = NULL;
         |  ^~~~~
   net/wireless/reg.c:1113:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    1113 |  struct regulatory_request *request = NULL;
         |  ^~~~~~
   net/wireless/reg.c: In function 'reg_process_hint_user':
>> net/wireless/reg.c:2686:39: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
    2686 |      treatment == REG_REQ_ALREADY_SET &&
         |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
    2687 |    !user_request->reload)
         |    ~~~~~~~~~~~~~~~~~~~~~               

vim +1109 net/wireless/reg.c

1077
1078 int reg_reload_regdb(void)
1079 {
1080 const struct firmware *fw;
1081 void *db;
1082 int err;
1083
1084 err = request_firmware(&fw, "regulatory.db", &reg_pdev->dev);
1085 if (err) {
1086 pr_info("failed to load regulatory.db\n");
1087 return err;
1088 }
1089
1090 if (!valid_regdb(fw->data, fw->size)) {
1091 pr_info("loaded regulatory.db is malformed or signature is missing/invalid\n");
1092 err = -ENODATA;
1093 goto out;
1094 }
1095
1096 db = kmemdup(fw->data, fw->size, GFP_KERNEL);
1097 if (!db) {
1098 err = -ENOMEM;
1099 goto out;
1100 }
1101
1102 rtnl_lock();
1103 if (!IS_ERR_OR_NULL(regdb))
1104 kfree(regdb);
1105 regdb = db;
1106 rtnl_unlock();
1107
1108 // reset regulatory

> 1109		const struct ieee80211_regdomain *current_regdomain = NULL;

1110
1111 current_regdomain = get_cfg80211_regdom();
1112
1113 struct regulatory_request *request = NULL;
1114
1115 request = kzalloc(sizeof(*request), GFP_KERNEL);
1116 if (!request) {
1117 err = -ENOMEM;
1118 goto out;
1119 }
1120
1121 request->wiphy_idx = WIPHY_IDX_INVALID;
1122 request->alpha2[0] = current_regdomain->alpha2[0];
1123 request->alpha2[1] = current_regdomain->alpha2[1];
1124 request->initiator = NL80211_USER_REG_HINT_USER;
1125 request->user_reg_hint_type = NL80211_USER_REG_HINT_USER;
1126 request->reload = true;
1127
1128 queue_regulatory_request(request);
1129
1130 out:
1131 release_firmware(fw);
1132 return err;
1133 }
1134

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

maintainer
#3 lore raw
In reply to Finn Behrens
Quoted 1 line · Finn Behrens

reset the regdom when NL80211_CMD_RELOAD_REGDB is send

Please add a bit more commit message, saying why this is needed.

net/wireless/reg.c int reg_reload_regdb(void) · line 1094

Quoted 12 lines
net/wireless/reg.c +4 -1
 	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;
 	}

These changes seem unrelated.

net/wireless/reg.c int reg_reload_regdb(void) · line 1108

Quoted 5 lines
net/wireless/reg.c +1 -0
@@ -1101,6 +1105,28 @@ int reg_reload_regdb(void)
 	regdb = db;
 	rtnl_unlock();
 
+	// reset regulatory

For whatever reason, the kernel doesn't use C99 comments.

net/wireless/reg.c int reg_reload_regdb(void) · line 1109

Quoted 1 line
net/wireless/reg.c +1 -0
+	const struct ieee80211_regdomain *current_regdomain = NULL;

This should've given you a compiler warning that you shouldn't declare variables in the middle of the code.

Quoted 9 lines
net/wireless/reg.c +9 -0
+	current_regdomain = get_cfg80211_regdom();
+
+	struct regulatory_request *request = NULL;
+
+	request = kzalloc(sizeof(*request), GFP_KERNEL);
+	if (!request) {
+		err = -ENOMEM;
+		goto out;
+	}

net/wireless/reg.c int reg_reload_regdb(void)

Quoted 10 lines
net/wireless/reg.c +9 -0
+
+	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);
 

Why does it even need to be queued - we're in a process context where we can sleep?

johannes

#4 lore raw

PATCH v4 1/1 nl80211: reset regdom when reloading regdb

In reply to Finn Behrens

this reloads the regdom when the regulatory db is reloaded. Without this patch the user had to change the regulatoy domain to a different, and then reset it to the one the user is in, to have the new regulatory db take effect

---
Sorry for taking so long for a new version. The mail provider my company is using had some major problems connecting to the LKML. This is why I now are using my personal mail server.

 include/net/regulatory.h |  1 +
 net/wireless/reg.c       | 26 +++++++++++++++++++++++++-
 2 files changed, 26 insertions(+), 1 deletion(-)
include/net/regulatory.h +1 -0
index 47f06f6f5a67..0cf9335431e0 100644
@@ -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;
 };
net/wireless/reg.c +25 -1
index 0406ce7334fa..3460c0e75c6d 100644
@@ -133,6 +133,7 @@ static u32 reg_is_indoor_portid;
 
 static void restore_regulatory_settings(bool reset_user, bool cached);
 static void print_regdomain(const struct ieee80211_regdomain *rd);
+static void reg_process_hint(struct regulatory_request *reg_request);
 
 static const struct ieee80211_regdomain *get_cfg80211_regdom(void)
 {
@@ -1091,6 +1092,8 @@ int reg_reload_regdb(void)
 	const struct firmware *fw;
 	void *db;
 	int err;
+	const struct ieee80211_regdomain *current_regdomain;
+	struct regulatory_request *request;
 
 	err = request_firmware(&fw, "regulatory.db", &reg_pdev->dev);
 	if (err)
@@ -1113,6 +1116,26 @@ int reg_reload_regdb(void)
 	regdb = db;
 	rtnl_unlock();
 
+	/* reset regulatory domain */
+	current_regdomain = get_cfg80211_regdom();
+
+	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;
+
+	rtnl_lock();
+	reg_process_hint(request);
+	rtnl_unlock();
+
  out:
 	release_firmware(fw);
 	return err;
@@ -2683,7 +2706,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;
Signature · 1 line
2.31.1
maintainer
#5 lore raw

Hi,

Quoted 3 lines

Sorry for taking so long for a new version. The mail provider my company is using had some major problems connecting to the LKML. This is why I now are using my personal mail server.

Did you resend this? Did I lose it before? Or maybe the list lost it and I had a copy? Confusing ...

But anyway:

net/wireless/reg.c int reg_reload_regdb(void) · line 1120

Quoted 6 lines
net/wireless/reg.c +2 -0
@@ -1113,6 +1116,26 @@ int reg_reload_regdb(void)
 	regdb = db;
 	rtnl_unlock();
 
+	/* reset regulatory domain */
+	current_regdomain = get_cfg80211_regdom();

This really is just

	rcu_dereference_rtnl(cfg80211_regdomain);

so it cannot be right that you just unlocked the RTNL and are not under RCU protection here?

I guess we can just keep the RTNL, since ...

Quoted 4 lines
net/wireless/reg.c +4 -0
+	request = kzalloc(sizeof(*request), GFP_KERNEL);
+	if (!request) {
+		err = -ENOMEM;
+		goto out;

net/wireless/reg.c int reg_reload_regdb(void) · line 1135

Quoted 10 lines
net/wireless/reg.c +10 -0
+	}
+
+	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;
+
+	rtnl_lock();

we acquire it again here anyway? Just need a new

net/wireless/reg.c int reg_reload_regdb(void) · line 1136

Quoted 1 line
net/wireless/reg.c +1 -0
+	reg_process_hint(request);

out_unlock:

net/wireless/reg.c int reg_reload_regdb(void) · line 1137

Quoted 1 line
net/wireless/reg.c +1 -0
+	rtnl_unlock();

label there.

net/wireless/reg.c reg_process_hint_user(struct regulatory_request *user_request) · line 2711

Quoted 9 lines
net/wireless/reg.c +2 -1
@@ -2683,7 +2706,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;

That could use some nicer indentation :)

johannes

#6 lore raw

PATCH v5 1/1 nl80211: reset regdom when reloading regdb

In reply to Finn Behrens

this reloads the regdom when the regulatory db is reloaded. Without this patch the user had to change the regulatoy domain to a different, and then reset it to the one the user is in, to have the new regulatory db take effect

---
Hi,
I moved the rtnl_unlock into a label, and requested the current domain from inside the lock. Finn

 include/net/regulatory.h |  1 +
 net/wireless/reg.c       | 27 +++++++++++++++++++++++++--
 2 files changed, 26 insertions(+), 2 deletions(-)
include/net/regulatory.h +1 -0
index 47f06f6f5a67..0cf9335431e0 100644
@@ -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;
 };
net/wireless/reg.c +25 -2
index df87c7f3a049..61f1bf1bc4a7 100644
@@ -133,6 +133,7 @@ static u32 reg_is_indoor_portid;
 
 static void restore_regulatory_settings(bool reset_user, bool cached);
 static void print_regdomain(const struct ieee80211_regdomain *rd);
+static void reg_process_hint(struct regulatory_request *reg_request);
 
 static const struct ieee80211_regdomain *get_cfg80211_regdom(void)
 {
@@ -1098,6 +1099,8 @@ int reg_reload_regdb(void)
 	const struct firmware *fw;
 	void *db;
 	int err;
+	const struct ieee80211_regdomain *current_regdomain;
+	struct regulatory_request *request;
 
 	err = request_firmware(&fw, "regulatory.db", &reg_pdev->dev);
 	if (err)
@@ -1118,8 +1121,27 @@ int reg_reload_regdb(void)
 	if (!IS_ERR_OR_NULL(regdb))
 		kfree(regdb);
 	regdb = db;
-	rtnl_unlock();
 
+	/* reset regulatory domain */
+	current_regdomain = get_cfg80211_regdom();
+
+	request = kzalloc(sizeof(*request), GFP_KERNEL);
+	if (!request) {
+		err = -ENOMEM;
+		goto out_unlock;
+	}
+
+	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;
+
+	reg_process_hint(request);
+
+out_unlock:
+	rtnl_unlock();
  out:
 	release_firmware(fw);
 	return err;
@@ -2690,7 +2712,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;
Signature · 1 line
2.31.1
#7 lore raw

Hi Finn,

Quoted 6 lines · Finn Behrens

this reloads the regdom when the regulatory db is reloaded. Without this patch the user had to change the regulatoy domain to a different, and then reset it to the one the user is in, to have the new regulatory db take effect

This patch as commit 1eda919126b4 ("nl80211: reset regdom when reloading regdb") in -next causes the following clang warning/error:

net/wireless/reg.c:1137:23: error: implicit conversion from enumeration type 'enum nl80211_user_reg_hint_type' to different enumeration type 'enum nl80211_reg_initiator' [-Werror,-Wenum-conversion]

        request->initiator = NL80211_USER_REG_HINT_USER;
                           ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~

1 error generated.

Should that be NL80211_REGDOM_SET_BY_CORE (same value, 0) or something different?

Cheers,
Nathan

#8 lore raw
Quoted 19 lines · Nathan Chancellor

Hi Finn,

Quoted 6 lines · Finn Behrens

this reloads the regdom when the regulatory db is reloaded. Without this patch the user had to change the regulatoy domain to a different, and then reset it to the one the user is in, to have the new regulatory db take effect

This patch as commit 1eda919126b4 ("nl80211: reset regdom when reloading regdb") in -next causes the following clang warning/error:

net/wireless/reg.c:1137:23: error: implicit conversion from enumeration type 'enum nl80211_user_reg_hint_type' to different enumeration type 'enum nl80211_reg_initiator' [-Werror,-Wenum-conversion]

       request->initiator = NL80211_USER_REG_HINT_USER;
                          ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 7 lines

1 error generated.

Should that be NL80211_REGDOM_SET_BY_CORE (same value, 0) or something different?

Cheers,
Nathan

Hi Nathan,

I think It should have been NL80211_REGDOM_SET_BY_USER, as the reload flag check is currently implemented in the user hint function. But If I see it correctly right now. We could remove the reload flag, and NL80211_REGDOM_SET_BY_CORE should work as well. As the reg_query_database function is called unconditionally there.

I will prepare a patch that reverts the reload flag, and changes to NL80211_REGDOM_SET_BY_CORE as this already works. Or should it be NL80211_REGDOM_SET_BY_USER, as it’s results from an user called function?

Cheers,
Finn

#9 lore raw
Quoted 17 lines · Finn Behrens
Quoted 17 lines · Nathan Chancellor
Quoted 6 lines · Finn Behrens

this reloads the regdom when the regulatory db is reloaded. Without this patch the user had to change the regulatoy domain to a different, and then reset it to the one the user is in, to have the new regulatory db take effect

This patch as commit 1eda919126b4 ("nl80211: reset regdom when reloading regdb") in -next causes the following clang warning/error:

net/wireless/reg.c:1137:23: error: implicit conversion from enumeration type 'enum nl80211_user_reg_hint_type' to different enumeration type 'enum nl80211_reg_initiator' [-Werror,-Wenum-conversion]

       request->initiator = NL80211_USER_REG_HINT_USER;
                          ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~

1 error generated.

Quoted 8 lines
Quoted 2 lines

Should that be NL80211_REGDOM_SET_BY_CORE (same value, 0) or something different?

I think It should have been NL80211_REGDOM_SET_BY_USER, as the reload flag check is currently implemented in the user hint function. But If I see it correctly right now. We could remove the reload flag, and NL80211_REGDOM_SET_BY_CORE should work as well. As the reg_query_database function is called unconditionally there.

If you tested the current version of your patch and it worked fine, then it seems like you should just revert the addition of the reload flag and change

request->initiator = NL80211_USER_REG_HINT_USER;

to

request->initiator = NL80211_REGDOM_SET_BY_CORE;

given that is what is happening right now. The warning is basically pointing out that reg_process_hint() is calling reg_process_hint_core() instead of reg_process_hint_user() because NL80211_USER_REG_HINT_USER = NL80211_REGDOM_SET_BY_CORE = 0. Hopefully that makes sense.

Cheers,
Nathan