Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 261657 - net-wireless/iw should include an initscript
Summary: net-wireless/iw should include an initscript
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Netmon Herd
Depends on: 246117
  Show dependency tree
Reported: 2009-03-08 09:01 UTC by Alexander E. Patrakov
Modified: 2012-09-30 07:30 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Alexander E. Patrakov 2009-03-08 09:01:47 UTC
If I install linux-2.6.28 without CONFIG_WIRELESS_OLD_REGULATORY, the kernel queries the regulatory domain from nearby access points and then asks udev to call iw and load the allowed frequency ranges into the kernel. It is also possible to set the sountry by calling "iw reg set RU", but there is no initscript that does this.

Unfortunately, somewhere around my flat there is a misconfigured access point that not only transmits in bands that are illegal in Russia, but also sends out invalid information about the country (says "DE") and thus theoretically can coerce my wireless card to transmit in illegal bands. In order to stop violating the law, I have to either set the channel manually on my wireless card (that's what I do now), or run "iw reg set RU". Please provide the initscript that would allow me to run "iw reg set RU" at boot before bringing up any wireless cards.

Reproducible: Always
Comment 1 Lars Wendler (Polynomial-C) gentoo-dev 2009-03-08 09:52:14 UTC
Reassigning to/CCing maintainers, CCing netmon herd as well.
Comment 2 Mike Auty gentoo-dev 2009-03-08 10:19:50 UTC
Hi Alex,

While we consider the init script issue (since in most cases people will not want to force a specific country, but instead pick it up from the access points, particularly in the context of laptops that travel internationally), a workaround for you would be to add that line to /etc/conf.d/local.start.

The local service gets started generally at the very end of booting or start of shutting down, and simply runs any commands that are found in /etc/conf.d/local.start on startup and /etc/conf.d/local.stop when stopped.  That should allow you to force the country of your choosing.

Rbu, I'm not sure whether it's worth getting everybody to install an initscript (and have it sourced/executed) at the start of every boot if most of the time everything just works automatically like it's supposed to.  I'd also thought udev called crda not iw (given that iw doesn't install udev rules, but crda does), but I could be mistaken about that.  So I'm currently inclined not to add an initscript or ask the crda people (mobile, chainsaw) about it, what do you think?
Comment 3 Alexander E. Patrakov 2009-03-08 10:37:40 UTC

local.start starts after the wireless network is up, and thus too late. And yes, crda may be a more logical place for the initscript.
Comment 4 Robert Buchholz (RETIRED) gentoo-dev 2009-03-14 23:15:21 UTC
By adding an init script, we'd be reinventing the wheel. Setting these options via "iw" is really just using the kernel api to do something other services should be doing. It's like aadding an init script to ifconfig when you really want to expand the "net" scripts.

To make it more constructive, wpa_supplicant (which features an init script) supports setting regulatory restrictions in the latest version, which has an open version bump bug (see blocker):

Furthermore, this could be interesting for NetworkManager ebuild, and maybe actually for the baselayout network config.
Comment 5 Robert Buchholz (RETIRED) gentoo-dev 2009-03-14 23:18:44 UTC
correction... wpa_supplicant does not feature an init script, but is started via dbus and other helpers.
Alexander, did you look into this? Does it solve the problem?
Comment 6 Alexander E. Patrakov 2009-03-15 07:15:36 UTC
I haven't looked yet, and can't do that for a week or so, because my laptop is at work and it is impossible to test wpa_supplicant with only one wireless device.

However, from what is written on that page, it should work.
Comment 7 Davide Pesavento gentoo-dev 2009-03-15 10:37:16 UTC
I fully agree with Robert. Following the Gentoo way, this support should be added to OpenRC networking scripts.

(In reply to comment #2)
> [...] I'd also thought
> udev called crda not iw (given that iw doesn't install udev rules, but crda
> does), but I could be mistaken about that.  So I'm currently inclined not to
> add an initscript or ask the crda people (mobile, chainsaw) about it, what do
> you think?

Yes, udev calls crda when asked to by the kernel, but you cannot manually set the regdomain by invoking crda alone. You have to use 'iw reg set', so by adding the init script to crda, you'd introduce a new dep on iw, which may not be desired, especially on embedded boxes.
Comment 8 Alexander E. Patrakov 2009-03-22 07:00:54 UTC
The wpa_supplicant solution works for me with zd1211rw with today's compat-wireless, and wpa_supplicant 0.6.8 with -Dnl80211.

So the remaining part of the bug is to either deprecate the iwconfig module (and document that), or to add the possibility to set the country to the iwconfig module.
Comment 9 Robert Buchholz (RETIRED) gentoo-dev 2009-11-01 17:09:18 UTC
I am a little lost on this bug. What still needs to be done and by which team?
Comment 10 Mike Auty gentoo-dev 2010-04-02 13:24:51 UTC
Haven't touched iw in over a year, removing myself as maintainer.
Comment 11 David J Cozatt 2010-08-31 23:44:20 UTC
kernel is moving away from iwconfig setting via wpa_supplicant.conf reference

appears to be the proper way to do this

Move laptop after setting to own peril ;-)

iw appears to be recieving releases still

two releases in 2010
Comment 12 Rick Farina (Zero_Chaos) gentoo-dev 2011-02-26 03:55:06 UTC
This discussion, while exciting, seems to have a few misunderstandings.

1.) "iw reg set" does NOT forcibly maintain a reg domain, if you are in Country XY and you connect to an AP broadcasting regdomain AB you will switch to AB

2.) An AP which you do not connect to should have no effect on what regdomain your card thinks it is in, if it does, then please report a bug to the linux-wireless mailing list (I'm happy to help you if that is the case)

The proper solution for this is to either stop connecting to your neighbor's AP, or configure your AP properly.

This does not need an init script as the behavior of the regulatory domain stuff was specifically designed to almost entirely ignore the user's desires (as everything else overrides the user choice automatically).

Just my 0.02$

Comment 13 Alexander E. Patrakov 2011-02-26 08:09:50 UTC
I didn't try to connect to the neighbours' AP. When I reported this bug, I used an ad-hoc wireless network to transfer data between the desktop and the laptop, and DE was clearly in the kernel log.

However, I moved since the bug report and thus cannot tell whether the problem still exists. Feel free to close.
Comment 14 Sergey Popov gentoo-dev 2012-09-30 07:30:58 UTC
I am agreed with Rick, so i close this as INVALID.