Gentoo Madwifi
From DSO Wiki
Make sure you have compiled your kernel with the following options (note that the location of options in your kernel may differ). Linux Kernel Configuration: MadWifi kernel options
Loadable module support
[*] Enable loadable module support
[*] Module unloading
[*] Automatic kernel module loading (optional)
Device Drivers
[*] Networking support
Wireless LAN (non-hamradio) --->
[*] Wireless LAN drivers (non-hamradio) & Wireless Extensions
After ensuring that you have fulfilled the MadWifi requirements, install the madwifi-ng package with: emerge -av madwifi-ng madwifi-ng-tools
The kernel module for modprobe is "ath_pci". [edit] Installing from source
If you have installed MadWifi from portage, you should remove it first: emerge -C madwifi-ng madwifi-ng-tools
For information on different methods of obtaining MadWifi, see the MadWifi wiki article Getting MadWifi.
If you choose to use subversion, you will first need to install it with: emerge -a subversion
For instructions on installing MadWifi from source, see the MadWifi First Time How To. [edit] Using your device as an access point
Your card will enter standard mode by default, but you want to bring the driver up in master mode. To accomplish this, you need to edit the module options. Note that the default behavior of etc-update will be to remove this customization, so remember to do what is necessary to keep your changes after re-emerging madwifi-ng (say, after a kernel compile). File: /etc/modules.d/ath_pci options ath_pci autocreate=ap
You'll now need to run: update-modules
It's also possible to set the driver into master mode without needing to reload the module itself. This way, you have to take the interface down, destroy it, and rebuild it in the new mode, which goes by the name 'ap' rather than 'master.' Here's how it works: ifconfig ath0 down wlanconfig ath0 destroy wlanconfig ath0 create wlandev wifi0 wlanmode ap
You could also skip the 0 in the last command, as wlandev will choose the first available integer if none is supplied. The benefit of this tool seems to be that you can create an arbitrary number of virtual ath interfaces, which could presumably be used to service multiple separate LANs with different access control and/or features. In any case, once you've created the new device in mode 'ap' you should see it in the output from iwconfig and it should say "Mode:Master"
Note that in all the rest of the configuration you should use the 'ath0' device, rather than 'wifi0' which appears to just be a container for the rest of the stuff. Tip: If you get the error "Could not connect to kernel driver" (when trying to start hostapd) look in your hostapd.conf if you have enabled encryption because if you haven't the interface isn't started correctly. For details: Madwifi Trouble Ticket.
To set up the wireless interface, you'll need to do this first: cp -R /etc/init.d/net.lo /etc/init.d/net.ath0. The "-R" option causes the `cp` to act upon the symlink, rather than following it to the original file. File: /etc/conf.d/net
modules_ath0=( "iwconfig" ) ifconfig_ath0=( "192.168.0.1 netmask 255.255.255.0" ) mode_ath0="Master" essid_ath0="Your ESSID" channel_ath0="1"
# Set the card's 802.11a/b/g mode: # Mode 0 = Autoselect (this mode will automatically detect the client's mode and change to it) # 1 = 802.11a # 2 = 802.11b # 3 = 802.11g iwpriv_ath0="mode 0"
# Suppress ssid broadcast: iwpriv_ath0="hide_ssid 1"
# Configure multiple iwpriv settings (example):
iwpriv_ath0=(
"mode 3"
"hide_ssid 1"
)
You should add ath_pci to /etc/modules.autoload.d/kernel-2.6 to ensure that it is loaded at boot: echo ath_pci >> /etc/modules.autoload.d/kernel-2.6
And you'll probably want to bring the wireless interface up at boot, too: rc-update add net.ath0 default
Run /etc/init.d/net.ath0 start to start the interface. [edit] Troubleshooting
If you have any problems with building MadWifi, please first check refer to "BuildProblems" on the MadWifi wiki. [edit] ARCH mismatch: supplied "x86", determined "i386" (or "x86_64" or similar)
MadWifi 0.9.3 is not compatible with 2.6.24 kernels. However, the (currently) keyworded 0.9.4 packages do work with 2.6.24. Add the follow lines of your choice to /etc/portage/package.keywords: File: /etc/portage/package.keywords . . .
- Add the following two lines if you want the latest keyworded madwifi driver and tools
net-wireless/madwifi-ng net-wireless/madwifi-ng-tools . . .
- Add these if you only want to explicitly allow 0.9.4
~net-wireless/madwifi-ng-0.9.4 ~net-wireless/madwifi-ng-tools-0.9.4 . . .
[edit] Broken Regulatory Domain
Some Atheros-based cards (in particular D-Link models such as the DWL-AG530) have the regulatory domain set wrong. The domain set for these cards will work with the vendor-specific Windows drivers, but not with generic Atheros drivers such as madwifi.
To check your card's regulatory domain, type the following with madwifi loaded, replacing "wifi0" by the device name: sysctl dev.wifi0.regdomain
You should see output along the lines of: dev.wifi0.regdomain = 18
If the regular domain is set to 18 (unknown, 0x12), you will need to fix it. Use these steps to patch the regdomain to 16 (FCC, 0x10): Make sure ath_pci is loaded: modprobe ath_pci Run lspci to find the card's memory address: lspci -v Code: lspci -v
0000:00:0a.0 Ethernet controller: Atheros Communications, Inc. AR5212 802.11abg NIC (rev 01) Subsystem: D-Link System Inc: Unknown device 3a14 Flags: bus master, medium devsel, latency 168, IRQ 169 Memory at ec100000 (32-bit, non-prefetchable) size=64K Capabilities: 44 Power Management version 2
The memory address shown above is 0xec100000.
Find the regdomain to set; 0x10 (16) is FCC.
Run the ath_info utility from madwifi, replacing address by an address such as 0xec100000 and regdomain by the new regdomain, such as 0x10: ath_info -w <address> regdomain <regdomain>
The tool will ask for confirmation. Double check the value, and confirm.
Reload the module.
