2014-06-11 05:00:45

by Janusz Dziedzic

[permalink] [raw]
Subject: [PATCH] cfg80211: reg: setup correct alpha2 after intersection

Setup correct alfa2 in last request after intersection.
In other case after intersection we could not change/set
new country using eg. iw reg set

Failed scenario:
- insmod cfg80211.ko
- iw reg set FR
- modprobe ath10k_pci (US hint)
- intersection and country set as "98"
- no way to setup new country using iw reg set

Signed-off-by: Janusz Dziedzic <[email protected]>
---
@Luis I am not sure this is the best way to fix it, please review.

net/wireless/reg.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 82948c8..8fd82b2 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -271,6 +271,7 @@ static void reset_regdomains(bool full_reset,
const struct ieee80211_regdomain *new_regdom)
{
const struct ieee80211_regdomain *r;
+ struct regulatory_request *lr;

ASSERT_RTNL();

@@ -284,6 +285,12 @@ static void reset_regdomains(bool full_reset,
if (r == &world_regdom)
r = NULL;

+ lr = get_last_request();
+ if (lr && new_regdom) {
+ lr->alpha2[0] = new_regdom->alpha2[0];
+ lr->alpha2[1] = new_regdom->alpha2[1];
+ }
+
rcu_free_regdom(r);
rcu_free_regdom(cfg80211_world_regdom);

--
1.7.9.5



2014-06-11 08:43:27

by Luis Chamberlain

[permalink] [raw]
Subject: Re: [PATCH] cfg80211: reg: setup correct alpha2 after intersection

On Tue, Jun 10, 2014 at 10:00 PM, Janusz Dziedzic
<[email protected]> wrote:
> Setup correct alfa2 in last request after intersection.
> In other case after intersection we could not change/set
> new country using eg. iw reg set
>
> Failed scenario:
> - insmod cfg80211.ko
> - iw reg set FR
> - modprobe ath10k_pci (US hint)
> - intersection and country set as "98"
> - no way to setup new country using iw reg set
>
> Signed-off-by: Janusz Dziedzic <[email protected]>

This approach seems good to me Janusz, but I think the commit log
doesn't describe the issue precisely and I do have a few questions, so
consider this patch not yet ACKd. The reset_regdmains() will be
triggered on certain type of events, the intersection is pertinent and
valid up to the point some specific state hasn't changed on the
devices present though, for example a dissociation form AP if its a
STA. Its important that the type of hint was a user hint though --
that tells us further compliance is desired. If the ath10k_pci device
is an AP and it required a US hint the original FR hint can help with
the intersection but further events can 'reset' that originally preset
user setting for FR. FR in this case was passed as user hint and it
can be a subjective matter if we want to upkeep FR or not, that's up
to us to decide. In this case I think it does make sense to upkeep it
always -- that's why we also had cached user specific regulatory
settings into some other user alpha2 (sorry don't have a terminal
right now so just replying to the review right now, should be easy to
find). So it seems to me you were trying to preserve the userspace
original hint, why is that not being preserved, I think the
reset_regdomains() should have upkept that already.

Luis