I believe you can do this through the Kernel module directly. Most of the Kernel modules can take parameters that you can either pass in when the driver's loaded or they can be loaded via a configuration file during boot up.
Example (2.6 Kernels)
I have a Fedora 14 system with the following wireless drivers.
$ lsmod |grep iw
iwlagn 209751 0
iwlcore 195714 1 iwlagn
mac80211 229095 2 iwlagn,iwlcore
cfg80211 134981 3 iwlagn,iwlcore,mac80211
The module we're interested in is the mac80211
one, here's more info about it:
$ modinfo mac80211
filename: /lib/modules/2.6.35.14-106.fc14.x86_64/kernel/net/mac80211/mac80211.ko
license: GPL
description: IEEE 802.11 subsystem
srcversion: 8D64C9A86E6BE7B4C1AF862
depends: cfg80211
vermagic: 2.6.35.14-106.fc14.x86_64 SMP mod_unload
parm: ieee80211_default_rc_algo:Default rate control algorithm for mac80211 to use (charp)
parm: ieee80211_disable_40mhz_24ghz:Disable 40MHz support in the 2.4GHz band (bool)
You can also use the -p
switch to just get a modules parameters:
$ modinfo -p mac80211
ieee80211_disable_40mhz_24ghz:Disable 40MHz support in the 2.4GHz band
ieee80211_default_rc_algo:Default rate control algorithm for mac80211 to use
If you notice the section at the bottom where is specifies parm:
, these are the parameters that you can pass into this module to change how it's configured. The option you're interested in is this one: ieee80211_disable_40mhz_24ghz
. You can load it with this command to disable it:
$ sudo modprobe mac80211 ieee80211_disable_40mhz_24ghz=1
Unloading & Loading modules
To get to a point where you can do this you need to unload the other modules that depend on this one. You can see the dependency list in the lsmod
output above, mainly:
mac80211 229095 2 iwlagn,iwlcore
So we need to uninstall these 2 modules:
$ sudo rmmod iwlagn
$ sudo rmmod iwlcore
Now we can uninstall mac80211:
$ sudo rmmod mac80211
Now we can reload it with the parameter to disable the 2.4GHz feature:
$ sudo modprobe mac80211 ieee80211_disable_40mhz_24ghz=1
Now we can reload the other 2 modules:
$ sudo modprobe iwlagn
It's sufficient to just modprobe
the highest driver in the stack, the Kernel will take care to reload any additional modules that it depends on.
$ lsmod | grep iw
iwlagn 209751 0
iwlcore 195714 1 iwlagn
mac80211 229095 2 iwlagn,iwlcore
cfg80211 134981 3 iwlagn,iwlcore,mac80211
Example (3.x Kernels)
Things changed slightly with the 3.x Linux Kernels. The parameter ieee80211_disable_40mhz_24ghz
was moved from the mac80211
module to the cfg80211
module. So all the steps are still relevant except you'll need to substitute in the cfg80211
module where mac80211
was used.
What parameters was a module loaded with?
There isn't a command to do this directly, but some modules expose this information in the /sys/module
file system. For example:
$ cat /sys/module/mac80211/parameters/ieee80211_disable_40mhz_24ghz
Y
References
It looks like someone actually made a tool to do what you want here though: http://www.mit.edu/people/kolya/wifiassocd/
You might get lucky. That's all I have.
– krowe Sep 19 '13 at 00:25