2016-06-02 14:04:15

by Belisko Marek

[permalink] [raw]
Subject: iw reg overwritten after connecting to AP

Hello,

I'm using kernel 4.1 with option CONFIG_CFG80211_INTERNAL_REGDB
enabled. I have set one country in db.txt which during startup I set
via 'iw reg set XX'. When connected to some AP which sends country
code (e.g. SK) region is overwritten to 00 (in kernel log there is
some timeout message - I suppose it's communication with crda daemon
which I'm not using). Is there a way how to override this behavior (to
keep my regulatory persistent). Many thanks.

BR,

marek

--
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com


2016-06-02 20:32:13

by Belisko Marek

[permalink] [raw]
Subject: Re: iw reg overwritten after connecting to AP

Hi Krishna,

On Thu, Jun 2, 2016 at 10:21 PM, Krishna Chaitanya
<[email protected]> wrote:
> On Thu, Jun 2, 2016 at 7:34 PM, Belisko Marek <[email protected]> wrote:
>>
>> Hello,
>>
>> I'm using kernel 4.1 with option CONFIG_CFG80211_INTERNAL_REGDB
>> enabled. I have set one country in db.txt which during startup I set
>> via 'iw reg set XX'. When connected to some AP which sends country
>> code (e.g. SK) region is overwritten to 00 (in kernel log there is
>> some timeout message - I suppose it's communication with crda daemon
>> which I'm not using). Is there a way how to override this behavior (to
>> keep my regulatory persistent). Many thanks.
>>
> You need to disable country_ie hints, you driver has to advertise
> REGULATORY_WIPHY_SELF_MANAGED in the wiphy.regualtory_flags
> to disable beacon and country_ie hints.
I would like to keep beacon hinting (maybe disable only country_ie). I
have same setup but with 3.9 kernel and regulatory isn't overwritten.
>
> Which driver are you using?
I'm using mwifiex driver

Thanks,

BR,

marek


--
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com

2016-06-02 20:21:36

by Krishna Chaitanya

[permalink] [raw]
Subject: Re: iw reg overwritten after connecting to AP

On Thu, Jun 2, 2016 at 7:34 PM, Belisko Marek <[email protected]> wrote:
>
> Hello,
>
> I'm using kernel 4.1 with option CONFIG_CFG80211_INTERNAL_REGDB
> enabled. I have set one country in db.txt which during startup I set
> via 'iw reg set XX'. When connected to some AP which sends country
> code (e.g. SK) region is overwritten to 00 (in kernel log there is
> some timeout message - I suppose it's communication with crda daemon
> which I'm not using). Is there a way how to override this behavior (to
> keep my regulatory persistent). Many thanks.
>
You need to disable country_ie hints, you driver has to advertise
REGULATORY_WIPHY_SELF_MANAGED in the wiphy.regualtory_flags
to disable beacon and country_ie hints.

Which driver are you using?

2016-06-03 07:01:25

by Krishna Chaitanya

[permalink] [raw]
Subject: Re: iw reg overwritten after connecting to AP

On Fri, Jun 3, 2016 at 2:02 AM, Belisko Marek <[email protected]> wrote:
>
> Hi Krishna,
>
> On Thu, Jun 2, 2016 at 10:21 PM, Krishna Chaitanya
> <[email protected]> wrote:
> > On Thu, Jun 2, 2016 at 7:34 PM, Belisko Marek <[email protected]> wrote:
> >>
> >> Hello,
> >>
> >> I'm using kernel 4.1 with option CONFIG_CFG80211_INTERNAL_REGDB
> >> enabled. I have set one country in db.txt which during startup I set
> >> via 'iw reg set XX'. When connected to some AP which sends country
> >> code (e.g. SK) region is overwritten to 00 (in kernel log there is
> >> some timeout message - I suppose it's communication with crda daemon
> >> which I'm not using). Is there a way how to override this behavior (to
> >> keep my regulatory persistent). Many thanks.
> >>
> > You need to disable country_ie hints, you driver has to advertise
> > REGULATORY_WIPHY_SELF_MANAGED in the wiphy.regualtory_flags
> > to disable beacon and country_ie hints.
> I would like to keep beacon hinting (maybe disable only country_ie). I
> have same setup but with 3.9 kernel and regulatory isn't overwritten.
>
>
> > Which driver are you using?
> I'm using mwifiex driver

I am not familiar with this driver.

But looks like for any other country except for WORLD mode
it is disabling both beacon and country_ie hints. But for any
other country these hints are enabled.

may be you can try the below patch (not based on 4.1 so you might have to port)
for your case disabling country_ie for all regulatory domains.

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 6db202f..cb95138 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -4072,8 +4072,9 @@ int mwifiex_register_cfg80211(struct
mwifiex_adapter *adapter)
wiphy->n_cipher_suites = ARRAY_SIZE(mwifiex_cipher_suites);

if (adapter->region_code)
- wiphy->regulatory_flags |= REGULATORY_DISABLE_BEACON_HINTS |
- REGULATORY_COUNTRY_IE_IGNORE;
+ wiphy->regulatory_flags |= REGULATORY_DISABLE_BEACON_HINTS;
+
+ wiphy->regulatory_flags |= REGULATORY_COUNTRY_IE_IGNORE;

ether_addr_copy(wiphy->perm_addr, adapter->perm_addr);
wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;