LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-19-2015, 07:51 AM   #1
pchristy
Member
 
Registered: Oct 2012
Location: UK
Distribution: Slackware
Posts: 441

Rep: Reputation: Disabled
Network Manager WiFi regional settings


I've searched high and low, but failed to find a definitive answer to this.....

I'm running 64 -current on a laptop, and using network manager for convenience when I'm on the move. When I boot the machine, I can see a message scroll through setting the default (00!) frequencies for the wifi card.

I can set the correct (GB) region for my location using the following line in rc.local:
Code:
iw reg set GB
This works, whether the wifi card is "on" or "off" when I log in.

However, I now see TWO messages during boot - the first setting a default region, then my script re-setting it to GB!

I have so far been unable to locate where the "default" setting is coming from. It doesn't seem to be in any of the scripts in /etc/rc.d

Ideally, I would like to find where this default is being set, and change it to GB. But WHERE is it???

I know its trivial, and I've worked around it. But its annoying me that I can't find where the initial setting is coming from!

Any ideas?

--
Pete
 
Old 11-19-2015, 08:21 AM   #2
atelszewski.versades
Member
 
Registered: Oct 2014
Posts: 61

Rep: Reputation: Disabled
Hi,

Could it be that the kernel sets the default freq?
Can you post the line exactly as printed?

--
Best regards,
Andrzej Telszewski
 
Old 11-19-2015, 08:49 AM   #3
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 5,367

Rep: Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982
All you need to know and more about Linux wireless regulatory support. https://wireless.wiki.kernel.org/en/...ers/Regulatory
 
Old 11-19-2015, 10:20 AM   #4
pchristy
Member
 
Registered: Oct 2012
Location: UK
Distribution: Slackware
Posts: 441

Original Poster
Rep: Reputation: Disabled
Andrzej: I think you are right - it is the kernel setting the initial parameters (see below)!

Allend: Wow! That is heavy going! It tells me what is going on - much of which I had already surmised - but so far, I haven't managed to find out how to over-ride the default. Its probably in there somewhere, but its like trying to find a needle in a haystack!

From dmesg:
Code:
[    8.228710] ath: phy0: ASPM enabled: 0x42
[    8.257544] ath: EEPROM regdomain: 0x65
[    8.257546] ath: EEPROM indicates we should expect a direct regpair map
[    8.257549] ath: Country alpha2 being used: 00
[    8.257551] ath: Regpair used: 0x65
So that's where the "00" is coming from! Then further down:
Code:
[   10.165189] cfg80211: World regulatory domain updated:
[   10.165202] cfg80211:  DFS Master region: unset
[   10.165205] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[   10.165218] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[   10.165227] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[   10.165236] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[   10.165245] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[   10.165254] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[   10.165263] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[   10.165272] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[   10.165280] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
So that appears to be the actual setting being updated to "00", but then:
Code:
[   31.490069] cfg80211: Regulatory domain changed to country: GB
[   31.490076] cfg80211:  DFS Master region: ETSI
[   31.490079] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[   31.490083] cfg80211:   (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[   31.490088] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[   31.490092] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[   31.490095] cfg80211:   (5490000 KHz - 5710000 KHz @ 160000 KHz), (N/A, 2700 mBm), (0 s)
[   31.490098] cfg80211:   (57000000 KHz - 66000000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
[   34.055155] wlan0: authenticate with 30:b5:c2:fe:b4:cd
[   34.080620] wlan0: send auth to 30:b5:c2:fe:b4:cd (try 1/3)
[   34.085238] wlan0: authenticated
[   34.085603] wlan0: associate with 30:b5:c2:fe:b4:cd (try 1/3)
[   34.089461] wlan0: RX AssocResp from 30:b5:c2:fe:b4:cd (capab=0x431 status=0 aid=3)
[   34.089548] wlan0: associated
[   40.142322] IPv4: martian source 255.255.255.255 from 192.168.xxx.xxx, on dev wlan0
[   40.142331] ll header: 00000000: ff ff ff ff ff ff 30 b5 c2 fe b4 cd 08 00        ......0.......
[   43.212360] IPv4: martian source 255.255.255.255 from 192.168.xxx.xxx, on dev wlan0
[   43.212382] ll header: 00000000: ff ff ff ff ff ff 30 b5 c2 fe b4 cd 08 00        ......0.......
[   46.282925] IPv4: martian source 255.255.255.255 from 192.168.xxx.xxx, on dev wlan0
[   46.282935] ll header: 00000000: ff ff ff ff ff ff 30 b5 c2 fe b4 cd 08 00        ......0.......
[   49.352940] IPv4: martian source 255.255.255.255 from 192.168.xxx.xxx, on dev wlan0
[   49.352979] ll header: 00000000: ff ff ff ff ff ff 30 b5 c2 fe b4 cd 08 00        ......0.......
[   52.463487] cfg80211: World regulatory domain updated:
[   52.463495] cfg80211:  DFS Master region: unset
[   52.463497] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[   52.463501] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[   52.463504] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[   52.463507] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[   52.463509] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[   52.463512] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[   52.463515] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[   52.463517] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[   52.463520] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[   52.471238] cfg80211: Regulatory domain changed to country: GB
[   52.471245] cfg80211:  DFS Master region: ETSI
[   52.471247] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[   52.471251] cfg80211:   (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[   52.471254] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[   52.471257] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[   52.471260] cfg80211:   (5490000 KHz - 5710000 KHz @ 160000 KHz), (N/A, 2700 mBm), (0 s)
[   52.471262] cfg80211:   (57000000 KHz - 66000000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
The stuff at 31" seems to be my rc.local kicking in, followed at 34" by wlan0 being set up. The stuff at 40" appears to be rc.firewall (censored by me!). But then, at 52", something seems to reset it all to "00" again, before rc.local (presumably!) kicks it back to GB again!

I've had a look through the kernel config, and can't see anyway of setting the base regulatory domain there. But again, I've been staring at it so long, I'm going screen-blind!

Does any of this give any clues as to what is going on?

--
Pete
 
Old 11-19-2015, 10:37 AM   #5
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 6,483

Rep: Reputation: 4272Reputation: 4272Reputation: 4272Reputation: 4272Reputation: 4272Reputation: 4272Reputation: 4272Reputation: 4272Reputation: 4272Reputation: 4272Reputation: 4272
It could be set by default in the module parameters. Have a look at /sys/module/$MODULE/parameters/ and see what you find in there. (Replace $MODULE with your wireless module, since I don't see it mentioned here)
 
Old 11-19-2015, 10:49 AM   #6
pchristy
Member
 
Registered: Oct 2012
Location: UK
Distribution: Slackware
Posts: 441

Original Poster
Rep: Reputation: Disabled
bassmadrigal: The module is ath9k. There are three directories under /sys/module for the ath9k: ath9k, ath9k_common and ath9k_hw. Only the base ath9k has an entry for parameters, and there's nothing in there that looks remotely like a regional setting! Good try, though! ;-)

--
Pete
 
Old 11-19-2015, 05:24 PM   #7
atelszewski
Member
 
Registered: Aug 2007
Distribution: Slackware
Posts: 890

Rep: Reputation: Disabled
Hi,

Anyways, other than for ideological reasons, you shouldn't be bothered with all the region changes you see, if in the end you get the region you want. The point is that, the kernel has the very wanted ability to change the region and that's just what you observe.

On the other side, I could understand you, because I sometimes do spend enormous amount of time trying to silence otherwise completely unimportant message. quiet kernel parameter is your friend

--
Best regards,
Andrzej Telszewski
 
Old 11-19-2015, 05:56 PM   #8
chris.willing
Member
 
Registered: Jun 2014
Location: Brisbane, Australia
Distribution: Slackware,LFS
Posts: 604

Rep: Reputation: 391Reputation: 391Reputation: 391Reputation: 391
I think there's a better way than a command in rc.local; that is to set the regulatory domain when the responsible module (cfg80211) is loaded. I do mine via a file in /etc/modprobe.d/8812au.conf (where 8812au is the name of my wifi module - I guess its the ath module for you). You can see from that file that cfg80211 is made a dependency of the 8812au i.e. cfg80211 is loaded before8812au; also when cfg80211 is loaded, it is set up with the regulatory domain that I want.
Code:
chris@d6:~$ cat /etc/modprobe.d/8812au.conf 
softdep 8812au pre: cfg80211
options cfg80211 ieee80211_regdom=AU
Without that, the domain chosen is read from firmware in the wifi device. As a result, mine used to default to VE (Venezuela) and although wifi still worked, it's nice to know that it's now set correctly.

chris
 
2 members found this post helpful.
Old 11-20-2015, 01:48 AM   #9
mralk3
Senior Member
 
Registered: May 2015
Location: Utah, USA
Distribution: Slackware
Posts: 1,391

Rep: Reputation: 770Reputation: 770Reputation: 770Reputation: 770Reputation: 770Reputation: 770Reputation: 770
A while back there was a thread about this that might be of interest. After a lot of troubleshooting I came up with a really simple solution that had nothing to do with kernel modules or rc.local.

I added a script: /etc/NetworkManager/dispatcher.d/pre-up.d/99set-reg-domain.sh

It contains the following:

Code:
#!/bin/sh

set -e

status=`cat /sys/class/net/wlan0/operstate` 

if [[ $status == 'up' ]]
then
        iw reg set US
fi
My NIC, lspci -v | grep Network:

Code:
04:00.0 Network controller: Intel Corporation Wireless 7260 (rev bb)
I haven't had any spamming about regulatory domain in my logs since I did this because the reg. domain is being set right before the NIC is brought up given an IP address.

I am sure there is a more elegant way to script this so it works on all Slackware machines by pulling the country code from whichever timezone the machine is located in, but meh, it works as is.

EDIT:
My script is just a hack in the end. Using Network Manager to change regulatory domains hasn't been implemented.


This might also be helpful for those who want to make the kernel set the right reg domain (during source compile) for their usage on Atheros chipsets: https://forums.gentoo.org/viewtopic-t-980448.html

Last edited by mralk3; 11-20-2015 at 02:09 AM.
 
1 members found this post helpful.
Old 11-20-2015, 04:30 AM   #10
atelszewski.versades
Member
 
Registered: Oct 2014
Posts: 61

Rep: Reputation: Disabled
Hi,

I'm sorry to hijack the thread, @mralk3 how did you mange to have the strikethrough text, like with "is brought up"?
I just cannot find this option in the editor.

--
Best regards,
Andrzej Telszewski
 
Old 11-20-2015, 04:33 AM   #11
pchristy
Member
 
Registered: Oct 2012
Location: UK
Distribution: Slackware
Posts: 441

Original Poster
Rep: Reputation: Disabled
Well this is quite interesting! It appears that there is no "official" way to set the reg. domain - or if there is, its well hidden - so we are left with kludges that appear to work, but are less than pleasing aesthetically!

Mralk3: That item on the Gentoo forums is interesting, and is probably the closest thing to doing it early in the boot process as we will get. BUT, it means remembering to edit the kernel files every time you compile a new kernel!

I like Chris' script to force the reg domain when the module is loaded. That was the kind of thing I was hoping to find! I had already tried creating a file in /etc/default following a thread on another forum:
Code:
cat /etc/default/crda
REGDOMAIN=GB
but that didn't work!

I'll give Chris' idea a try and report back.....

--
Pete
 
Old 11-20-2015, 05:10 AM   #12
pchristy
Member
 
Registered: Oct 2012
Location: UK
Distribution: Slackware
Posts: 441

Original Poster
Rep: Reputation: Disabled
Well, Chris' solution works, and is the most "elegant" I've found yet! Well done, that man!

The nice thing is that it is easy to "tweak" when I travel abroad!

I created a file ath9k.conf, which I placed in /etc/modprobe.d:
Code:
cat /etc/modprobe.d/ath9k.conf 
softdep ath9k pre: cfg80211
options cfg80211 ieee80211_regdom=GB
I was tempted to put it in /lib/modprobe.d, but the README in /etc/modprobe.d indicates that files in there will over-ride anything in /lib/modprobe.d. I also like the idea of keeping "my" files separate from system files, where possible! There was no ath9k.conf file in /lib/modprobe.d, so I shouldn't be over-riding anything done by the system.

Now, dmesg reports:
Code:
 dmesg |grep cfg80211
[    8.676498] cfg80211: World regulatory domain updated:
[    8.703503] cfg80211:  DFS Master region: unset
[    8.704191] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[    8.758589] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[    8.786616] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[    8.813934] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[    8.840802] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[    8.867699] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[    8.894262] cfg80211:   (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[    8.920853] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[    8.947224] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[    9.147378] cfg80211: Regulatory domain changed to country: GB
[    9.173602] cfg80211:  DFS Master region: ETSI
[    9.174297] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[    9.227516] cfg80211:   (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[    9.255089] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[    9.282999] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[    9.310499] cfg80211:   (5490000 KHz - 5710000 KHz @ 160000 KHz), (N/A, 2700 mBm), (0 s)
[    9.337948] cfg80211:   (57000000 KHz - 66000000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
As you can see, there is still an initial set to "00" - presumably triggered by the internal firmware as discussed earlier - but it is immediately over-ridden when the module loads. And it all happens at the same time, and only once!

So I think we have a working solution. Maybe this is something that should be added to the Slackbook? I won't mark this thread as "solved" for another day or so to allow for further discussion / ideas.

Many thanks to all those who have contributed!

--
Pete
 
Old 11-20-2015, 05:28 AM   #13
atelszewski.versades
Member
 
Registered: Oct 2014
Posts: 61

Rep: Reputation: Disabled
Hi,

The reason it shows up twice might be that there are two different stages:
1. "World regulatory domain updated:"
2. "Regulatory domain changed to country: GB"

One is "update", the other is "change".
My guess is it's just fine.

When it comes to the ultimate solution, I think we won't have one until the tool you're using for managing the WiFi can handle it.
For example, I think that NetworkManager should have this option. The point is, you shouldn't need to edit files or do other hacks just to change the regulatory domain.

--
Best regards,
Andrzej Telszewski
 
Old 11-20-2015, 06:11 AM   #14
pchristy
Member
 
Registered: Oct 2012
Location: UK
Distribution: Slackware
Posts: 441

Original Poster
Rep: Reputation: Disabled
Andrzej: Yes, agreed. Maybe Mralk3's link to the kernel mod would prevent the apparent double initialisation. I could do that, as I "roll my own" kernels, but how many others do? And its a pain (and easy to forget!) having to do that every time you compile a new kernel.

I absolutely agree with you about the "absolute solution". This is something that every network manager ought to take in its stride. Frankly, I can't understand why it can't be automated, based on location settings during install, and maybe updated when connected to a network. This way the "default" would be your home country, where you presumably installed the system, but then if you traveled abroad, it would update when it connected to a network (which would presumably provide location information).

The biggest problem I have found is a lack of a standard way of doing this - at least, finding any *documented* standard way. I really think this is something that should be more generally known.

--
Pete
 
Old 11-20-2015, 06:26 AM   #15
atelszewski.versades
Member
 
Registered: Oct 2014
Posts: 61

Rep: Reputation: Disabled
Hi,

Quote:
This way the "default" would be your home country, where you presumably installed the system, but then if you traveled abroad, it would update when it connected to a network (which would presumably provide location information).
There was an attempt to do that as mentioned in the link provided by @mralk3. They wanted to use GeoClue, but haven't completed. I think that would be really awesome

On the other side, I guess that Linux is not lagging by other OSes. I guess other OSes also don't provide an easy/automated way of handling this particular problem. But I might be wrong.

--
Best regards,
Andrzej Telszewski
 
  


Reply

Tags
region, wifi


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
wicd network manager can'f find my wifi network kenshinji Linux - Software 22 07-12-2013 09:56 PM
Wine Regional Settings amk229 Linux - Software 4 04-29-2011 04:56 AM
Unable to connect to wifi network with network manager. Poss authorization issue openSauce Linux - Networking 14 12-13-2008 11:05 AM
Question Regarding Regional settings AQG SUSE / openSUSE 2 06-02-2008 02:00 PM
How to change regional settings... am/pm browny_amiga Linux - General 2 08-27-2003 05:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration