# wpa_supplicant 0.4.7, kernel 2.6.14 & madwifi-ng all working

## djnauk

There have been a number of problems recently for those (unlucky) few who have Atheros cards, a WPA wireless connection and have installed the latest kernel (i.e. 2.6.14 or later).

The long and short being that there were changes to the way the kernel works with wireless extensions (i.e. no longer through /proc/net/wireless), that madwifi is transitioning to a new codebase (also known as madwifi-ng), and hence there are no updates for the old codebase to work with the new extensions system, and also from wpa_supplicant (about 0.4.5 I think), only the newer madwifi-ng codebase is supported.

Tied with problems getting recent version of the old madwifi codebase and wpa_supplicant programs to work together (kernel panic!), it's been a tough time recently for Atheros chipset holders.

However - good news. I've finally managed to get all the new parts working, and hence I'm writing this guide for all those who want to know how.

Changelog

1.0 Inital Version

1.1 Update to the guide (put in more information about the portage overlay and what you need to build into the kernel). Also, general cleanup to the layout and added more structure.

1.2 Further Update for Madwifi Drivers and Tools to 20051208 (1350 trunk) and pointer to new directory strucutre (snapshot site has modified the layout slightly)

1.2.1 Update to madwifi-tools ebuild

1.2.2 Update to fix the last update  :Smile: 

The Guide

Version

The following list are the versions of the programs I am running. The installation steps are below, however this is a reference to what I have installed and what I have working together.

```
* sys-kernel/gentoo-sources

     Installed:           2.6.14-r2

* net-wireless/wireless-tools

     Installed:           28_pre10

* net-wireless/madwifi-driver

     Installed:           0.1_pre20051208

* net-wireless/madwifi-tools

     Installed:           0.1_pre20051208

* net-wireless/wpa_supplicant

     Installed:           0.4.7-r1
```

The Kernel

If you have not yet already done so, you will need to configure and make a kernel ready with Wireless Extensions enabled. Without this the ebuilds will probably fail and none of the programs will install.

I'm using the latest stable gentoo-sources release - 2.6.14-gentoo-r2. To install just run emerge and then make menuconfig:

```
# USE="symlink" emerge =sys-kernel/gentoo-sources-2.6.14-r2

# cd /usr/src/linux

# make menuconfig
```

You will need to make sure that the 'Device Drivers --> Network device support --> Wireless LAN (non-hamradio) --> Wireless LAN drivers (non-hamradio) & Wireless Extensions' is enabled (you shouldn't need anything else under 'Device Drivers --> Network device support --> Wireless LAN (non-hamradio) --> ' enabled) and disable 'Networking --> Generic IEEE 802.11 Networking Stack' (I don't have it enabled and all works fine).

As another side point. I've not seen it confirmed anywhere, but I have had problems when I have been using 'Preemptible Kernel (Low-Latency Desktop)' enabled under 'Processor type and features'. It seams to be causing a problem in one of the locks (I think) and therefore it must be set to either 'Voluntary Kernel Preemption (Desktop)' or 'No Forced Preemption (Server)' for the driver to work correctly

Now install the kernel (and edit your grub/lilo conf file):

```
# make && make modules_install

# mount /boot

# cp arch/i386/boot/bzImage /boot/kernel-<version>

# cp System.map /boot/System.map-<version>

# cp .config /boot/config-<version>
```

where <version> is the version of the kernel your using (i.e. 2.6.14-gentoo-r2).

Wireless Tools

With a ready kernel, you can go stright ahead and install net-wireless/wireless-tools. We don't actually need to edit or adjust anything with this pacakge, so it can be installed as-is:

```
# emerge wireless-tools
```

.

Edit the ebuilds

The next steps, and the most important, are to edit the ebuilds so that we can install the correct packages or to enable correct options.

To prevent them being over-written by the next sync, we'll install them into the portage overlay directory (i.e. a separate directory where we can install custom-made or test ebuilds without portage deleting them each sync).

Before we create the overlay, we need to tell portage we are going to use one and tell it where it's going to be located. This is done in the make.conf file, using the PORTDIR_OVERLAY variable. Simple edit make.conf and add the following line:

```
PORTDIR_OVERLAY="/usr/local/portage"
```

If you don't set it up, or set it up incorrectly, you'll get the following error when you try and run a digest:

```
# ebuild madwifi-tools-0.1_pre20051208.ebuild digest

!!! aux_get(): ebuild path for 'net-wireless/madwifi-tools-0.1_pre20051208' not specified:

!!!            None

!!! aux_get(): ebuild path for 'net-wireless/madwifi-tools-0.1_pre20051208' not specified:

!!!            None 
```

With the location set, you can create the directories and the files needed to complete the install.

If you haven't created the directories for the various tools yet, run the following command. This will create the net-wireless group directory and a directory for each of programs:

```
# mkdir -p /usr/local/portage/net-wireless/{madwifi-tools,madwifi-driver,wpa_supplicant}
```

Madwifi

Before we can edit the ebuilds, we'll copy them over and rename them. They need to be renameed, both to separate them out of the versions in the normal portage tree, and to pick up the correct file from the snapstop list (the date part of the ebuild, e.g. 20051130, is used to select the correct file from madifi):

```
# cd /usr/local/portage/net-wireless

# cp /usr/portage/net-wireless/madwifi-tools/madwifi-tools-0.1_pre20051111.ebuild /

     madwifi-tools/madwifi-tools-0.1_pre20051208.ebuild

# cp /usr/portage/net-wireless/madwifi-driver/madwifi-driver-0.1_pre20051111.ebuild /

     madwifi-driver/madwifi-driver-0.1_pre20051208.ebuild
```

However, as the files in the snapshot directory are also named based on the trunk number (i.e. the revision number of the subversion tree), we need to update a variable inside each of the two ebuilds. The varible is the same in both of them, and needs to be changed to the same value for each of them as well.

Edit both madwifi-tools/madwifi-tools-0.1_pre20051208.ebuild and madwifi-driver/madwifi-driver-0.1_pre20051208.ebuild and replace the top line with the following value:

```
MADWIFI_SVN_REV="1350"
```

** Update: The madwifi-ng snapstop site (http://snapshots.madwifi.org/) has changes it site structure. The older ebuild will no longer work (you'll probably get 404 errors). In order for them to work again, we need to change the URL used to fetch the file and the Source Directory command. This is done with the SRC_URI and S variables. A few lines under the one you have just editing, you should see lines like:

```
SRC_URI="http://snapshots.madwifi.org/madwifi-trunk-r${MADWIFI_SVN_REV}-${PV:7:8}.tar.gz"

S=${WORKDIR}/madwifi-trunk-r${MADWIFI_SVN_REV}-${PV:7:8}
```

change these to, for the madwifi-driver-0.1_pre20051208.ebuild:

```
SRC_URI="http://snapshots.madwifi.org/madwifi-ng/madwifi-ng-r${MADWIFI_SVN_REV}-${PV:7:8}.tar.gz"

S=${WORKDIR}/madwifi-ng-r${MADWIFI_SVN_REV}-${PV:7:8}
```

change these to, for madwifi-tools-0.1_pre20051208.ebuild:

```
SRC_URI="http://snapshots.madwifi.org/madwifi-ng/madwifi-ng-r${MADWIFI_SVN_REV}-${PV:7:8}.tar.gz"

S=${WORKDIR}/madwifi-ng-r${MADWIFI_SVN_REV}-${PV:7:8}/tools
```

With the files edited we need to build the digest so portage can emerge the programs. Without the digest (extra files which include the MD5 sums of all the files and the manifest) portage will refuse to install them (as it can't verify that the files are correct). To create the digests, run:

```
# cd madwifi-tools

# ebuild madwifi-tools-0.1_pre20051208.ebuild digest

# cd ../madwifi-driver

# ebuild madwifi-driver-0.1_pre20051208.ebuild digest

# cd ..
```

wpa_supplicant

With wpa_supplicant we also need to edit the ebuild. However, the changes are different. With all the recent versions of wpa_supplicant, the ebuild maintainers have completly removed all support for madwifi from them. The madwifi driver isn't build by default and the USE flag to build it has been removed too. To make the corrections, you'll need to copy the file so we can edit it:

```
# cp /usr/portage/net-wireless/wpa_supplicant/wpa_supplicant-0.4.7.ebuild /

     wpa_supplicant/wpa_supplicant-0.4.7-r1.ebuild
```

The change consists of two new lines; first is the actual line that builds the wpa_supplicant driver for madwifi. At around line 70 there are series of statements with CONFIG_DRIVER_XYZ. Here, we need to add the statement:

```
echo "CONFIG_DRIVER_MADWIFI=y" >> ${CONFIG}
```

which will pass the build instruction to the compilation.

Second, we need to modify the CFLAGS variable. The location of the headers from the new madwifi builds are different that the older ones, and although the wpa_supplicant build can compile the new driver in, it's not looking in the new directory. It still assumes the files are in /usr/include when they're now in /usr/include/madwifi. This can be done by adding the following line at the top (i.e. ~line 3) of the ebuild:

```
CFLAGS="$CFLAGS -I/usr/include/madwifi"
```

If you wish, you can use the following patch to complete the change automatically

```
--- wpa_supplicant-0.4.7.ebuild 2005-12-02 22:11:18.000000000 +0000

+++ wpa_supplicant-0.4.7-r1.ebuild      2005-12-02 22:12:05.000000000 +0000

@@ -4,6 +4,8 @@

 inherit eutils toolchain-funcs

+CFLAGS="$CFLAGS -I/usr/include/madwifi"

+

 MY_P=${PN}-${PV/_/-}

 S=${WORKDIR}/${MY_P}

@@ -69,6 +71,7 @@

        echo "CONFIG_DRIVER_ATMEL=y"       >> ${CONFIG}

        echo "CONFIG_DRIVER_HOSTAP=y"      >> ${CONFIG}

        echo "CONFIG_DRIVER_IPW=y"         >> ${CONFIG}

+       echo "CONFIG_DRIVER_MADWIFI=y"     >> ${CONFIG}

        echo "CONFIG_DRIVER_NDISWRAPPER=y" >> ${CONFIG}

        echo "CONFIG_DRIVER_PRISM54=y"     >> ${CONFIG}

        echo "CONFIG_DRIVER_WEXT=y"        >> ${CONFIG}
```

by running:

```
# cd wpa_supplicant

# patch -p0 -i /path/to/patch-file

# cd ..
```

With the file updated, we can run the digest for it as well:

```
# ebuild wpa_supplicant-0.4.7-r1.ebuild digest
```

Install

All the updates are done - we can install the programs (in this order):

```
# ACCEPT_KEYWORDS=~x86 emerge madwifi-driver madwifi-tools wpa_supplicant
```

Configuration

There is a message at the end of both madwifi-driver and madwifi-tools (I think) which informs you that you need to change the way the startup script works. ath0 no longer exists. In fact you can in theory create many more ath? interfaces by using the one, new, base interface - wifi0 (although you can't use wifi0 as a substitue for ath0 - you must create ath0 from it. To get ath0 running (and therefore establish a connection), you need to run wlanconfig to create the device.

So, add (or update to) the following content in your /etc/conf.d/net file:

```
preup() {

        if [ "${IFACE}" == "ath0" ]; then

                /sbin/wlanconfig ath0 create wlandev wifi0 wlanmode sta > /dev/null

                return $?

        fi

        if mii-tool ${IFACE} 2> /dev/null | grep -q 'no link'; then

                ewarn "No link on ${IFACE}, aborting configuration"

                return 1

        fi

        return 0

}

predown() {

        if [ "${IFACE}" == "ath0" ]; then

                killall wpa_supplicant

                /sbin/wlanconfig ath0 destroy

                return $?

        fi

        return 0

}
```

Also, make sure that you have set the ath_pci module to load on each boot. Edit the /etc/modules.autoload.d/kernel-2.6 file and just add ath_pci to the list.

Finished

Touch wood, after you reboot, you should have a working wireless connection using madwifi and wpa_supplicant.

```
# dmesg

  <snip>

ath_hal: module license 'Proprietary' taints kernel.

ath_hal: 0.9.16.3 (AR5210, AR5211, AR5212, RF5111, RF5112, RF2413, RF5413, DFS)

wlan: 0.8.4.2 (Atheros/multi-bss)

ath_rate_onoe: 1.0

ath_pci: 0.9.4.5 (Atheros/multi-bss)

PCI: Enabling device 0000:07:00.0 (0000 -> 0002)

ACPI: PCI Interrupt 0000:07:00.0[A] -> Link [LNKG] -> GSI 9 (level, low) -> IRQ 9

wifi0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps

wifi0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps

wifi0: turboG rates: 6Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps

wifi0: H/W encryption support: WEP AES AES_CCM TKIP

wifi0: mac 7.9 phy 4.5 radio 5.6

wifi0: Use hw queue 1 for WME_AC_BE traffic

wifi0: Use hw queue 0 for WME_AC_BK traffic

wifi0: Use hw queue 2 for WME_AC_VI traffic

wifi0: Use hw queue 3 for WME_AC_VO traffic

wifi0: Use hw queue 8 for CAB traffic

wifi0: Use hw queue 9 for beacons

wifi0: Atheros 5212: mem=0x26000000, irq=9

# iwconfig

eth0      no wireless extensions.

lo        no wireless extensions.

wifi0     no wireless extensions.

ath0      IEEE 802.11g  ESSID:"A*****"

          Mode:Managed  Frequency:2.437 GHz  Access Point: 00:11:50:26:3E:F1

          Bit Rate:48 Mb/s   Tx-Power:18 dBm   Sensitivity=0/3

          Retry:off   RTS thr:off   Fragment thr:off

          Encryption key:8BD0-****-****-****-****-****-****-703C   Security mode:restricted

          Power Management:off

          Link Quality=39/94  Signal level=-56 dBm  Noise level=-95 dBm

          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

# wpa_supplicant

wpa_supplicant v0.4.7

Copyright (c) 2003-2005, Jouni Malinen <jkmaline@cc.hut.fi> and contributors

  <snip>

drivers:

  hostap = Host AP driver (Intersil Prism2/2.5/3)

  prism54 = Prism54.org driver (Intersil Prism GT/Duette/Indigo)

  madwifi = MADWIFI 802.11 support (Atheros, etc.)

  atmel = ATMEL AT76C5XXx (USB, PCMCIA)

  wext = Linux wireless extensions (generic)

  ndiswrapper = Linux ndiswrapper

  ipw = Intel ipw2100/2200 driver

  wired = wpa_supplicant wired Ethernet driver

example:

  wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf

  

# ifconfig

ath0      Link encap:Ethernet  HWaddr 00:0F:CB:B0:29:5C

          inet addr:10.0.1.11  Bcast:10.255.255.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:14308 errors:0 dropped:0 overruns:0 frame:0

          TX packets:9265 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:13953943 (13.3 Mb)  TX bytes:1084050 (1.0 Mb)

lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

wifi0     Link encap:Ethernet  HWaddr 00:0F:CB:B0:29:5C

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:499992 errors:0 dropped:0 overruns:0 frame:6588

          TX packets:11969 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:199

          RX bytes:66829145 (63.7 Mb)  TX bytes:1637138 (1.5 Mb)

          Interrupt:9 Memory:d0960000-d0970000
```

Notes

At the moment there is no way for the script to destroy the ath0 interface should the script fail to start propertly. This means that should you try and start net.ath0 again ath0 will exist and wlanconfig will fail, usually with the following message:

```
wlanconfig: ioctl: Invalid argument
```

.

You will therefore need to run the following command to remove the ath0 interface so that the net.ath0 script can re-create it!

```
# wlanconfig ath0 destroy
```

----------

## UberLord

Don't work on amd64 though

----------

## djnauk

 *UberLord wrote:*   

> Don't work on amd64 though

 

Fair enough - I can only claim for what I have it working on (P4-M with 3Com XJACK), and this is the first time I have had all three parts working together in their 'updated' versions. Just thought it would be useful for anyone in a similar situation.

----------

## UberLord

Hey - np.

A few devs have it working on x86, but a few like myself only have madwifi + amd64 and we're bitching about it not working   :Evil or Very Mad: 

----------

## djnauk

 *UberLord wrote:*   

> Hey - np.
> 
> A few devs have it working on x86, but a few like myself only have madwifi + amd64 and we're bitching about it not working  

 

Out of interest - what's the problem?

----------

## UberLord

As soon as there's network traffic across the freshly created ath0 interface the kernel goes OOPS - segfault. Apparently upstream are aware of the problem - and have been for some time.

So, I've got an rt2500 card - but that driver is waaaay too new, but it least it works with WEP - heh.

----------

## cajzell

Thanks for your initiative!!

Hmm, I would like to try this and I follow your guide, but I get:

```
vaio madwifi-tools # ebuild madwifi-tools-0.1_pre20051130.ebuild digest 

!!! aux_get(): ebuild path for 'net-wireless/madwifi-tools-0.1_pre20051130' not specified:

!!!            None

!!! aux_get(): ebuild path for 'net-wireless/madwifi-tools-0.1_pre20051130' not specified:

!!!            None

```

[One typo in OP, "loca' should be 'local']

----------

## djnauk

 *cajzell wrote:*   

> Thanks for your initiative!!
> 
> Hmm, I would like to try this and I follow your guide, but I get:
> 
> ```
> ...

 

Thanks - I'll correct the typo in a minute. From the looks of the ebuild you haven't put it into the correct directory. Under /usr/local/portage it needs to be the same as /usr/portage. First, a directory for the group (here, net-wireless) then a directory for the program (madwifi-tools) and then all the ebuilds and it's associated files. You should have a directory structure that looks something like this when you're done:

```
# cd /usr/local/portage

# find | grep ebuild

./net-wireless/madwifi-driver/madwifi-driver-0.1_pre20051130.ebuild

./net-wireless/madwifi-tools/madwifi-tools-0.1_pre20051130.ebuild

./net-wireless/wpa_supplicant/wpa_supplicant-0.4.7-r1.ebuild
```

----------

## b8zs

Thanks for looking into this!

But, unfortunatly I am having the same ebuild problems as cajzell. 

I am new to using ebuilds so its probably someting mundane, although I did follow your guide to the T.

My directory structure looks excaclly like yours. Is there supposed to be other files in: 

/usr/local/portage/net-wireless/madwifi-driver/

/usr/local/portage/net-wireless/madwifi-tools/

/usr/local/portage/net-wireless/wpa_supplicant/

besides the 3 ebuilds?

Thanks

----------

## djnauk

 *b8zs wrote:*   

> Thanks for looking into this!
> 
> But, unfortunatly I am having the same ebuild problems as cajzell. 
> 
> I am new to using ebuilds so its probably someting mundane, although I did follow your guide to the T.
> ...

 

Yes, there should be more, however all the 'extra' files are those produced by the digest. Looking at all the files I have (at least under the net-wireless section - I do have alot more under the overlay):

```
# cd /usr/local/portage

# find

./net-wireless

./net-wireless/madwifi-driver

./net-wireless/madwifi-driver/files

./net-wireless/madwifi-driver/files/digest-madwifi-driver-0.1_pre20051130

./net-wireless/madwifi-driver/Manifest

./net-wireless/madwifi-driver/madwifi-driver-0.1_pre20051130.ebuild

./net-wireless/madwifi-tools

./net-wireless/madwifi-tools/madwifi-tools-0.1_pre20051130.ebuild

./net-wireless/madwifi-tools/files

./net-wireless/madwifi-tools/files/digest-madwifi-tools-0.1_pre20051130

./net-wireless/madwifi-tools/Manifest

./net-wireless/wpa_supplicant

./net-wireless/wpa_supplicant/wpa_supplicant-0.4.7-r1.ebuild

./net-wireless/wpa_supplicant/files

./net-wireless/wpa_supplicant/files/digest-wpa_supplicant-0.4.7-r1

./net-wireless/wpa_supplicant/Manifest
```

Do you both have the PORTAGE_OVERLAY value set in make.conf? I'm not sure if it's enabled and set to /usr/local/portage by default, but I do have it set:

```
PORTDIR_OVERLAY="/usr/local/portage"
```

I think I'll make some updates to the guide putting in some more detail about the options and requirements.

----------

## b8zs

Ooooh, that was it: I didnt have the portage overlay directory set in my make.conf

Thanks  :Very Happy: 

----------

## djnauk

 *b8zs wrote:*   

> Ooooh, that was it: I didnt have the portage overlay directory set in my make.conf
> 
> Thanks 

 

No problem - my bad really for assuming that it is a default setting - I know better now!  :Smile: 

----------

## cajzell

So, how did you guys get your "/etc/init.d/net.ath0" 's? I don't have wlanconfig.

----------

## djnauk

 *cajzell wrote:*   

> So, how did you guys get your "/etc/init.d/net.ath0" 's? I don't have wlanconfig.

 

wlanconfig is part of the new madwifi-tools package - if you don't have that then you haven't installed it correctly:

```
# equery belongs $(which wlanconfig)

[ Searching for file(s) /sbin/wlanconfig in *... ]

net-wireless/madwifi-tools-0.1_pre20051130 (/sbin/wlanconfig)
```

----------

## cajzell

Hello again,

the trouble I had with wlanconfig was resolved by doing the 

```
ebuild /usr/local/portage/net-wireless/madwifi-tools/madwifi-tools-0.1_pre20051130.ebuild unpack [compile/install/qmerge]

```

procedure. So, now that is all well. But, then I try,

```

vaio ~ # modprobe ath_pci

WARNING: Error inserting ath_rate_sample (/lib/modules/2.6.12-gentoo-r4h/net/ath_rate_sample.ko): Invalid module format
```

checking dmesg I get

```
vaio ~ # dmesg 

....

....

ath_rate_sample: version magic '2.6.12-gentoo-r4h preempt PENTIUM4 gcc-3.4' should be '2.6.12-gentoo-r4h preempt PENTIUM4 gcc-3.3'
```

Maybe that's because gcc is upgraded since my last kernel build, is there any way to temporarily get around this without rebuilding the kernel?

----------

## djnauk

 *cajzell wrote:*   

> Maybe that's because gcc is upgraded since my last kernel build, is there any way to temporarily get around this without rebuilding the kernel?

 

You can run gcc-config as root to manage which gcc you use:

```
root on laptop [ ~ ] --> gcc-config -l

[1] i686-pc-linux-gnu-3.3.6

[2] i686-pc-linux-gnu-3.3.6-hardened

[3] i686-pc-linux-gnu-3.3.6-hardenednopie

[4] i686-pc-linux-gnu-3.3.6-hardenednopiessp

[5] i686-pc-linux-gnu-3.3.6-hardenednossp

[6] i686-pc-linux-gnu-3.4.4 *

[7] i686-pc-linux-gnu-3.4.4-hardened

[8] i686-pc-linux-gnu-3.4.4-hardenednopie

[9] i686-pc-linux-gnu-3.4.4-hardenednopiessp

[10] i686-pc-linux-gnu-3.4.4-hardenednossp

root on laptop [ ~ ] --> gcc-config 6

 * Switching to i686-pc-linux-gnu-3.4.4 compiler ...                      [ ok ]

root on laptop [ ~ ] -->
```

----------

## cajzell

OK, now my earlier problems seem removed, but another one has shown up.

```
vaio init.d #  /sbin/wlanconfig ath0 create wlandev wifi0 wlanmode sta

wlanconfig: ioctl: Invalid argument
```

I searched for this on the forums, but got no hits. Anyone have a clue?

Or maybe a hint where to look further?

----------

## djnauk

 *cajzell wrote:*   

> OK, now my earlier problems seem removed, but another one has shown up.
> 
> ```
> vaio init.d #  /sbin/wlanconfig ath0 create wlandev wifi0 wlanmode sta
> 
> ...

 

More than likly it's already been created. The command assumes that there is no ath0. I need to look into a way of detecting whether ath0 has been created and destroy if it is has. Basically, atm, if ath0 failes to start properley, ath0 isn't destroyed. So, when you come to re-start it, the preup then fails as ath0 has been started.

Just run:

```
# wlanconfig ath0 destroy
```

and you should be able to run net.ath0 start again.

----------

## cajzell

Thanks again,

you're right, I hve to destroy it every time I recheck.

It seems we are getting closer and closer, now the wpa_supplicant times out. I got it to connect when disabling the WEP authentication, but when I enable it on the AP, the wpa_supplicant times out. So, my question is, unsing another machine, I have the configuration:

```

key_bongofury="12345678901234567890240123456 enc restricted"

config_bongofury=( "dhcp" )

preferred_aps=( "bongofury" "ESSID 2" )
```

And I have my wpa_supplicant.conf

```
network={

        ssid="bongofury"

        key_mgmt=NONE

#        psk=""

        wep_key1=12345678901234567890240123456

        priority=5

        auth_alg=SHARED

        }

```

I've tried with/without auth_alg=SHARED. How should I get the corresponding authentication with wpa_supplicant?

----------

## djnauk

I did notice that it takes alot longer to create the WPA tunnel with this new system compared to the old one (~5s verses ~25s now). I had to up the timeout from 10 to 60 seconds to get it to work.

This is my wpa_supplicant.conf

```
ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=wheel

ap_scan=1

fast_reauth=1

network={

        ssid="Avalon"

        scan_ssid=1

        proto=WPA

        key_mgmt=WPA-PSK

        psk="thisisnottherealkey!"

        priority=1

        pairwise=CCMP TKIP

        group=CCMP TKIP

}
```

----------

## Pandor

Great work m8.

I'm pretty new to gentoo and after reading some horror stories about wpa_supplicant/madwifi from portage i decided to compile them from source myself and figure out later how to add them to my local portage (got it up and running in under 30 min BTW.).

So you saved my quite some time figuring it out on my own, thx!

----------

## djnauk

Good news - thanks.

----------

## djnauk

I've updated the guide to 1.1 now.

----------

## Pandor

 *djnauk wrote:*   

> ...
> 
> If you haven't created the directories for the various tools yet, run the following command. This will create the net-wireless group directory and a directory for each of programs:
> 
> ```
> ...

 

I believe you're missing the 'net-wireless' in your path here...   :Wink: 

Also noticed this:

 *djnauk wrote:*   

> 
> 
> Second, we need to modify the CFLAGS variable. The location of the headers from the new madwifi builds are different that the older ones, and although the wpa_supplicant build can compile the new driver in, it's not looking in the new directory. It still assumes the files are in /usr/include when they're now in /usr/include/madwifi. This can be done by adding the following line at the top (i.e. ~line 3) of the ebuild:
> 
> ```
> ...

 

You say the headers are now located in /usr/include/madwifi but you seem to pass "$CFLAGS -I/usr/local/madwifi".

typo? or am i missing something...

And something else i found:

I remember setting the path to opensll when i compiled wpa_supplicant by hand, but this seems to be missing from the ebuild.

from the wpa_supplicant defconfig file:

 *Quote:*   

> # Uncomment following two lines and fix the paths if you have installed openssl
> 
> # in non-default location
> 
> #CFLAGS += -I/usr/local/openssl/include
> ...

 

this is what it should be (afaik):

```
# Uncomment following two lines and fix the paths if you have installed openssl

# in non-default location

CFLAGS += -I/usr/include/openssl

LIBS += -L/usr/lib
```

from the wpa_supplicant README:

 *Quote:*   

> Optional libraries for EAP-TLS, EAP-PEAP, and EAP-TTLS:
> 
> - openssl (tested with 0.9.7c and 0.9.7d, assumed to work with most
> 
>   relatively recent versions; this is likely to be available with most
> ...

 

from the ebuild:

```
        if use ssl; then

                # SSL authentication methods

                echo "CONFIG_EAP_LEAP=y"     >> ${CONFIG}

                echo "CONFIG_EAP_MSCHAPV2=y" >> ${CONFIG}

                echo "CONFIG_EAP_PEAP=y"     >> ${CONFIG}

                echo "CONFIG_EAP_TLS=y"      >> ${CONFIG}

                echo "CONFIG_EAP_TTLS=y"     >> ${CONFIG}

                echo "CONFIG_SMARTCARD=y"    >> ${CONFIG}
```

Maybe we should file a bugreport?

afaik when the ssl flag is used, it should set the openssl paths, because the defaults (see defconfig above) is not correct.

----------

## ianwilder

wonderful guide. thanks!

i'm completely new to this wireless thing, and i've found everything in your guide to work wonderfully, except when i try and run this part:

```
/sbin/wlanconfig ath0 create wlandev wifi0 wlanmode sta
```

i get this:

```
wlanconfig: ioctl: No such device
```

any ideas?

iwconfig gives me the right thing, and ath_pci is loaded....

i'm using the madwifi-driver-cvs ebuild, since the pre20051130 one doesn't compile for gcc 4.1. i then thought, well since my iwconfig says ath0, maybe they changed things and now they _do_ use ath0. so i removed all the conf.d/net stuff and tried starting init.d/net.ath0. this time my card started blinking on the network icon but i got this after a little bit:

```
 *   Couldn't associate with any access points on ath0

 *   Failed to configure wireless for ath0                                [ !! ]
```

----------

## Pandor

 *ianwilder wrote:*   

> ...
> 
> i'm using the madwifi-driver-cvs ebuild, since the pre20051130 one doesn't compile for gcc 4.1. i then thought, well since my iwconfig says ath0, maybe they changed things and now they _do_ use ath0.
> 
> ...

 

It looks to me like you got the old madwifi code, wich used ath0. the 'new code' is called madwifi-ng, wich is used here.

With the new code (madwifi-ng), you have to manually create ath0.

----------

## djnauk

 *Pandor wrote:*   

>  *djnauk wrote:*   
> 
> ```
> # mkdir -p /usr/local/portage/{madwifi-tools,madwifi-driver,wpa_supplicant}
> ```
> ...

 

Fixed  :Smile:  It was too late to do this last night!  :Smile: 

 *Pandor wrote:*   

> Also noticed this:
> 
>  *djnauk wrote:*   
> 
> ```
> ...

 

Yep - typo.  :Smile: 

 *Pandor wrote:*   

> And something else i found:
> 
> I remember setting the path to opensll when i compiled wpa_supplicant by hand, but this seems to be missing from the ebuild.
> 
> (snip)
> ...

 

I must admit, I haven't been using the SSL libaries associated with it. I'm just using the wpa_suppliant to enable a WPA-PSK tunnel. Have you checked to see if a bug report exists?

----------

## djnauk

 *ianwilder wrote:*   

> i'm using the madwifi-driver-cvs ebuild, since the pre20051130 one doesn't compile for gcc 4.1.

 

As Pandor said, the older version of the madiwifi code (i.e. madwifi, not madwifi-ng) still create the single ath0 interface automatically. The newer versions (which isn't actually try, it more-or-less a re-write by the company that makes the Atheros chips) do the same, but with a base interface - wifi0. From there, and using wlanconfig,  you can create multiple interfaces (called ath? if you want) from which you can do different things (say us one to connect to a network and use another to create an ah-hoc AP for others to connect to).

If you're using the older CVS build (the newer project runs on SVN) then you don't need to worry about wlanconfig.

----------

## Pandor

 *djnauk wrote:*   

> ...
> 
> I must admit, I haven't been using the SSL libaries associated with it. I'm just using the wpa_suppliant to enable a WPA-PSK tunnel. Have you checked to see if a bug report exists?

 

Did i quick rundown on https://bugs.gentoo.org and didn't find a related report.

Could've overlooked it but it looks like it's not reported yet.

----------

## djnauk

Actually, looking back, I don't think it is an issue. IIRC, Gentoo installed OpenSSL into the default location, and the 'variables' are only used when it isn't. If it compiles correctly and doesn't have a problem then there's no need for a big report.

They could be installing test-versions of the library into another location (i.e. /usr/local/include) and hence these are just for their testing...

----------

## Pandor

I see, thx for clearing that out.   :Wink: 

----------

## Pandor

 *djnauk wrote:*   

> ...
> 
> Also, make sure that you have set the ath_pci module to load on each boot. Edit the /etc/modules.autoload/kernel-2.6 file and just add ath_pci to the list.
> 
> Finished
> ...

 

Should be /etc/modules.autoload.d/kernel-2.6  :Razz: 

Yeah, i'm on a typo hunt   :Twisted Evil: 

----------

## djnauk

 *Pandor wrote:*   

> Should be /etc/modules.autoload.d/kernel-2.6 
> 
> Yeah, i'm on a typo hunt  

 

That's fine!  :Smile:  I'd rather someone said something.

Thanks again.

----------

## Pandor

djnauk, could you give me an insight on how the net script works?

i've added those lines to the /etc/conf.d/net script but it doesn't do anything.

I still have to create ath0 manually and run wpa_supplicant and then dhcpcd.

----------

## djnauk

 *Pandor wrote:*   

> djnauk, could you give me an insight on how the net script works?
> 
> i've added those lines to the /etc/conf.d/net script but it doesn't do anything.
> 
> I still have to create ath0 manually and run wpa_supplicant and then dhcpcd.

 

/etc/conf.d/net simple defines the configuration for the various /etc/init.d/net.* scripts. If it detects you have a preup and predown function set it'll try to use them. Can you give me your /etc/conf.d/net script please?

----------

## Pandor

yeah, just figured i had to create the net.ath0 symlink (and that's where it gets the $IFACE from, right?).

I'm pretty new to the way networking is handeled under gentoo.

When i compiled mad/wpa by hand i always set it up manually, but that get's pretty tiresome   :Very Happy: 

so now i can do net.ath0 start but then i get a message that it can't connect.

So i guess i have to configure the net script to use wpa_supplicant, and maybe dhcp on the ath0 device, right?

btw, have you tried wpa_gui yet?

I can get it to do anything except save my configured ap's to wpa_supplicant.conf, wich should be possible, no?

*edit:

Nevermind my last question, i should read the changelogs more often   :Rolling Eyes: 

 *Quote:*   

> added support for updating configuration ('wpa_cli save_config');
> 
> 	  this is disabled by default and can be enabled with global
> 
> 	  update_config=1 variable in wpa_supplicant.conf; this allows wpa_cli
> ...

 

----------

## djnauk

 *Pandor wrote:*   

> yeah, just figured i had to create the net.ath0 symlink (and that's where it gets the $IFACE from, right?).

 

Yet - when each 'script' runs through the net script to get it's settings, $IFACE is populated with the name of the interface (in this case we're after ath0)

 *Pandor wrote:*   

> I'm pretty new to the way networking is handeled under gentoo.
> 
> When i compiled mad/wpa by hand i always set it up manually, but that get's pretty tiresome  

 

It is a lot harder to understand compared with the original system (which is more similar to the sysconfig stuff of Redhat and the like), but that's it's advantage - it's must easier and quicker to build complex networking systems, including tunnels, bridges and gateways using one file. Now that I understand it a bit better, it is the better option!

 *Pandor wrote:*   

> so now i can do net.ath0 start but then i get a message that it can't connect.
> 
> So i guess i have to configure the net script to use wpa_supplicant, and maybe dhcp on the ath0 device, right?

 

I'm assuming you know how to setup wpa_supplicant.conf  :Wink:  so I'll just include my verison of the /etc/conf.d/net file from my laptop (with comments):

```
# this is the wired network stuff and it not set to connect automatically

# isn't installed into a runlevel, but it is setup with a fallback, so if there is a 

# problem with the dhcp server, I can still connect to the network

config_eth0=( "dhcp" )

fallback_eth0=( "10.0.1.11 netmask 255.255.255.0" )

fallback_route_eth0=( "default via 10.0.1.1" )

# I've had some problems with dhcp and madwifi (i.e. crashing the whole system

# when you stop the connection or kill dhcpcd), so I'm tyring udhcpc

modules_ath0=( "udhcpc" )

# Use dhcp by default for the connection and wpa_supplicant to connect

config_ath0=( "dhcp" )

modules=( "wpa_supplicant" )

# wpa_supplicant settings - first option to set options, usually what driver you want

# and second option for the timeout (it used to be 10s, but I've had to up it to 60s

# with the newer drivers - it seams to take around 25s to connect now!)

wpa_supplicant_ath0="-Dmadwifi"

wpa_timeout_ath0=60

# these are SSID-specific connections, so when I'm on the home network, use dhcp

# with a 10s timeout

config_A*****=( "dhcp" )

dhcpcd_A*****="-t 10"

# and these are the statements to create/destroy the interfaces

preup() {

        if [ "${IFACE}" == "ath0" ]; then

                /sbin/wlanconfig ath0 create wlandev wifi0 wlanmode sta > /dev/null

                return $?

        fi

        if mii-tool ${IFACE} 2> /dev/null | grep -q 'no link'; then

                ewarn "No link on ${IFACE}, aborting configuration"

                return 1

        fi

        return 0

}

predown() {

        if [ "${IFACE}" == "ath0" ]; then

                killall wpa_supplicant

                /sbin/wlanconfig ath0 destroy

                return $?

        fi

        return 0

}
```

 *Pandor wrote:*   

> btw, have you tried wpa_gui yet?
> 
> I can get it to do anything except save my configured ap's to wpa_supplicant.conf, wich should be possible, no?

 

Actually no - I don't have the QT flag set, so it's never installed. Although I generally only use it on my home network and hence only need to configure the one setting.

----------

## Pandor

Adding these lines did the trick:

config_ath0=( "dhcp" )

modules=( "wpa_supplicant" ) 

wpa_supplicant_ath0="-Dmadwifi"

wpa_timeout_ath0=60 

And i'm geting a better understanding of it all.

thx for all the help and advice.   :Wink: 

----------

## djnauk

No problem - It's nice to be able to help people once in a while on here  :Smile: 

----------

## bheinze

Great tutorial, thanks! However somehow I don't know what to do after. I don't want to connect to a wlan directly at startup. I created a link pointing to net.lo called net.ath0. I edited the file /etc/wpa_supplicant.conf and set ap_scan=0, also I deleted the example connections. In the file /etc/conf.d/net I inserted the lines above.

When I run /etc/init.d/net.ath0 start I get the messages:

Starting ath0

Running perupfunction

starting wpa_supplicant on ath0

ENGINE: ctrl cmd_string filed: LOAD (null) [error:25066067:DSO support routines :DLFCN_LOAD:couldn not load the shared library]

SSL:Failed to initialize TLS context.

Failed to initialize EAPOL state machines.

ifconfig doesn't show me the device ath0, and wpa_gui errors "Failed to open control connection to wpa_supplicant"

CAn anybody give me a hint, what I'm doing wrong?

----------

## wads

I have been struggling with WiFi since updating my system.  It works automatically without WEP.  However, if I want to use WEP, I have to use iwconfig commands from a shell.  (It does work, then, however.)  I have a thread about this:  https://forums.gentoo.org/viewtopic-p-2935329.htm

The last response suggested that I skip wep and try for WPA.  So I found this thread and am giving it a whirl.  I followed the instructions and everything lines up except that I am using a 2.6.6 kernel.  Still, the kernel options are the same.  The first couple of ebuilds emerged without a problem.  However, when I got to the MadWifi drivers, I got stuck:

```
driver_madwifi.c: In function `wpa_driver_madwifi_set_key':

driver_madwifi.c:250: error: `IEEE80211_KEY_GROUP' undeclared (first use in this function)

driver_madwifi.c:250: error: (Each undeclared identifier is reported only once

driver_madwifi.c:250: error: for each function it appears in.)driver_madwifi.c: In function `wpa_driver_madwifi_set_key':

driver_madwifi.c:250: error: `IEEE80211_KEY_GROUP' undeclared (first use in this function)

driver_madwifi.c:250: error: (Each undeclared identifier is reported only once

driver_madwifi.c:250: error: for each function it appears in.)

make: *** [driver_madwifi.o] Error 1

make: *** Waiting for unfinished jobs....

!!! ERROR: net-wireless/wpa_supplicant-0.4.7-r1 failed.

!!! Function src_compile, Line 81, Exitcode 2

!!! emake failed
```

Everything is in its appropriate directory.  I made the changes to the file that were demonstrated and the ebuilds were created without a hitch.  Anyone have an idea about how to address this error?

----------

## kristo77

I am new to gentoo and not (yet?) a portage expert but if I run

  # ACCEPT_KEYWORDS=~x86 emerge madwifi-driver madwifi-tools wpa_supplicant

an old madwifi-driver and -tools are installed.

On the other hand, the patched wpa_supplicant is build.

Anyway I had to follow the

  ebuild /usr/local/portage/net-wireless/madwifi-tools/madwifi-tools / driver-0.1_pre20051130.ebuild unpack [compile/install/qmerge] 

procedure to install the correct versions. 

How come?

----------

## daff

djnauk: Thanks for this HOWTO, compiling and installing the relevant parts worked just fine following it. 

However, I seem to be unable to connect to my WPA access point. wpa_supplicant scans and scans and scans but can't seem to find, less than connect to, the access point. Do you use WEP or WPA? It's WEP from the looks of it, did anybody have success with a WPA access point? Unfortunately there's no WEP or non-encrypted access point around here I could use for testing purposes.

I had to go back to wpa_supplicant 0.4.5, madwifi-driver 0.1_pre20050420-r1 and madwifi-tools 0.1_pre20050420 to be able to use my WPA AP. Sucks.

----------

## djnauk

 *bheinze wrote:*   

> Great tutorial, thanks!

 

Thanks - glad to try and help

 *bheinze wrote:*   

> ENGINE: ctrl cmd_string filed: LOAD (null) [error:25066067:DSO support routines :DLFCN_LOAD:couldn not load the shared library]
> 
> SSL:Failed to initialize TLS context.
> 
> Failed to initialize EAPOL state machines.

 

This looks like an issue in trying to dynamically load the SSL library (DLFNC_LOAD - i think is for Dynamic Link Function Load). Have you tried building wpa_supplicant without the SSL flags?

----------

## djnauk

 *kristo77 wrote:*   

> I am new to gentoo and not (yet?) a portage expert but if I run
> 
>   # ACCEPT_KEYWORDS=~x86 emerge madwifi-driver madwifi-tools wpa_supplicant
> 
> an old madwifi-driver and -tools are installed.
> ...

 

Have you definatley setup the PORTDIR_OVERLAY command?

----------

## djnauk

 *daff wrote:*   

> djnauk: Thanks for this HOWTO, compiling and installing the relevant parts worked just fine following it. 
> 
> However, I seem to be unable to connect to my WPA access point. wpa_supplicant scans and scans and scans but can't seem to find, less than connect to, the access point. Do you use WEP or WPA? It's WEP from the looks of it, did anybody have success with a WPA access point? Unfortunately there's no WEP or non-encrypted access point around here I could use for testing purposes.
> 
> I had to go back to wpa_supplicant 0.4.5, madwifi-driver 0.1_pre20050420-r1 and madwifi-tools 0.1_pre20050420 to be able to use my WPA AP. Sucks.

 

Yeah - I think the newer madwifi-ng code is not quite as efficient with WAP AP as the old one. As I've mentioned before, I've had to increase the timeout for wpa_supplicant in order for it to connect (was 10, is now 60). Hopefully they'll improve this in the near future.

(BTW, I use a WPA AP - a Belkin Pre-N Router, set as AP only and connected to an IPCop box which in turn acts as a router and provides security between the Wireless and Wired networks).

----------

## djnauk

I've just updated the guide to version 1.2 which covers an update for the tools and driver to the 1350 trunk (i.e. 20051208, or today's, build). Also, looking around I've just noticed that the madwifi.org snapstop directory (i.e. snapshots.madwifi.org) has changed, so I've updated the guide to cope with the new location/structure and the change in the filename.

Comments, suggestions (and bug fixes  :Wink: ) welcome  :Smile: 

----------

## djnauk

 *wads wrote:*   

> I have been struggling with WiFi since updating my system.  It works automatically without WEP.  However, if I want to use WEP, I have to use iwconfig commands from a shell.  (It does work, then, however.)  I have a thread about this:  https://forums.gentoo.org/viewtopic-p-2935329.htm
> 
> The last response suggested that I skip wep and try for WPA.  So I found this thread and am giving it a whirl.  I followed the instructions and everything lines up except that I am using a 2.6.6 kernel.  Still, the kernel options are the same.  The first couple of ebuilds emerged without a problem.  However, when I got to the MadWifi drivers, I got stuck:
> 
> ```
> ...

 

Can you double-check that you added the CFLAGS update to the top of the wpa_supplicant ebuild? That looks like there's a problem with working the the include files.

----------

## daff

 *djnauk wrote:*   

>  *daff wrote:*   djnauk: Thanks for this HOWTO, compiling and installing the relevant parts worked just fine following it. 
> 
> However, I seem to be unable to connect to my WPA access point. wpa_supplicant scans and scans and scans but can't seem to find, less than connect to, the access point. Do you use WEP or WPA? It's WEP from the looks of it, did anybody have success with a WPA access point? Unfortunately there's no WEP or non-encrypted access point around here I could use for testing purposes.
> 
> I had to go back to wpa_supplicant 0.4.5, madwifi-driver 0.1_pre20050420-r1 and madwifi-tools 0.1_pre20050420 to be able to use my WPA AP. Sucks. 
> ...

 

Hm that sounds bad. Where did you set the increased timeout? In /etc/conf.d/net or in /etc/wpa_supplicant.conf?

I've tested the whole procedure manually, i.e.

```

# modprobe ath_pci

# wlanconfig ath0 create wlandev wifi0 wlanmode sta

# sudo wpa_supplicant -Dmadwifi -dd -c /etc/wpa_supplicant.conf -i ath0

... waiting ... waiting ...

... nothing happens ...

CTRL-C

```

wpa_supplicant is unable to associate or apparently even find my WPA AP. Just keeps scanning and scanning and telling me that it was unable to find any suitable AP. I don't like this  :Sad: 

And I thought things were getting even better when some time ago I was able to use wpa_supplicant 0.4.6 together with madwifi-driver-0.1_pre20050809 from portage. But the next update of the ebuild just killed everything.

Bleh.

----------

## djnauk

 *daff wrote:*   

> Hm that sounds bad. Where did you set the increased timeout? In /etc/conf.d/net or in /etc/wpa_supplicant.conf?

 

/etc/conf.d/net - can't remember the variable name off the top of my head - it'll be in the example file though.

The madwifi project is in limbo - there are three different versions; madwifi (the old, existing project), madwifi (the re-write from Atheros to try and support their chips better) and madiwifi-ng (which is a combination of the two - using the re-write of the code from Atheros, but incorporating the extra features and speed avaiable within the original madwifi code).

 *daff wrote:*   

> wpa_supplicant is unable to associate or apparently even find my WPA AP. Just keeps scanning and scanning and telling me that it was unable to find any suitable AP. I don't like this 
> 
> And I thought things were getting even better when some time ago I was able to use wpa_supplicant 0.4.6 together with madwifi-driver-0.1_pre20050809 from portage. But the next update of the ebuild just killed everything.
> 
> Bleh.

 

I think it's a case of working for some and not for others. It seams to work fine with me, but alot of people are having problems. I've updated to the newest stuff last night, but I'm still getting the same problems (or at least, it still being slow).

----------

## kristo77

 *djnauk wrote:*   

>  *kristo77 wrote:*   I am new to gentoo and not (yet?) a portage expert but if I run
> 
>   # ACCEPT_KEYWORDS=~x86 emerge madwifi-driver madwifi-tools wpa_supplicant
> 
> an old madwifi-driver and -tools are installed.
> ...

 

Yeah sure.

Btw, what i said about the wpa_supplicant was wrong, it was also on old one.

I had to specify the path:

```
# emerge /usr/local/portage/net-wireless/wpa_supplicant/wpa_supplicant-0.4.7-r1-ebuild
```

It works though. 

But I wonder if it still will after an "emerge world"...

Cos if I 

```
#emerge --pretend wpa_supplicant
```

I get this contradictory output:

```
[ebuild  UD] net-wireless/wpa_supplicant-0.3.9-r1 [0.4.7-r1]
```

Upgrade? Downgrade? What shall it be? Furthermore, (un)commenting the PORTDIR_OVERLAY in /etc/make.conf does not seem to make any difference.

----------

## nichocouk

 *kristo77 wrote:*   

> I am new to gentoo and not (yet?) a portage expert but if I run
> 
>   # ACCEPT_KEYWORDS=~x86 emerge madwifi-driver madwifi-tools wpa_supplicant
> 
> 

 

That's no good. You have to put the following lines in your /etc/portage/package.keywords file (create it if it does not exist yet)

```

net-wireless/madwifi-tools ~x86

net-wireless/madwifi-driver ~x86

net-wireless/wpa_supplicant ~x86

```

This will ensure that emerge sync does not downgrade the installed version.

----------

## b8zs

Ok I have been trying to get this to work, and have had some difficulties. Everything is installed as described in the guide. Unfortunatly in upgrading my driver I can no longer see any open Access Points and to the extent that I've tested, connect to any WPA networks. It is worth mentioning that im on a PPC laptop. Here are some configs that might be useful in diagnosing my problem.

```

*  sys-kernel/gentoo-sources

      Latest version available: 2.6.14-r2

      Latest version installed: 2.6.14-r2

*  net-wireless/madwifi-driver

      Latest version available: 0.1_pre20051208

      Latest version installed: 0.1_pre20051208

*  net-wireless/madwifi-tools

      Latest version available: 0.1_pre20051208

      Latest version installed: 0.1_pre20051208

*  net-wireless/wpa_supplicant

      Latest version available: 0.4.7-r1

      Latest version installed: 0.4.7-r1

    

*  net-wireless/wireless-tools

      Latest version available: 28_pre10

      Latest version installed: 28_pre10

 
```

sword ~ #cat /etc/wpa_supplicant.conf

```

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

eapol_version=1

ap_scan=1

fast_reauth=1

#network={

#       ssid="home"

#       scan_ssid=1

#       proto=WPA

#       mode=0

#       key_mgmt=WPA-EAP

#       eap=PEAP

#       identity="login"

#       password="pass"

#       pairwise=TKIP

#       group=TKIP

#       phase1="peapver=0"

#       phase2="auth=MSCHAPV2"

#

#}

# WPA is disabled so I can test my cards ability to connect to open APs :/

network={

        key_mgmt=NONE

        priority=1

}

```

sword ~ #cat /etc/conf.d.net:

```

config_ath0=( "dhcp" )

modules=( "wpa_supplicant" )

wpa_supplicant_ath0="-Dmadwifi -dd"

wpa_timeout_ath0=300

```

sword ~ #lspci -v

```

0001:11:00.0 Ethernet controller: Atheros Communications, Inc. AR5212 802.11abg NIC (rev 01)

        Subsystem: Wistron NeWeb Corp.: Unknown device 2012

        Flags: bus master, medium devsel, latency 168, IRQ 58

        Memory at f3000000 (32-bit, non-prefetchable)

        Capabilities: [44] Power Management version 2

```

sword ~ #cardctl info:

```

PRODID_1="Atheros Communications, Inc."

PRODID_2="AR5001-0000-0000"

PRODID_3="Wireless LAN Reference Card"

PRODID_4="00"

MANFID=0271,0012

FUNCID=6

```

sword ~ # /sbin/wlanconfig ath0 create wlandev wifi0 wlanmode sta

```

ath0

```

sword ~ #iwconfig:

```

eth0      no wireless extensions.

lo        no wireless extensions.

dummy0    no wireless extensions.

wifi0     no wireless extensions.

ath0      IEEE 802.11b  ESSID:""

          Mode:Managed  Channel:0  Access Point: 00:00:00:00:00:00

          Bit Rate:0 kb/s   Tx-Power:20 dBm   Sensitivity=0/3

          Retry:off   RTS thr:off   Fragment thr:off

          Encryption key:off

          Power Management:off

          Link Quality=0/94  Signal level=-95 dBm  Noise level=-95 dBm

          Rx invalid nwid:174  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

```

sword ~ # wpa_supplicant -Dmadwifi -iath0 -c/etc/wpa_supplicant.conf -dd

```

Initializing interface 'ath0' conf '/etc/wpa_supplicant.conf' driver 'madwifi' ctrl_interface 'N/A'

Configuration file '/etc/wpa_supplicant.conf' -> '/etc/wpa_supplicant.conf'

Reading configuration file '/etc/wpa_supplicant.conf'

ctrl_interface='/var/run/wpa_supplicant'

ctrl_interface_group=0

eapol_version=1

ap_scan=1

fast_reauth=1

Line: 34 - start of a new network block

key_mgmt: 0x4

priority=1 (0x1)

Priority group 1

   id=0 ssid=''

Initializing interface (2) 'ath0'

EAPOL: SUPP_PAE entering state DISCONNECTED

EAPOL: KEY_RX entering state NO_KEY_RECEIVE

EAPOL: SUPP_BE entering state INITIALIZE

EAP: EAP entering state DISABLED

EAPOL: External notification - portEnabled=0

EAPOL: External notification - portValid=0

SIOCGIWRANGE: WE(compiled)=19 WE(source)=13 enc_capa=0x0

  capabilities: key_mgmt 0x0 enc 0x3

Own MAC address: 00:0b:6b:20:3a:7d

wpa_driver_madwifi_del_key: keyidx=0

wpa_driver_madwifi_del_key: keyidx=1

wpa_driver_madwifi_del_key: keyidx=2

wpa_driver_madwifi_del_key: keyidx=3

wpa_driver_madwifi_set_countermeasures: enabled=0

wpa_driver_madwifi_set_drop_unencrypted: enabled=1

Setting scan request: 0 sec 100000 usec

Added interface ath0

Wireless event: cmd=0x8b06 len=8

Ignore event for foreign ifindex 4

RTM_NEWLINK, IFLA_IFNAME: Interface 'ath0' added

RTM_NEWLINK, IFLA_IFNAME: Interface 'ath0' added

State: DISCONNECTED -> SCANNING

Starting AP scan (broadcast SSID)

Wireless event: cmd=0x8b1a len=8

Scan timeout - try to get results

Received 0 bytes of scan results (0 BSSes)

Scan results: 0

Selecting BSS from priority group 1

No suitable AP found.

Setting scan request: 5 sec 0 usec

Starting AP scan (broadcast SSID)

Wireless event: cmd=0x8b1a len=8

Scan timeout - try to get results

Received 0 bytes of scan results (0 BSSes)

Scan results: 0

Selecting BSS from priority group 1

No suitable AP found.

Setting scan request: 5 sec 0 usec

```

Im sitting right next to my AP so it should be getting a BSS from the ssid broadcasts. Anyone got any ideas?

----------

## wads

 *djnauk wrote:*   

>  *wads wrote:*   I have been struggling with WiFi since updating my system.  It works automatically without WEP.  However, if I want to use WEP, I have to use iwconfig commands from a shell.  (It does work, then, however.)  I have a thread about this:  https://forums.gentoo.org/viewtopic-p-2935329.htm
> 
> The last response suggested that I skip wep and try for WPA.  So I found this thread and am giving it a whirl.  I followed the instructions and everything lines up except that I am using a 2.6.6 kernel.  Still, the kernel options are the same.  The first couple of ebuilds emerged without a problem.  However, when I got to the MadWifi drivers, I got stuck:
> 
> ```
> ...

 

Yep, I double-checked and it's there.  Here's the beginning of that file.

```
# Copyright 1999-2005 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Header: /var/cvsroot/gentoo-x86/net-wireless/wpa_supplicant/wpa_supplicant-0$

CFLAGS="$CFLAGS -I/usr/include/madwifi"

inherit eutils toolchain-funcs

MY_P=${PN}-${PV/_/-}

S=${WORKDIR}/${MY_P}

DESCRIPTION="IEEE 802.1X/WPA supplicant for secure wireless transfers"

HOMEPAGE="http://hostap.epitest.fi/wpa_supplicant/"

SRC_URI="http://hostap.epitest.fi/releases/${MY_P}.tar.gz"

LICENSE="|| ( GPL-2 BSD )"
```

----------

## b8zs

wads:

 when i tried the 2.6.12 kernel, and fired up wpa_supplicant I got these warnings:

```

ioctl[SIOCSIWPMKSA]: Operation not supported

SIOCGIWRANGE: too old (short) data - assuming WPA is not supported

```

So I would assume you should update to 2.6.14 if you are using the newest versions of the drivers/tools

But im not an expert B)

----------

## wads

 *b8zs wrote:*   

> wads:
> 
>  when i tried the 2.6.12 kernel, and fired up wpa_supplicant I got these warnings:
> 
> ```
> ...

 

Thanks for the thought, but I am running a 2.6.6 kernel.  I built it some time ago; I can't remember the sources.  Maybe I should downgrade to the (vanilla?) 2.6.14 in the portage tree?  In any case, my current problem is that I can't even finish the emerge.Last edited by wads on Sun Dec 11, 2005 6:51 pm; edited 1 time in total

----------

## herrzattacke

I've got it working (partially)

WPA-TKIP works if i dont hide the essid

WPA2-CCMP does not work at all

anyone experiencing same problem?

regards

HerrZattacke

----------

## Da Fox

 *wads wrote:*   

>  *djnauk wrote:*    *wads wrote:*   I have been struggling with WiFi since updating my system.  It works automatically without WEP.  However, if I want to use WEP, I have to use iwconfig commands from a shell.  (It does work, then, however.)  I have a thread about this:  https://forums.gentoo.org/viewtopic-p-2935329.htm
> 
> The last response suggested that I skip wep and try for WPA.  So I found this thread and am giving it a whirl.  I followed the instructions and everything lines up except that I am using a 2.6.6 kernel.  Still, the kernel options are the same.  The first couple of ebuilds emerged without a problem.  However, when I got to the MadWifi drivers, I got stuck:
> 
> ```
> ...

 

I'm running into the exact same error. I'm trying this with kernel-2.6.14-r4. The ebuild is edited exactly as specified.

----------

## daeghrefn

The entire process worked fine for me.  I used vanilla-sources-2.6.14.2 and successfully built the drivers.

I am also running hostapd with WPA-PSK.  I haven't tried hiding the ESSID yet, but other than that all is well.  There was only one "problem" I encountered.  With the new wlanconfig, you have to define if you're running a station or ap.  If you define:

```
wlanconfig ath0 create wlandev wifi0 wlanmode sta > /dev/null
```

in your /etc/conf.d/net file (under the preup script), then it will not allow you to place your card into master mode.  However, if you change it to:

```
wlanconfig ath0 create wlandev wifi0 wlanmode ap > /dev/null
```

you can place the card into master mode and start up hostapd without any problems.  I'm running hostapd version 0.4.7.  It works great.

----------

## Da Fox

A friend advised me to emerge net-wireless/ieee80211, he thought it might have `IEEE80211_KEY_GROUP', but unfortunately:

```
driver_madwifi.c: In function `wpa_driver_madwifi_set_key':

driver_madwifi.c:250: error: `IEEE80211_KEY_GROUP' undeclared (first use in this function)

driver_madwifi.c:250: error: (Each undeclared identifier is reported only once

driver_madwifi.c:250: error: for each function it appears in.)

make: *** [driver_madwifi.o] Error 1

make: *** Waiting for unfinished jobs....

!!! ERROR: net-wireless/wpa_supplicant-0.4.7-r1 failed.

!!! Function src_compile, Line 82, Exitcode 2

!!! emake failed
```

----------

## Da Fox

Anyone?

----------

## djnauk

 *Da Fox wrote:*   

> Anyone?

 

Sorry - I'm at a loss to explain that one.

----------

## nichocouk

I googled for IEEE80211_KEY_GROUP and the first result I got might help you: http://hostap.epitest.fi/bugz/show_bug.cgi?id=63

----------

## Da Fox

I google'd as well, I just used "IEEE80211_KEY_GROUP+undeclared", which gives only 4 results :/

I'm not sure if this is a solution though, this is a bug report for a running driver, which does not set some variable, where as I am having problems compiling:

the entire IEEE80211_KEY_GROUP declaration can't be found.

----------

## ChrisCol

Just to add to the list, another one with the `IEEE80211_KEY_GROUP' undeclared error.

Tried both vanila-2.6.14 and gentoo-sources-2.6.14-r4.  All other versions as per the guide.

EDIT - Added more useful info.

----------

## Da Fox

I'm thinking that this error is the reason madwifi isn't build in the standard 0.4.7 ebuild?

----------

## BeaTtheMeaT666

Hi,

I tried to update the madwifi-driver and tools from 20051130 (which worked fine, thanks djnauk) to 20051208.

I copied the ebuild files and changed $SRC_URI, $S and $MADWIFI_SVN_REV according to the updated howto.

madwifi-driver compiles fine, but with the madwifi-tools I get the following errors:

```

>>> emerge (1 of 1) net-wireless/madwifi-tools-0.1_pre20051208 to /

>>> md5 files   ;-) madwifi-tools-0.1_pre20051130.ebuild

>>> md5 files   ;-) madwifi-tools-0.1_pre20051208.ebuild

>>> md5 files   ;-) files/digest-madwifi-tools-0.1_pre20051130

>>> md5 files   ;-) files/digest-madwifi-tools-0.1_pre20051208

>>> md5 src_uri ;-) madwifi-ng-r1350-20051208.tar.gz

>>> Unpacking source...

>>> Unpacking madwifi-ng-r1350-20051208.tar.gz to /var/tmp/portage/madwifi-tools-0.1_pre20051208/work

sed: can't read athstats.c: No such file or directory

>>> Source unpacked.

Checking requirements... ok.

Checking kernel configuration... ok.

mkdir -p ./symbols

for i in ./ath_hal ./net80211 ath_rate/sample ./ath ./tools ; do \

        make -C $i || exit 1; \

done

make[1]: Entering directory `/var/tmp/portage/madwifi-tools-0.1_pre20051208/work/madwifi-ng-r1350-20051208/ath_hal'

cp -f ./../hal/public/i386-elf.opt_ah.h opt_ah.h

cp -f ./../hal/linux/ah_osdep.c ah_osdep.c

/usr/bin/uudecode ./../hal/public/i386-elf.hal.o.uu

make -C /usr/src/linux-2.6.14-gentoo-r2 SUBDIRS=/var/tmp/portage/madwifi-tools-0.1_pre20051208/work/madwifi-ng-r1350-20051208/ath_hal MODVERDIR=/var/tmp/portage/madwifi-tools-0.1_pre20051208/work/madwifi-ng-r1350-20051208/ath_hal/../symbols modules

make[2]: Entering directory `/usr/src/linux-2.6.14-gentoo-r2'

Makefile:530: /usr/src/linux-2.6.14-gentoo-r2/arch/x86/Makefile: No such file or directory

make[2]: *** No rule to make target `/usr/src/linux-2.6.14-gentoo-r2/arch/x86/Makefile'.  Stop.

make[2]: Leaving directory `/usr/src/linux-2.6.14-gentoo-r2'

make[1]: *** [all] Error 2

make[1]: Leaving directory `/var/tmp/portage/madwifi-tools-0.1_pre20051208/work/madwifi-ng-r1350-20051208/ath_hal'

make: *** [all] Error 1

!!! ERROR: net-wireless/madwifi-tools-0.1_pre20051208 failed.

!!! Function src_compile, Line 556, Exitcode 2

!!! emake failed

!!! If you need support, post the topmost build error, NOT this status message.

roadrunner madwifi-tools # 

```

Did anyone have success in using the ebuild from 20051130 for the newer snapshot ?

Here is the ebuild I use:

```

roadrunner madwifi-tools # cat madwifi-tools-0.1_pre20051208.ebuild

# Copyright 1999-2005 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Header: /var/cvsroot/gentoo-x86/net-wireless/madwifi-tools/madwifi-tools-0.1_pre20051111.ebuild,v 1.2 2005/11/18 20:59:58 cryos Exp $

MADWIFI_SVN_REV="1350"

DESCRIPTION="Wireless tools for Atheros chipset a/b/g cards"

HOMEPAGE="http://www.madwifi.org"

SRC_URI="http://snapshots.madwifi.org/madwifi-ng/madwifi-ng-r${MADWIFI_SVN_REV}-${PV:7:8}.tar.gz"

S=${WORKDIR}/madwifi-ng-r${MADWIFI_SVN_REV}-${PV:7:8}

LICENSE="GPL-2"

SLOT="0"

KEYWORDS="-amd64 ~ppc ~x86"

IUSE=""

DEPEND="virtual/libc"

src_unpack() {

        unpack ${A}

        cd ${S}

        sed -i 's:err(1, ifr.ifr_name);:err(1, "%s", ifr.ifr_name);:g' athstats.c

        sed -i "s:CFLAGS=:CFLAGS+=:" Makefile

        sed -i "s:LDFLAGS=:LDFLAGS+=:" Makefile

}

src_install() {

        make install DESTDIR=${D} BINDIR=/usr/bin MANDIR=/usr/share/man || die "make install failed"

        dodir /sbin

        mv ${D}/usr/bin/wlanconfig ${D}/sbin

}

roadrunner madwifi-tools # 

```

Looks like something in the directory structure has changed.

athstats.c is now in ${S}/tools , if I change that in the first line with sed this error disappears.

But I couldn't figure out yet why make is trying to look in  /usr/src/linux-2.6.14-gentoo-r2/arch/x86/Makefile instead of  /usr/src/linux-2.6.14-gentoo-r2/arch/i386/Makefile and if it is necessary at all.

Hope someone can help.

Thanks and Mahalo,

Bobo

EDIT:

works now, after changing $S  in the madwifi-tools ebuild to:

S=${WORKDIR}/madwifi-ng-r${MADWIFI_SVN_REV}-${PV:7:8}/tools

djnauk: can you please verify this and update the howto ?

----------

## wads

Fellow Gentooers who are stuck with the IEEE80211_KEY_GROUP' undeclared problem, have any of you tried ndiswrapper?

Also, I mentioned earlier that I can get my wifi connection up from a shell.  I think that the old madwifi drivers still work, but I have no idea why I can't use the new gentoo wireless start-up procedure to connect automatically.  Strange....

----------

## BeaTtheMeaT666

hi,

wads, sorry can't help you on that issue.

But I'm having some kind of stability problems with the madwifi-ng drivers compared to the old ones from portage which worked up to 2.6.12 fine for me.

I sometimes get disconnected and have to restart wpa_supplicant or the net.ath0 initscript couple of times to get a connection. 

It's either some ioctrl stuff or dhcp timeouts. I'll post more details tomorrow since I'm happy my connection is ok now.

Does anyone else experience the same with the new drivers ? 

I'm running gentoo-sources-2.6.14-r2, wpa_supplicant-0.4.7-r1 and madwifi-driver/tools-20051208 (had smiliar issues with madwifi 20051130)

Bobo

----------

## rem5

 *BeaTtheMeaT666 wrote:*   

> .........
> 
> works now, after changing $S  in the madwifi-tools ebuild to:
> 
> S=${WORKDIR}/madwifi-ng-r${MADWIFI_SVN_REV}-${PV:7:8}/tools
> ...

 

Same here, thank for the solution  :Smile: 

----------

## zarathustra03

 *Da Fox wrote:*   

> I'm thinking that this error is the reason madwifi isn't build in the standard 0.4.7 ebuild?

 

I was seeing this IEEE80211_KEY_GROUP error as well. I then noticed that I didn't actually have madwifi-driver-0.1_pre20051208 installed. Portage had instead emerged the 0420 version. Looks like it was masked, and I had to add the more recent ebuilds to portage.unmask. Now wpa_supplicant compiles without errors. You might verify the same thing isn't happening to you.

----------

## seren

i followed all the steps to the T and still when trying to connect to the ap it times out im going to add config_ath0=(" dhcp" ) before my modules= and wpa settings in /etc/conf.d/net

----------

## bradenm

Thanks for the howto - I'm trying to set up my DWL-G520 for the first time. I followed the instructions, with a few extra steps to make it work on AMD64, and now I have madwifi-driver-0.1_pre20051208, madwifi-tools-0.1_pre20051208, and wpa_supplicant-0.4.7-r1 all working. Just now I was actually able to bring the wireless network up, and ping google but my system completely hangs after about a minute, and I have to restart.

Any ideas?

I see there is a new wpa_supplicant in portage, and I could update to baselayout 1.12.0, but I think this is a kernel driver issue...

----------

## djnauk

 *bradenm wrote:*   

> Thanks for the howto - I'm trying to set up my DWL-G520 for the first time. I followed the instructions, with a few extra steps to make it work on AMD64, and now I have madwifi-driver-0.1_pre20051208, madwifi-tools-0.1_pre20051208, and wpa_supplicant-0.4.7-r1 all working. Just now I was actually able to bring the wireless network up, and ping google but my system completely hangs after about a minute, and I have to restart.
> 
> Any ideas?
> 
> I see there is a new wpa_supplicant in portage, and I could update to baselayout 1.12.0, but I think this is a kernel driver issue...

 

This is a known problem with 64-bit and wpa_supplicant. (The first few replies to this thead cover this). AFAIK, there's no fix/solution for this at the moment.

I'll also update the guide now - thanks for the tip!

----------

## bradenm

 *djnauk wrote:*   

>  *bradenm wrote:*   Thanks for the howto - I'm trying to set up my DWL-G520 for the first time. I followed the instructions, with a few extra steps to make it work on AMD64, and now I have madwifi-driver-0.1_pre20051208, madwifi-tools-0.1_pre20051208, and wpa_supplicant-0.4.7-r1 all working. Just now I was actually able to bring the wireless network up, and ping google but my system completely hangs after about a minute, and I have to restart.
> 
>  
> 
> This is a known problem with 64-bit and wpa_supplicant. (The first few replies to this thead cover this). AFAIK, there's no fix/solution for this at the moment.
> ...

 

Thanks - I wasn't sure if those posts were related or not. Actually, it seems to be a problem with the madwifi driver - http://www.madwifi.org/ticket/74 . I tried the latest wpa_supplicant, but noticed no differences at all.

----------

## bradenm

Great news for all of you with amd64 and Atheros... I just got my DWL-G520 working . I'm now using wpa_supplicant-0.5.0, ndiswrapper 1.7 (just rename the 1.5 ebuild), and this obscure 64-bit driver (info). It's somewhat buggy, but it works (I can live with it until madwifi is fixed).

The only issues I've noticed so far:

*any attempt to run iwconfig (or even ifconfig) will cause it to stop working.

*it seems to only work once per start. So if you disconnect or fail to connect, you may have to restart your computer before you will be able to connect again.

----------

## Kilburn

 *wads wrote:*   

>  *djnauk wrote:*    *wads wrote:*   I have been struggling with WiFi since updating my system.  It works automatically without WEP.  However, if I want to use WEP, I have to use iwconfig commands from a shell.  (It does work, then, however.)  I have a thread about this:  https://forums.gentoo.org/viewtopic-p-2935329.htm
> 
> The last response suggested that I skip wep and try for WPA.  So I found this thread and am giving it a whirl.  I followed the instructions and everything lines up except that I am using a 2.6.6 kernel.  Still, the kernel options are the same.  The first couple of ebuilds emerged without a problem.  However, when I got to the MadWifi drivers, I got stuck:
> 
> ```
> ...

 

```

sly net80211 # cd /usr/include/madwifi/net80211/

sly net80211 # grep IEEE80211_KEY_GROUP *

ieee80211_crypto.h:#define      IEEE80211_KEY_GROUP     0x04    /* key used for WPA group operation */

ieee80211_crypto.h:     (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV | IEEE80211_KEY_GROUP)

```

This constant should be defined in /usr/include/madwifi/net80211/ieee80211_crypto.h, check manually if it's there, and if it isn't, install madwifi-ng driver manually (it worked for me this way)

----------

## MadScientist

Has anybody got this working with swsusp? With the pre-ng version and kernel 2.6.13, hibernate worked fine, but now after a hibernate, the NIC is not working. It seems I have to rmmod all the wlan-related stuff all the way down to wlan and ath_hal, and then modprobe ath_pci to get it all loaded again.  :Confused: 

Edit:this is a little brute-force, but here's how I've made it work:

I changed the predown and preup scripts to unload/reload the drivers:

```
preup() {

        /sbin/modprobe ath_pci

        if [ "${IFACE}" == "ath0" ]; then

                /sbin/wlanconfig ath0 create wlandev wifi0 wlanmode sta > /dev/null

                return $?

        fi

        if mii-tool ${IFACE} 2> /dev/null | grep -q 'no link'; then

                ewarn "No link on ${IFACE}, aborting configuration"

                return 1

        fi

        return 0

}

predown() {

        if [ "${IFACE}" == "ath0" ]; then

                killall wpa_supplicant

                /sbin/wlanconfig ath0 destroy

                /sbin/rmmod wlan_tkip

                /sbin/rmmod wlan_scan_sta

                /sbin/rmmod ath_pci

                /sbin/rmmod ath_rate_sample

                /sbin/rmmod wlan

                /sbin/rmmod ath_hal

                return $?

        fi

        return 0

}

```

And I forced a stop/start in my acpi default.sh script:

```
case "$action" in

                        power)  /usr/bin/sync && /etc/init.d/net.ath0 stop && echo disk > /sys/power/state && /etc/init.d/net.ath0 start &
```

It still takes much longer for the network to come up after a swsusp than it did pre-ng drivers, but at least it's working, which is better than a full reboot.

Edit2: Unfortunately, it seems some other driver is causing the system to hang sometimes on boot. Back to 2.6.13 for me. I hope the next kernel update has improved driver support for laptops rather than breaking it.  :Sad: 

----------

## wads

 *Kilburn wrote:*   

>  *wads wrote:*   
> 
> <snip>
> 
> driver_madwifi.c:250: error: `IEEE80211_KEY_GROUP' undeclared (first use in this function)
> ...

 

Thanks for the tip; it was indeed missing.  However, I tried doing everything from scratch after a syncing my portage and lo'-and-behold, everything emerged successfully.  djnauk, I did find a minor typo in the instructions copied below (the former should be for the driver and the latter for the tools):

 *Quote:*   

> 
> 
> change these to, for the madwifi-tools-0.1_pre20051208.ebuild:
> 
> ```
> ...

 

In any case, everything ran pretty smoothly.  One other thing I would suggest makes it into the guide is setting up the package unmask file as it will help ensure that the right ebuild is used.  My happiness with getting the builds to work was short-lived as I still can't use WPA Supplicant to connect.  My router is configured for WPA-PSK.

When I run:

```
wpa_supplicant -wdd -c /etc/wpa_supplicant.conf -i ath0 -ipw
```

I get this:

```

Initializing interface 'pw' conf '/etc/wpa_supplicant.conf' driver 'default' ctrl_interface 'N/A'

Configuration file '/etc/wpa_supplicant.conf' -> '/etc/wpa_supplicant.conf'

Reading configuration file '/etc/wpa_supplicant.conf'

ctrl_interface='/var/run/wpa_supplicant'

ctrl_interface_group=0

ap_scan=2

Line: 5 - start of a new network block

key_mgmt: 0x2

PSK (ASCII passphrase) - hexdump_ascii(len=8): [REMOVED]

ssid - hexdump_ascii(len=6):

     64 6a 77 6e 65 74                                 djwnet

PSK (from passphrase) - hexdump(len=32): [REMOVED]

Priority group 0

   id=0 ssid='djwnet'

Initializing interface (2) 'pw'

EAPOL: SUPP_PAE entering state DISCONNECTED

EAPOL: KEY_RX entering state NO_KEY_RECEIVE

EAPOL: SUPP_BE entering state INITIALIZE

EAP: EAP entering state DISABLED

EAPOL: External notification - portEnabled=0

EAPOL: External notification - portValid=0

ioctl[SIOCSIWPMKSA]: No such device

ioctl[SIOCSIWMODE]: No such device

Could not configure driver to use managed mode

ioctl[SIOCGIFFLAGS]: No such device

Could not set interface 'pw' UP

ioctl[SIOCGIWRANGE]: No such device

ioctl[SIOCGIFINDEX]: No such device

Waiting for interface..

ioctl[SIOCGIFINDEX]: No such device

Waiting for interface..

ioctl[SIOCGIFINDEX]: No such device

Waiting for interface..

ioctl[SIOCGIFINDEX]: No such device

Waiting for interface..

```

----------

## asarazan

Hey, I tried this on an amd64 and almost got things working. I can connect to the internet (wpa_supplicant doesn't want to find anything, so I just had to use iwconfig, iirc), and I can even ping stuff, and it's fine. The problem comes when I want to do more than that. I'll open up firefox or lynx, and as soon as things start talking, BAM kernel panic. I've tried this with both the modified ebuild and the latest svn madwifi-drivers.

Anybody got any sage advice, or am I just stuck til things are further developed?

----------

## Pandor

 *wads wrote:*   

> 
> 
> When I run:
> 
> ```
> ...

 

Could you elaborate on your command please?

First of all, i do not see you enabeling the use of the madwifi driver "-D madwifi" second, why are you trying to link it to 2 interfaces? "-iath0 & -ipw" (i doubt 'pw' is a interface at all..

thry something along the lines of:

wpa_supplicant -Dmadwifi -iath0 -c/etc/wpa_supplicant.conf -wdd

I've just upgraded to madwifi driver/tools 1365 (2005-12-22) and wpa_supplicant 0.5 following this tutorial.

keep up the good work djnauk!

PS: wpa_supplicant 0.5 is now in portage, so everyone who did not specifically set =wpa_supplicant-0.4.7 in their package.keywords wil upgrade to 0.5.0, so you'll lose the madwifi support. make sure you eighter modify wpa_supplicant-0.5.0.ebuild and add it to your overlay (same steps as 0.4.7) or lock your package.keywords to version 0.4.7!

also, for the lazy people (like me) or the n00bs who don't fancy editing wpa_supplicant.conf to add their wireless network, add this to /etc/wpa_supplicant.conf:

```

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=10

update_config=1

```

then add youself to group 10 (wheel) and fire up 'wpa_gui' this wil let you scan and add wireles networks through a nice gui (included with wpa_supplicant).

----------

## asarazan

http://madwifi.org/ticket/74

It seems that the new drivers have been unavailable to us amd64 users for 3 months now, and with nobody stepping up to try to fix them, it could easily be 3 more. Times like this that I wish I didn't suck at programming  :Sad: .

Anybody on these forums wanna give it a go?

----------

## UberLord

 *asarazan wrote:*   

> Hey, I tried this on an amd64 and almost got things working. I can connect to the internet (wpa_supplicant doesn't want to find anything, so I just had to use iwconfig, iirc), and I can even ping stuff, and it's fine. The problem comes when I want to do more than that. I'll open up firefox or lynx, and as soon as things start talking, BAM kernel panic. I've tried this with both the modified ebuild and the latest svn madwifi-drivers.
> 
> Anybody got any sage advice, or am I just stuck til things are further developed?

 

Here's some sage advice - stick with the net-wireless/madwifi-driver-0.1_pre20050420-r1 on amd64

The Gentoo madwifi maintainer (brix) occasionally pesters me to test a snapshot on my amd64, but I've not had it working for over 5 months now.

----------

## asarazan

Yeah, normally I wouldn't really care, but for some reason my card keeps dropping its connection to my parents' netgear wireless router, and I'm just desparately searching for a way to fix it   :Sad: 

----------

## wads

 *Quote:*   

> [quote="Pandor"] *wads wrote:*   
> 
> When I run:
> 
> ```
> ...

 

My bad.  It was late and since I had no Internet access on my linux box, I was running room-to-room.  I finally relented, went back to WEP and copied the output across my network.  Looking at it now, I have no idea why I entered that.

 *Quote:*   

> thry something along the lines of:
> 
> wpa_supplicant -Dmadwifi -iath0 -c/etc/wpa_supplicant.conf -wdd

 

I'm still having no luck connecting to the network.  The scan request time (0 sec, 0 usec) seems really small.  Aside from that, I'm pretty much at a loss regarding what to do next.  Here is the output from your suggestion:

```

Initializing interface 'ath0' conf '/etc/wpa_supplicant.conf' driver 'madwifi' ctrl_interface 'N/A'

Configuration file '/etc/wpa_supplicant.conf' -> '/etc/wpa_supplicant.conf'

Reading configuration file '/etc/wpa_supplicant.conf'

ctrl_interface='/var/run/wpa_supplicant'

ctrl_interface_group=0

ap_scan=2

Line: 7 - start of a new network block

key_mgmt: 0x2

PSK - hexdump(len=32): [REMOVED]

ssid - hexdump_ascii(len=6):

     64 6a 77 6e 65 74                                 djwnet          

Priority group 0

   id=0 ssid='djwnet'

Initializing interface (2) 'ath0'

EAPOL: SUPP_PAE entering state DISCONNECTED

EAPOL: KEY_RX entering state NO_KEY_RECEIVE

EAPOL: SUPP_BE entering state INITIALIZE

EAP: EAP entering state DISABLED

EAPOL: External notification - portEnabled=0

EAPOL: External notification - portValid=0

SIOCGIWRANGE: too old (short) data - assuming WPA is not supported

Own MAC address: 00:0d:88:c6:d3:41

wpa_driver_madwifi_del_key: keyidx=0

wpa_driver_madwifi_del_key: keyidx=1

wpa_driver_madwifi_del_key: keyidx=2

wpa_driver_madwifi_del_key: keyidx=3

wpa_driver_madwifi_set_countermeasures: enabled=0

wpa_driver_madwifi_set_drop_unencrypted: enabled=1

Setting scan request: 0 sec 100000 usec

Added interface ath0

Wireless event: cmd=0x8b06 len=8

Ignore event for foreign ifindex 2

RTM_NEWLINK, IFLA_IFNAME: Interface 'ath0' added

RTM_NEWLINK, IFLA_IFNAME: Interface 'ath0' added

State: DISCONNECTED -> SCANNING

Trying to associate with SSID 'djwnet'

Cancelling scan request

WPA: clearing own WPA/RSN IE

Automatic auth_alg selection: 0x1

WPA: No WPA/RSN IE available from association info

WPA: Set cipher suites based on configuration

WPA: Selected cipher suites: group 30 pairwise 24 key_mgmt 2

WPA: clearing AP WPA IE

WPA: clearing AP RSN IE

WPA: using GTK CCMP

WPA: using PTK CCMP

WPA: using KEY_MGMT WPA-PSK

WPA: Set own WPA IE default - hexdump(len=22): 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00

No keys have been configured - skip key clearing

wpa_driver_madwifi_set_drop_unencrypted: enabled=1

State: SCANNING -> ASSOCIATING

wpa_driver_madwifi_associate

Setting authentication timeout: 60 sec 0 usec

EAPOL: External notification - EAP success=0

EAPOL: External notification - EAP fail=0

EAPOL: External notification - portControl=Auto

Wireless event: cmd=0x8b1a len=19

Wireless event: cmd=0x8b19 len=12

Received 541 bytes of scan results (2 BSSes)

Scan results: 2

Authentication with 00:00:00:00:00:00 timed out.

Added BSSID 00:00:00:00:00:00 into blacklist

State: ASSOCIATING -> DISCONNECTED

No keys have been configured - skip key clearing

EAPOL: External notification - portEnabled=0

EAPOL: External notification - portValid=0

Setting scan request: 0 sec 0 usec

```

----------

## Pandor

 *wads wrote:*   

> ...
> 
> ```
> 
> ...
> ...

 

This message kinda cought my attention.

Are you sure your card supports WPA?

----------

## _kal_

Great guide! Worked like a charm   :Razz: 

I've used wpa_supplicant-0.5.0 instead of 0.4.7-r. Notice that we have to add these lines:

/etc/portage/package.unmask :

 *Quote:*   

> 
> 
> kal@vaio ~ $ cat /etc/portage/package.unmask
> 
> >=net-im/gaim-2.0.0_beta1
> ...

 

/etc/portage/package.keywords :

 *Quote:*   

> net-wireless/wpa_supplicant-0.5.0 ~x86
> 
> =net-wireless/madwifi-driver-0.1_pre20051208 ~x86
> 
> =net-wireless/madwifi-tools-0.1_pre20051208 ~x86

 

By the way, connection is often lost and i have to restart net.ath0   :Crying or Very sad: 

Is there a trick to maintain the connection alive (send alive packet with wpa_supplicant) ?

----------

## maxalken

I have done all steps in this guide. Now I can manually connect my wireless card to my AP, but I can connect it by start script /etc/init.rd/net.ath0.

I can establish the physical and data link layer connection by typing the command:

```
ifconfig ath0 up #bring up the device

wpa_supplicant -Dmadwifi -iath0 -c/etc/wpa_supplicant.conf #establish the data link layer connection
```

establish network layer connection:

```
ifconfig ath0 192.168.0.20 netmask 255.255.255.0

route add default gw 192.168.0.1 ath0
```

Great!! the connection is perfect. I can surf internet. It means the card I got from eBay is working.  :Laughing:   And madwifi and wpa_supplicant are correctly installed.

But.....................  :Rolling Eyes: 

I can not figure out how to make a correct /etc/conf.d/wireless. Thus, I can not make my wireless card connect to AP everytime I reboot my computer. It always says time out

 *Quote:*   

>  * Starting ath0
> 
>  *   Running preup function
> 
>  *   Starting wpa_supplicant on ath0 ...                                  [ ok ] *     timed out                                                          [ !! ]

 

This is my /etc/conf.d/wireless

```
preup() {

       if [ "${IFACE}" == "ath0" ]; then

                /sbin/wlanconfig ath0 create wlandev wifi0 wlanmode sta > /dev/null

                return $?

       fi

       if mii-tool ${IFACE} 2> /dev/null | grep -q 'no link'; then

                ewarn "No link on ${IFACE}, aborting configuration"

                return 1

       fi

       return 0

}

predown() {

        if [ "${IFACE}" == "ath0" ]; then

                killall wpa_supplicant

                /sbin/wlanconfig ath0 destroy

                return $?

        fi

        return 0

}

# madwifi setup

ifconfig_ath0=( "192.168.0.11 netmask 255.255.255.0" )

routes_ath0=( "default gw 192.168.0.1" )

modules=( "wpa_supplicant" )

wpa_supplicant_ath0="-Dmadwifi -c/etc/wpa_supplicant.conf"

wpa_timeout_ath0=20

```

If I remove the preup()  function and type ifconfig ath0 up before typing /etc/init.d/net.ath0 start, it works. But it does not work no matter where I put ifconfig ath0 up in /etc/conf.d/wireless. That means, I have no luck to make it work at boot time automatically.

----------

## Pandor

 *maxalken wrote:*   

> ...
> 
> I can not figure out how to make a correct /etc/conf.d/wireless. Thus, I can not make my wireless card connect to AP everytime I reboot my computer. It always says time out
> 
>  *Quote:*    * Starting ath0
> ...

 

afaik. wpa_supplicant handles the AP jumping so you only need to change /etc/conf.d/net (you added those lines to /etc/conf.d/wireless).

I'm not that familiar with how gentoo handles networking (still figuring it out) but afaik, conf.d/wireless is a configuration file for your preferred AP's so it should only contain ESSID info and such, but since we're using wpa_supplicant you need to edit /etc/wpa_supplicant.conf.

----------

## Pandor

 *djnauk wrote:*   

> ...
> 
> ```
> ...
> 
> ...

 

Just a thought, but wouldn't it be cleaner ('nicer') to use the wpa_supplicant commandline client 'wpa_cli' to shutdown wpa_supplicant daemon instead of just killing it?

so, that would be: 'wpa_cli terminate' instead of 'killall wpa_supplicant'.

----------

## biner

 *UberLord wrote:*   

> As soon as there's network traffic across the freshly created ath0 interface the kernel goes OOPS - segfault. Apparently upstream are aware of the problem - and have been for some time.
> 
> So, I've got an rt2500 card - but that driver is waaaay too new, but it least it works with WEP - heh.

 

The problem with the kernel panic doesn't seem to only be related to amd64, as I have the same issue on my pentium-m (centrino) setup. Frustrating how long it's taking upstream to fix this one.

----------

## bheinze

Hello,

creating manually a monitor device with madwifi works so far, but creating automatic a device via /etc/init.d/net.ath0 start doesn't work so far.

I don't want wpa_supplicant to automatically connect to a hotspot (I don't always have a hotspot around) but I'd rather run wpa_gui and select the hotspot I want to connect to. I followed this guide so far.

My /etc/wpa_supplicant.conf looks like this:

```
update_config=1

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

eapol_version=1

ap_scan=1

fast_reauth=1

opensc_engine_path=/usr/lib/opensc/engine_opensc.so

pkcs11_engine_path=/usr/lib/opensc/engine_pkcs11.so

pkcs11_module_path=/usr/lib/pkcs11/opensc-pkcs11.so

network={

key_mgmt=NONE

priority=1

}
```

Now when I run /etc/init.d/net.ath0 start

```
 * Starting ath0

 *   Running preup function

 *   Starting wpa_supplicant on ath0 ...

Initializing interface 'ath0' conf '/etc/wpa_supplicant.conf' driver 'madwifi' ctrl_interface 'N/A'

Configuration file '/etc/wpa_supplicant.conf' -> '/etc/wpa_supplicant.conf'

Reading configuration file '/etc/wpa_supplicant.conf'

update_config=1

ctrl_interface='/var/run/wpa_supplicant'

ctrl_interface_group=0

eapol_version=1

ap_scan=1

fast_reauth=1

opensc_engine_path='/usr/lib/opensc/engine_opensc.so'

pkcs11_engine_path='/usr/lib/opensc/engine_pkcs11.so'

pkcs11_module_path='/usr/lib/pkcs11/opensc-pkcs11.so'

Priority group 1

   id=0 ssid=''

Initializing interface (2) 'ath0'

EAPOL: SUPP_PAE entering state DISCONNECTED

EAPOL: KEY_RX entering state NO_KEY_RECEIVE

EAPOL: SUPP_BE entering state INITIALIZE

EAP: EAP entering state DISABLED

EAPOL: External notification - portEnabled=0

EAPOL: External notification - portValid=0

SIOCGIWRANGE: WE(compiled)=19 WE(source)=13 enc_capa=0x0

  capabilities: key_mgmt 0x0 enc 0x3

Own MAC address: 00:14:a4:43:79:84

wpa_driver_madwifi_del_key: keyidx=0

wpa_driver_madwifi_del_key: keyidx=1

wpa_driver_madwifi_del_key: keyidx=2

wpa_driver_madwifi_del_key: keyidx=3

wpa_driver_madwifi_set_countermeasures: enabled=0

wpa_driver_madwifi_set_drop_unencrypted: enabled=1

Setting scan request: 0 sec 100000 usec

Added interface ath0

Daemonize..                                                               [ ok ]

 *     timed out                                                          [ !! ]

```

How can I tell wpa_supplicant not to connect to a hotspot? It's no wonder it times out...

Now I want to run wpa_gui to select and connect to a hotspot, but...

```
Failed to open control connection to wpa_supplicant.

PING failed - trying to reconnect

PING failed - trying to reconnect

.........
```

Has anybody an idea how to start wpa_supplicant without connecting to a hotspot and how to make wpa_gui work?

Regards!

----------

## Azzazzazz

Thank you djnauk

Now I can play mario kart DS online on my gentoo based wireless router  :Razz: 

----------

## Pandor

 *bheinze wrote:*   

> Hello,
> 
> ...
> 
> My /etc/wpa_supplicant.conf looks like this:
> ...

 

Are you running wpa_gui as root?

Else i would suggest you change your wpa_supplicant.cnf to: "ctrl_interface_group=10", whre group 10 is the 'wheel' group.

Then just add yourself to the wheel group, and you should be able to connect to your wpa_supplicant .

----------

## nerve

After working this howto, 

i was unable to connect to my ap,

ap searching ,,,, wayting ,,,,

then e removed ath_pci from the autoload file and make a bether 

preup and postdown function with all modules compiled by the driver:

/etc/conf.d/net

```

preup() {

        if [ "${IFACE}" == "ath0" ]; then

                # loading wlan modules

                for i in ath_hal wlan wlan_acl wlan_ccmp wlan_tkip wlan_wep wlan_xauth wlan_scan_sta wlan_scan_ap ath_rate_onoe ath_rate_sample ath_pci; do

                #for i in ath_pci; do

                        einfo "Loading module $i"

                        modprobe $i;

                        if [ 0 -ne $? ]; then

                                ewarn "Failed loading module $i";

                                return 1;

                        fi;

                done

                # loading succeeded

                #wlanconfig ath0 destroy >/dev/null 2>&1

                wlanconfig ath0 create wlandev wifi0 wlanmode sta > /dev/null

                return 0;

        fi

        if mii-tool ${IFACE} 2> /dev/null | grep -q 'no link'; then

                ewarn "No link on ${IFACE}, aborting configuration"

                return 1

        fi

        return 0;

}

postdown() {

        if [ "${IFACE}" == "ath0" ]; then

                wlanconfig ath0 destroy

                for i in ath_pci ath_rate_sample ath_rate_onoe wlan_scan_ap wlan_scan_sta wlan_xauth wlan_wep wlan_tkip wlan_ccmp wlan_acl wlan ath_hal; do

                einfo "Unloading module $i"

                modprobe -r $i

                if [ 0 -ne $? ]; then

                        einfo "Failed unloading module $i"

                fi

                done

                return $?

        fi

        return 0

```

Now all its working for me 

( gentoo-sources 2.6.14-r5 )

The unloading of the modules kills also the ath0 interface.

Killing of the wpa_supplicant is not anymore,

wpa_supplicant is shuting down by the net scripts prior to postdown.

Have a nice day, Daniel

----------

## wads

 *Pandor wrote:*   

>  *wads wrote:*   ...
> 
> ```
> 
> ...
> ...

 

I was hoping that when I got back to my Linux box after the holiday weekend, my gift would be working wireless....  Alas, it was not to be.  In any case, my card does support WPA, it's a D-Link DWL-G520.  Someone else in this thread has the same card and got it working.  I tried backing off WPA and using WEP, but that didn't work either.  Think it's worth trying to upgrade to version 0.5 of wpa_supplicant?

----------

## thoughts

I have a Netgear WG311 PCI card (atheros-based).  It worked great with madwifi & wpa_supplicant until a couple months ago, which I guess is when all the changes mentioned at the top of this thread happened.  Anyway I've followed this guide and have made a lot of progress towards getting it to work again, but I'm stuck now.

Here's my /etc/wpa_supplicant.conf:

```
ctrl_interface=/var/run/wpa_supplicant

network={

        ssid="myrouter"

        psk="Super Secret Passphrase"

        key_mgmt=WPA-PSK

        proto=WPA

}

```

Here's what happens when I try to start the connection via the normal init-script method:

```
# /etc/init.d/net.ath0 start

 * Starting ath0

 *   Running preup function       [ ok ]

 *   Starting wpa_supplicant on ath0 ...       [ ok ]

 *     Timed out       [ !! ]
```

Since that doesn't work, I'm trying to come up with a manual script to get the connection started:

```
#!/bin/sh

killall wpa_supplicant

/sbin/wlanconfig ath0 destroy

/sbin/wlanconfig ath0 create wlandev wifi0 wlanmode sta

/sbin/ifconfig ath0 up

wpa_supplicant -c /etc/wpa_supplicant.conf -i ath0 -D madwifi -dd
```

But that doesn't work either; here's some of the output:

```
wpa_supplicant: no process killed

ath0

l2_packet_receive - recvfrom: Network is down

ioctl[unknown???]: Invalid argument

ioctl[SIOCSIWSCAN]: Invalid argument

ioctl[SIOCSIWSCAN]: Invalid argument

ioctl[SIOCSIWSCAN]: Invalid argument

Initializing interface 'ath0' conf '/etc/wpa_supplicant.conf' driver 'madwifi' ctrl_interface 'N/A'

Configuration file '/etc/wpa_supplicant.conf' -> '/etc/wpa_supplicant.conf'

Reading configuration file '/etc/wpa_supplicant.conf'

ctrl_interface='/var/run/wpa_supplicant'

Line: 2 - start of a new network block

ssid - hexdump_ascii(len=8):

     74 6f 72 74 69 6c 6c 61                           myrouter        

PSK (ASCII passphrase) - hexdump_ascii(len=32): [REMOVED]

key_mgmt: 0x2

proto: 0x1

PSK (from passphrase) - hexdump(len=32): [REMOVED]

Priority group 0

   id=0 ssid='myrouter'

Initializing interface (2) 'ath0'

EAPOL: SUPP_PAE entering state DISCONNECTED

EAPOL: KEY_RX entering state NO_KEY_RECEIVE

EAPOL: SUPP_BE entering state INITIALIZE

EAP: EAP entering state DISABLED

EAPOL: External notification - portEnabled=0

EAPOL: External notification - portValid=0

SIOCGIWRANGE: WE(compiled)=19 WE(source)=13 enc_capa=0x0

  capabilities: key_mgmt 0x0 enc 0x3

Own MAC address: 00:09:5b:94:69:32

wpa_driver_madwifi_del_key: keyidx=0

wpa_driver_madwifi_del_key: keyidx=1

wpa_driver_madwifi_del_key: keyidx=2

wpa_driver_madwifi_del_key: keyidx=3

wpa_driver_madwifi_set_countermeasures: enabled=0

wpa_driver_madwifi_set_drop_unencrypted: enabled=1

Setting scan request: 0 sec 100000 usec

Added interface ath0

Wireless event: cmd=0x8b06 len=8

State: DISCONNECTED -> SCANNING

Starting AP scan (broadcast SSID)

Wireless event: cmd=0x8b1a len=8

Wireless event: cmd=0x8b2a len=8

Wireless event: cmd=0x8b06 len=8

Wireless event: cmd=0x8b06 len=8

Ignore event for foreign ifindex 3

RTM_NEWLINK, IFLA_IFNAME: Interface 'ath0' added

RTM_NEWLINK, IFLA_IFNAME: Interface 'ath0' added

Scan timeout - try to get results

Received 254 bytes of scan results (1 BSSes)

Scan results: 1

Selecting BSS from priority group 0

0: 00:0f:b5:6b:27:9e ssid='myrouter' wpa_ie_len=24 rsn_ie_len=0 caps=0x11

   selected based on WPA IE

Trying to associate with 00:0f:b5:6b:27:9e (SSID='myrouter' freq=2462 MHz)

Cancelling scan request

WPA: clearing own WPA/RSN IE

Automatic auth_alg selection: 0x1

WPA: using IEEE 802.11i/D3.0

WPA: Selected cipher suites: group 8 pairwise 8 key_mgmt 2

WPA: set AP WPA IE - hexdump(len=24): dd 16 00 50 f2 01 01 00 00 50 f2 02 01 00 00 50 f2 02 01 00 00 50 f2 02

WPA: clearing AP RSN IE

WPA: using GTK TKIP

WPA: using PTK TKIP

WPA: using KEY_MGMT WPA-PSK

WPA: Set own WPA IE default - hexdump(len=24): dd 16 00 50 f2 01 01 00 00 50 f2 02 01 00 00 50 f2 02 01 00 00 50 f2 02

No keys have been configured - skip key clearing

wpa_driver_madwifi_set_drop_unencrypted: enabled=1

State: SCANNING -> ASSOCIATING

wpa_driver_madwifi_associate

Association request to the driver failed

Setting authentication timeout: 10 sec 0 usec

EAPOL: External notification - EAP success=0

EAPOL: External notification - EAP fail=0

EAPOL: External notification - portControl=Auto

Wireless event: cmd=0x8b1a len=17

Authentication with 00:00:00:00:00:00 timed out.

Added BSSID 00:00:00:00:00:00 into blacklist

State: ASSOCIATING -> DISCONNECTED

No keys have been configured - skip key clearing

EAPOL: External notification - portEnabled=0

EAPOL: External notification - portValid=0

Setting scan request: 0 sec 0 usec

State: DISCONNECTED -> SCANNING

Starting AP scan (broadcast SSID)

Failed to initiate AP scan.

Setting scan request: 10 sec 0 usec

Wireless event: cmd=0x8b1a len=8

Starting AP scan (broadcast SSID)

Failed to initiate AP scan.

Setting scan request: 10 sec 0 usec

Wireless event: cmd=0x8b1a len=8

Starting AP scan (broadcast SSID)

Failed to initiate AP scan.

Setting scan request: 10 sec 0 usec

Wireless event: cmd=0x8b1a len=8

Scan timeout - try to get results

Received 254 bytes of scan results (1 BSSes)

Scan results: 1

Selecting BSS from priority group 0

0: 00:0f:b5:6b:27:9e ssid='myrouter' wpa_ie_len=24 rsn_ie_len=0 caps=0x11

   selected based on WPA IE

Trying to associate with 00:0f:b5:6b:27:9e (SSID='myrouter' freq=2462 MHz)

Cancelling scan request

WPA: clearing own WPA/RSN IE

Automatic auth_alg selection: 0x1

WPA: using IEEE 802.11i/D3.0

WPA: Selected cipher suites: group 8 pairwise 8 key_mioctl[unknown???]: Invalid argument

ioctl[unknown???]: Invalid argument

ioctl[unknown???]: Invalid argument

ioctl[SIOCSIWSCAN]: Invalid argument

ioctl[SIOCSIWSCAN]: Invalid argument

ioctl[SIOCSIWSCAN]: Invalid argument

gmt 2

WPA: set AP WPA IE - hexdump(len=24): dd 16 00 50 f2 01 01 00 00 50 f2 02 01 00 00 50 f2 02 01 00 00 50 f2 02

WPA: clearing AP RSN IE

WPA: using GTK TKIP

WPA: using PTK TKIP

WPA: using KEY_MGMT WPA-PSK

WPA: Set own WPA IE default - hexdump(len=24): dd 16 00 50 f2 01 01 00 00 50 f2 02 01 00 00 50 f2 02 01 00 00 50 f2 02

No keys have been configured - skip key clearing

wpa_driver_madwifi_set_drop_unencrypted: enabled=1

State: SCANNING -> ASSOCIATING

wpa_driver_madwifi_associate

Association request to the driver failed

Setting authentication timeout: 10 sec 0 usec

EAPOL: External notification - EAP success=0

EAPOL: External notification - EAP fail=0

EAPOL: External notification - portControl=Auto

Wireless event: cmd=0x8b1a len=17

Scan timeout - try to get results

Received 254 bytes of scan results (1 BSSes)

Scan results: 1

Selecting BSS from priority group 0

0: 00:0f:b5:6b:27:9e ssid='myrouter' wpa_ie_len=24 rsn_ie_len=0 caps=0x11

   selected based on WPA IE

Trying to associate with 00:0f:b5:6b:27:9e (SSID='myrouter' freq=2462 MHz)

Cancelling scan request

WPA: clearing own WPA/RSN IE

Automatic auth_alg selection: 0x1

WPA: using IEEE 802.11i/D3.0

WPA: Selected cipher suites: group 8 pairwise 8 key_mgmt 2

WPA: set AP WPA IE - hexdump(len=24): dd 16 00 50 f2 01 01 00 00 50 f2 02 01 00 00 50 f2 02 01 00 00 50 f2 02

WPA: clearing AP RSN IE

WPA: using GTK TKIP

WPA: using PTK TKIP

WPA: using KEY_MGMT WPA-PSK

WPA: Set own WPA IE default - hexdump(len=24): dd 16 00 50 f2 01 01 00 00 50 f2 02 01 00 00 50 f2 02 01 00 00 50 f2 02

No keys have been configured - skip key clearing

wpa_driver_madwifi_set_drop_unencrypted: enabled=1

State: ASSOCIATING -> ASSOCIATING

wpa_driver_madwifi_associate

Association request to the driver failed

Setting authentication timeout: 10 sec 0 usec

EAPOL: External notification - EAP success=0

EAPOL: External notification - EAP fail=0

EAPOL: External notification - portControl=Auto

Wireless event: cmd=0x8b1a len=17

Scan timeout - try to get results

Received 254 bytes of scan results (1 BSSes)

Scan results: 1

Selecting BSS from priority group 0

0: 00:0f:b5:6b:27:9e ssid='myrouter' wpa_ie_len=24 rsn_ie_len=0 caps=0x11

   selected based on WPA IE

Trying to associate with 00:0f:b5:6b:27:9e (SSID='myrouter' freq=2462 MHz)

Cancelling scan request

WPA: clearing own WPA/RSN IE

Automatic auth_alg selection: 0x1

WPA: using IEEE 802.11i/D3.0

WPA: Selected cipher suites: group 8 pairwise 8 key_mgmt 2

WPA: set AP WPA IE - hexdump(len=24): dd 16 00 50 f2 01 01 00 00 50 f2 02 01 00 00 50 f2 02 01 00 00 50 f2 02

WPA: clearing AP RSN IE

WPA: using GTK TKIP

WPA: using PTK TKIP

WPA: using KEY_MGMT WPA-PSK

WPA: Set own WPA IE default - hexdump(len=24): dd 16 00 50 f2 01 01 00 00 50 f2 02 01 00 00 50 f2 02 01 00 00 50 f2 02

No keys have been configured - skip key clearing

wpa_driver_madwifi_set_drop_unencrypted: enabled=1

State: ASSOCIATING -> ASSOCIATING

wpa_driver_madwifi_associate

Association request to the driver failed

Setting authentication timeout: 10 sec 0 usec

EAPOL: External notification - EAP success=0

EAPOL: External notification - EAP fail=0

EAPOL: External notification - portControl=Auto

Wireless event: cmd=0x8b1a len=17

Authentication with 00:00:00:00:00:00 timed out.

BSSID 00:00:00:00:00:00 blacklist count incremented to 2

State: ASSOCIATING -> DISCONNECTED

No keys have been configured - skip key clearing

EAPOL: External notification - portEnabled=0

EAPOL: External notification - portValid=0

Setting scan request: 0 sec 0 usec

State: DISCONNECTED -> SCANNING

Starting AP scan (broadcast SSID)

Failed to initiate AP scan.

Setting scan request: 10 sec 0 usec

Wireless event: cmd=0x8b1a len=8

Starting AP scan (broadcast SSID)

Failed to initiate AP scan.

Setting scan request: 10 sec 0 usec

Wireless event: cmd=0x8b1a len=8

Starting AP scan (broadcast SSID)

Failed to initiate AP scan.

Setting scan request: 10 sec 0 usec

Wireless event: cmd=0x8b1a len=8

...

```

I'm pretty sure that most/all of my setup is correct because 1) it worked fine until a few months ago, and 2) I have a second Gentoo machine right next to this one that still works fine with the same wpa_supplicant.conf (but using a Netgear WG111 USB adapter, with wpa_supplicant and ndiswrapper).

Any ideas?

Thanks,

Anthony DiSante

http://encodable.com/

http://nodivisions.com/

----------

## Pandor

 *wads wrote:*   

> 
> 
> I was hoping that when I got back to my Linux box after the holiday weekend, my gift would be working wireless....  Alas, it was not to be.  In any case, my card does support WPA, it's a D-Link DWL-G520.  Someone else in this thread has the same card and got it working.  I tried backing off WPA and using WEP, but that didn't work either.  Think it's worth trying to upgrade to version 0.5 of wpa_supplicant?

 

I'dd give it a try. And if i was you, i'dd upgrade to the latest madwifi driver too.

Just follow the tutorial, look at http://snapshots.madwifi.org/madwifi-ng/, and change the 'MADWIFI_SVN_REV' variable to the number from the driver you want (so that would be 1367, for the latest 2005/12/29 driver), and also change to name of the ebuild to reflect the date of the driver you want to use (in this case change it to madwifi-driver-0.1_pr20051229 and madwifi-tools-0.1_pre20051229).

as for wpa_supplicant, just change the 5 ebuild, just as you did the 4.7.

i've had good results from using the latest drivers and wpa_supp 0.5 it all seems to initialise a lot faster.

----------

## smlgbl

 *nerve wrote:*   

> After working this howto, 
> 
> i was unable to connect to my ap,
> 
> ap searching ,,,, wayting ,,,,
> ...

 

Hi,

i got everything working after more or less following this how-to. But after a couple of weeks the 20 sec timeout wasn't enough anymore. 30 secs seemed to work for a couple of days. Today nothing was working anymore. Now i've changed my preup() and postdown() functions according to daniels/nerve's advice, and it works again like before.

Thanks

----------

## bheinze

 *Pandor wrote:*   

> 
> 
> Are you running wpa_gui as root?
> 
> Else i would suggest you change your wpa_supplicant.cnf to: "ctrl_interface_group=10", whre group 10 is the 'wheel' group.
> ...

 

Yes, I'm running wpa_gui as root, just tried to eliminate some possible problems. However I found the reason wpa_gui doesn't work: The wpa_supplicant service ist started (it quits as it can't connect to an acess point) and hence wpa_gui can't connect to the server. Which leads back to my original question: How can I start wpa_supplicant without connecting to an acces point...

----------

## smlgbl

HI,

i've made the changes, but now it seems like it's working in some kinda windows-style. Sometimes it works, then again it doesn't.

Maybe i'll try updating as well.

regards,

----------

## wads

 *Quote:*   

> 
> 
> I'dd give it a try. And if i was you, i'dd upgrade to the latest madwifi driver too.
> 
> Just follow the tutorial, look at http://snapshots.madwifi.org/madwifi-ng/, and change the 'MADWIFI_SVN_REV' variable to the number from the driver you want (so that would be 1367, for the latest 2005/12/29 driver), and also change to name of the ebuild to reflect the date of the driver you want to use (in this case change it to madwifi-driver-0.1_pr20051229 and madwifi-tools-0.1_pre20051229).
> ...

 

I did the upgrade and it went quite smoothly.  However, I am still unable to connect automatically with the net.ath0 script.  I'm reasonably sure that the problem is not the driver as when I switch to WEP, I can connect using iwconfig.  I'm going to stick with WEP until I can get my wireless connection up automatically and then I'll worry about WPA since I don't want to introduce unknown variables and I know that WEP should work.

I think the problem has to do with my configuration files.  Remember, these are set for WEP right now.  Maybe someone can see what's causing the problem.  (Whatever it is, I'm willing to be it's my mistake and not a problem with Gentoo or my hardware.)

/etc/conf.d/net

```

preup() {

         if [ "${IFACE}" == "ath0" ]; then

                 /sbin/wlanconfig ath0 create wlandev wifi0 wlanmode sta > /dev$

                 return $?

         fi

         if mii-tool ${IFACE} 2> /dev/null | grep -q 'no link'; then

                 ewarn "No link on ${IFACE}, aborting configuration"

                 return 1

         fi

         return 0

 }

 predown() {

         if [ "${IFACE}" == "ath0" ]; then

                 killall wpa_supplicant

                 /sbin/wlanconfig ath0 destroy

                 return $?

         fi

         return 0

 }

ifconfig_ath0=("dhcp")

modules=( "dhcp" "wpa_supplicant" )

config_ath0=( "dhcp" )

dhcpcd_ath0="-t 30"

wpa_supplicant_ath0="-Dmadwifi"

wpa_timeout_ath0=60

```

/etc/wpa_supplicant.conf

```

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

eapol_version=1

ap_scan=1

fast_reauth=1

network={

        ssid="mynet"

        key_mgmt=NONE

        wep_key0="passw"

        wep_tx_keyidx=0

}
```

----------

## Computator

After following this guide, connecting to my router kept timing out (timeout=60 sec). I just tried nerve's alternative preup an predown functions and it seems to be working now (so thanks nerve!). It's a little slower than before the kernel update, but I can live with that. Let's just hope it continues to work like this.

I'm using the madwifi revisions from this guide, but wpa_supplicant is v0.5 and I've got vanilla-sources 2.6.14.2.

Edit: added some version info.

----------

## maxalken

I have tried nerve's preup and predown functions. but I still get time out  :Crying or Very sad: 

 *Quote:*   

>  * Starting ath0
> 
>  *   Running preup function
> 
>  *     Loading module ath_hal
> ...

 

This is my /etc/conf.d/net

```
preup() {

        if [ "${IFACE}" == "ath0" ]; then

                # loading wlan modules

                for i in ath_hal wlan wlan_acl wlan_ccmp wlan_tkip wlan_wep wlan_xauth wlan_scan_sta wlan_scan_ap ath_rate_onoe ath_rate_sample ath_pci; do

                #for i in ath_pci; do

                        einfo "Loading module $i"

                        modprobe $i;

                        if [ 0 -ne $? ]; then

                                ewarn "Failed loading module $i";

                                return 1;

                        fi;

                done

                # loading succeeded

                #wlanconfig ath0 destroy >/dev/null 2>&1

                wlanconfig ath0 create wlandev wifi0 wlanmode sta > /dev/null

                return 0;

        fi

        if mii-tool ${IFACE} 2> /dev/null | grep -q 'no link'; then

                ewarn "No link on ${IFACE}, aborting configuration"

                return 1

        fi

        return 0;

}

postdown() {

        if [ "${IFACE}" == "ath0" ]; then

                wpa_cli terminate

                wlanconfig ath0 destroy

                for i in ath_pci ath_rate_sample ath_rate_onoe wlan_scan_ap wlan_scan_sta wlan_xauth wlan_wep wlan_tkip wlan_ccmp wlan_acl wlan ath_hal; do

                einfo "Unloading module $i"

                modprobe -r $i

                if [ 0 -ne $? ]; then

                        einfo "Failed unloading module $i"

                fi

                done

                return $?

        fi

        return 0

}

iface_eth0="192.168.1.20 broadcast 192.168.0.255 netmask 255.255.255.0"

gateway="eth0/192.168.0.1"

dhcpcd_eth0="-N -Y"

# madwifi setup

ifconfig_ath0=( "192.168.1.22 netmask 255.255.255.0" )

routes_ath0=( "default gw 192.168.0.1" )

modules=( "wpa_supplicant" )

wpa_supplicant_ath0="-Dmadwifi"

wpa_timeout_ath0=20
```

I can manually type wpa_supplicant -Dmadwifi -iath0 -c/etc/wpa_supplicant.conf. I think this means my /etc/wpa_supplicant.conf has no problem. I just can't use /etc/init.d/net.ath0 start to establish the connection. 

does any one know what causes this problem?

----------

## smlgbl

Hi guys,

i've noticed that i didn't follow the guide properly. Now i've changed my kernel config to not include what the tutorial says about preemption and it seems to work fine so far.

Good luck to you all.

Maybe i'll still try the upgrade within the next few days. Please keep posting your experience with that. Is the procedure to do so the same as in the tutorial or is it different?

thanks,

----------

## cajzell

I had my problem (described above) with succesful connect with no authentication, but always timeout when switching to WEP. So, I tried nerve's modified pre_up and pre_down and suddenly it all worked! Thanks nerve!

The problem I am experiencing now is very slow response when logging in over LAN on console with ssh. When I type something, it echoes a few characters, then suddenly it takes ages for the next ones to appear. Anyone have a clue what that could be? 

(NOTE: When I do the exact same thing over a physical ethernet cable, there is no lag at all, but when I switch to wireless it becomes sluggish).

----------

## smlgbl

Now i did the upgrade to wpa_supplicant 0.5.0 and to the snapshot from madwifi 20051231, but it still is wierd. Now i've managed to connect on boot, but that was the third reboot. And it didn't work before. All the time i was able to do the manual connect, but the script wouldn't work. I've also tried different versions of the preup and predown scripts.

But i don't want to be rebooting all the time just to try and see if it will work constantly now.

my configs:

/etc/wpa_supplicant.conf :

```

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

eapol_version=1

ap_scan=1

fast_reauth=1

network={

   ssid="eightonions.com"

   proto=WPA

   scan_ssid=1

   key_mgmt=WPA-PSK

   pairwise=CCMP TKIP

   group=CCMP TKIP

   psk="my secret passphrase"

   priority=2

}

```

/etc/conf.d/net :

```

config_eth0=( "192.168.77.0 netmask 255.255.255.0" )

config_ath0=( "dhcp" )

modules=( "wpa_supplicant" )

wpa_supplicant_ath0="-Dmadwifi -c/etc/wpa_supplicant.conf"

wpa_timeout_ath0=60

preup() {

        if [ "${IFACE}" == "ath0" ]; then

                # loading wlan modules

                for i in ath_hal wlan wlan_acl wlan_ccmp wlan_tkip wlan_wep wlan_xauth wlan_scan_sta wlan_scan_ap ath_rate_onoe ath_rate_sample ath_pci; do

                #for i in ath_pci; do wlan_scan_sta was there before

                        einfo "Loading module $i"

                        modprobe $i;

                        if [ 0 -ne $? ]; then

                                ewarn "Failed loading module $i";

                                return 1;

                        fi;

                done

                # loading succeeded

                #wlanconfig ath0 destroy >/dev/null 2>&1

                wlanconfig ath0 create wlandev wifi0 wlanmode sta > /dev/null

                return 0;

        fi

        if mii-tool ${IFACE} 2> /dev/null | grep -q 'no link'; then

                ewarn "No link on ${IFACE}, aborting configuration"

                return 1

        fi

        return 0;

}

postdown() {

        if [ "${IFACE}" == "ath0" ]; then

                wlanconfig ath0 destroy

                for i in ath_pci ath_rate_sample ath_rate_onoe wlan_scan_ap wlan_scan_sta wlan_xauth wlan_wep wlan_tkip wlan_ccmp wlan_acl wlan ath_hal; do

                einfo "Unloading module $i"

                modprobe -r $i

                if [ 0 -ne $? ]; then

                        einfo "Failed unloading module $i"

                fi

                done

                return $?

        fi

        return 0

}

```

All i have in /etc/conf.d/wireless is:

```

essid_ath0="eightonions.com"

```

I don't know where i could make any changes anymore. I've tried switching around the order of loading the modules, also in /etc/modules.autoload.d/kernel-2.6, or not having it load them there at all, but it didn't seem to change anything. Next i'll try unhiding my ssid, even though i don't wanna keep it at that setting.

Regards,

----------

## smlgbl

Just a quick update: It seems it is working when i have my ssid broadcasted. Don't really like that setting though. But i guess at the moment WPA should still be quite secure.

regards,

----------

## cajzell

Anyone have a clue how to test performance of the setup? Now that I have got all this working, everything is so slow (comaped to the wire setup). I cannot ssh into the machine cause its so sluggish, takes ages to echo characters, etc. Five minutes ago I tested my gallery I run under apache, it just drew out the basics of the web page and timed out. What is happening?

----------

## SiNiESTrO

Thank you guys, wonderful guide! It success on my laptop but, my kismet is K.O now.

This error result with 'source=madwifi_ag,ath0,ar5213' in kismet.conf:

```
Server options:  none

Client options:  none

Starting server...

Waiting for server to start before starting UI...

Will drop privs to siniestro (1000) gid 100

No specific sources given to be enabled, all will be enabled.

Enabling channel hopping.

Enabling channel splitting.

Source 0 (ar5213): Enabling monitor mode for madwifi_ag source interface ath0 channel 6...

FATAL: GetIFFlags: interface ath0: No such device
```

Some idea?

----------

## xmit

I prefer the overlay.tar.gz from http://dev.gentoo.org/~brix/files/overlay/.

----------

## wads

 *xmit wrote:*   

> I prefer the overlay.tar.gz from http://dev.gentoo.org/~brix/files/overlay/.

 

I still can't get my WiFi to work.  :Mad:   Did you struggle after following this guide only to have success with the above-mentioned overlay?

----------

## davids

Great guide! 

I got farther with this thread then anything else I've tried.  I have been through the instructions various times and gone through every post on this thread, but am stuck.

I can't get my ath0 up and running.  Any attempt at: 

```

# wlanconfig ath0 create wlandev wifi0 wlanmode ap > /dev/null

wlanconfig: ioctl: No such device

```

```

# wlanconfig ath0 destroy

wlanconfig: ioctl: Operation not supported

```

My dmesg reads as follows: (I have a wired connection eth0 plugged in untill I can get this working)

```
ath_hal: module license 'Proprietary' taints kernel.

ath_hal: 0.9.14.9 (AR5210, AR5211, AR5212, RF5111, RF5112, RF2413)

wlan: 0.8.4.5 (EXPERIMENTAL)

ath_rate_onoe: 1.0

ath_pci: 0.9.4.12 (EXPERIMENTAL)

ACPI: PCI Interrupt 0000:00:0b.0[A] -> GSI 19 (level, low) -> IRQ 20

ath0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps

ath0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36M                                     bps 48Mbps 54Mbps

ath0: mac 7.9 phy 4.5 radio 5.6

ath0: 802.11 address: 00:13:46:89:ca:b5

ath0: Use hw queue 0 for WME_AC_BE traffic

ath0: Use hw queue 1 for WME_AC_BK traffic

ath0: Use hw queue 2 for WME_AC_VI traffic

ath0: Use hw queue 3 for WME_AC_VO traffic

ath0: Atheros 5212: mem=0xe1010000, irq=20

kjournald starting.  Commit interval 5 seconds

EXT3 FS on hda1, internal journal

EXT3-fs: mounted filesystem with ordered data mode.

ACPI: PCI Interrupt 0000:00:09.0[A] -> GSI 17 (level, low) -> IRQ 21

ds: ds_open(socket 0)

ds: ds_open(socket 0)

ath0 (WE) : Driver using old /proc/net/wireless support, please fix driver !

eth0: link up, 100Mbps, full-duplex, lpa 0x45E1

```

It seems like I am running an old version of madwifi?

my iwconfig:

```

lo        no wireless extensions.

eth0      no wireless extensions.

ath0      IEEE 802.11  ESSID:""

          Mode:Managed  Frequency:2.412 GHz  Access Point: 00:00:00:00:00:00

          Bit Rate:0 kb/s   Tx-Power:50 dBm   Sensitivity=0/3

          Retry:off   RTS thr:off   Fragment thr:off

          Encryption key:off

          Power Management:off

          Link Quality=0/94  Signal level=-95 dBm  Nois

```

Thanks for any suggestions!

----------

## xmit

 *wads wrote:*   

>  *xmit wrote:*   I prefer the overlay.tar.gz from http://dev.gentoo.org/~brix/files/overlay/. 
> 
> I still can't get my WiFi to work.   Did you struggle after following this guide only to have success with the above-mentioned overlay?

 

No, I didn't tried this guide. Brix uses udev to create the ath0 device which is better in my opinion. It is also fairly simple to install this overlay, much more simple than following this guide. If you need assistence, let me know.

Brix is the maintainer of wpa_supplicant and to test his ebuilds and give him feedback will help him to get his work done. I guess a few more success stories and he will put his ebuilds into portage.

----------

## one_red_eye

This new driver works better than the old madwifi-driver. I used to get lots of TX and RX errors, several per minute. Its been up 48 hours and its perfect. Thanks!

----------

## 6d696b65

i am having a hard time getting through to my access point.  on start up, i just time out.  if i manually run 

```
# wpa_supplicant -dmadwifi -iath0 -c/etc/wpa_supplicant.conf
```

i get the following:

```
trying to associate with [mac] (ssid='[ssid]' freq=2462 mhz)

ioctl[unknown???]: invalid argument

association request to the driver failed

authentication with 00:00:00:00:00:00 timed out
```

in the first line, the mac and ssid are correct.  i'm still new at this, so be gentle. . .

edit:

i just ran ifconfig and noticed ath0 wasn't showing up, so i did an ifconfig ath0 up.  this added both ath0 and wifi0 to ifconfig.  i noticed wifi0 has recieved and transmitted some data.  ath0 has none.  running dhcpcd wifi0 does not trigger any card activity, using ath0 does.  i think i've narrowed my issue down to my preup() script.  i will try some things now and get back.

----------

## Fromeo

A fix was recently commited to the madwifi-ng codebase to fix ticket #74, which prevents the kernel panic that everyone using the new drivers on amd64 were experiencing.  I have it working using the r1397 snapshot with wpa_supplicant-0.4.7-r1 as described in the beginning of this thread.

----------

## DnasTheGreat

Thank you very much for writing this guide!

Finally, wireless support again.

But is there any way to get it to work with ifplugd (or something along those lines... before pcmcia or wpa_supplicant or something did the job for me without ifplugd, but now they don't)?

Because I have a wireless card for my laptop, and it is a bit annoying to have to type sudo /etc/init.d/net.ath0 start on every bootup.

----------

## rem5

 *DnasTheGreat wrote:*   

> Because I have a wireless card for my laptop, and it is a bit annoying to have to type sudo /etc/init.d/net.ath0 start on every bootup.

 

"rc-update add net.ath0 default" should do the job or is it another question ?

----------

## DnasTheGreat

IIRC, that ended up being executed before pcmcia did... although, it was a while ago before I did that. I'll see if it still does that now... or if my memory is faulty.

EDIT: Oh yeah... now I remember... the card doesn't get picked up if I boot the computer with it in... I actually have to plug in the card when pcmcia-cs has started.... so net.ath0 in rc-update wouldn't work all that well. (I'll check this, but I'm pretty sure that was the issue.)

...with the old stuff, I didn't have to ever run net.ath0... wpa_supplicant would connect as soon as ath0 was created. I think pcmcia did it... because it wasn't ifplugd that connected it and wpa_supplicant isn't (?) a daemon.

Anyway, the main point would be for it to run net.ath0 or whatever when I plug the card in, even if it's after bootup.

----------

## smlgbl

Hi,

has anybody been trying the latest madwifi-snapshots?

Any improvements?

----------

## UberLord

 *xmit wrote:*   

> I guess a few more success stories and he will put his ebuilds into portage.

 

He was waiting for me to say "it works on my amd64" as afaik that was the only holdup. A recent snapshot works, so expect something in portage in a day or two  :Smile: 

----------

## daff

 *xmit wrote:*   

> Brix uses udev to create the ath0 device which is better in my opinion. 

 

I installed Brix's overlays without any problem and compiled the latest madwifi-* as well as the latest wpa_supplicant, but I still need to use the preup and predown/postdown functions in /etc/conf.d/net. How does this work with udev? Should ath0 be created automatically by udev when the ath_pci modules is loaded (like it was in the past)? Or are there any other steps necessary?

I also seem to need to issue a dhcpcd ath0 manually after the card associated with the access point, or else I wouldn't get any interface configuration at all, not matter what I have set in /etc/conf.d/net for that particular wireless network's essid. Any ideas? Or is there not yet enough baselayout support for the new madwifi and wpa_supplicant combination?

----------

## Pandor

i just noticed the new driver in portage and checked out what the udev fuss was all about, so here it is:

```

 #cat /etc/udev/rules.d/65-madwifi.rules

# Madwifi devices

#

# See wlanconfig(8) for more information

#

# Access Point configuration

#KERNEL=="wifi[0-9]*", DRIVER=="ath_pci", ACTION=="add", RUN+="/sbin/wlanconfig ath create wlandev %k wlanmode ap"

#

# Normal station configuration

KERNEL=="wifi[0-9]*", DRIVER=="ath_pci", ACTION=="add", RUN+="/sbin/wlanconfig ath create wlandev %k wlanmode sta"

```

In my search to automate the ath device creation i had been thinking about this, but what if you unplug the card?

i don't see how ath# would get killed so wouldn't this give an error on reinserting the card (wlanconfig trying to create ath#, wich is already there, resulting in an error)?...

*edit:

---------

maybe a rule like:

```

KERNEL=="wifi[0-9]*", DRIVER=="ath_pci", ACTION=="remove", RUN+="/sbin/wlanconfig ath destroy"
```

would be in order?

don't know about the 'remove' action, haven't played around much with udev, but you get the point..

*edit2:

---------

just had a look at the wlanconfig manual:

 *Quote:*   

> 
> 
>  wlanconfig <vap> create wlandev <base device> wlanmode <mode>
> 
> <vap> can either be a full interface name (e.g. 'ath0'), or just the suffix (e.g. 'ath'), in which case, the kernel will automatically append the next vacant integer.

 So, my above assumption was incorret, because when you don't supply an integer it wil append one. But then i see another problem: It will append the next vacant integer. and since the last one is not destroyed it will just keep counting up..

Wouldn't this be more suited?:

```

KERNEL=="wifi[0-9]*", DRIVER=="ath_pci", ACTION=="add", RUN+="/sbin/wlanconfig ath0 create wlandev %k wlanmode sta"

KERNEL=="wifi[0-9]*", DRIVER=="ath_pci", ACTION=="remove", RUN+="/sbin/wlanconfig ath0 destroy"

```

----------

## Pandor

just tested the driver and it seems to alway create ath0.

I wonder how though.

ath0 is controller by wlanconfig and not the kernel module, so how can a removal of the module remove ath0?

----------

## BrightSide

Im assume that since ath0 is created from wifi0, ath0 is automagically destroyed when the wifi0 device no longer exists

----------

## smlgbl

Hi guys,

i changed the function wpa_supplicant_associated() in /lib/rcscripts/net.modules.d/wpa_supplicant to look like this:

```
wpa_supplicant_associated() {

   local -a status

   eval status=( $( wpa_cli -i"$1" status | sed -n -e 's/^\(key_mgmt\|wpa_state\|EAP state\)=\([^=]\+\).*/\U\"\2\"/p' ) )

   case "${status[0]}" in

      "WPA-PSK")      [[ ${status[1]} == "COMPLETED" ]] ;;

      "NONE")         [[ ${status[1]} == "ASSOCIATED" || ${status[1]} == "COMPLETED" ]] ;;

      "IEEE 802.1X (no WPA)")   [[ ${status[2]} == "SUCCESS" ]] ;;

      *)         [[ ${status[1]} == "COMPLETED" ]] ;;

   esac

   return $?

}

```

Before, there was no "WPA-PSK" case. Now i am back to a 20 to 30 sec timeout.

Good luck.

regards,

----------

## UberLord

 *haader wrote:*   

> Before, there was no "WPA-PSK" case.

 

You do know that * matches anything right? As WPA-PSK isn't in the list then * will catch it. And guess what, your rule for WPA-PSK is the same as *. So even though you have added code, the end result is exactly the same.

----------

## smlgbl

 *UberLord wrote:*   

>  *haader wrote:*   Before, there was no "WPA-PSK" case. 
> 
> You do know that * matches anything right? As WPA-PSK isn't in the list then * will catch it. And guess what, your rule for WPA-PSK is the same as *. So even though you have added code, the end result is exactly the same.

 

Yes, i knew that. But i thought that if it catches the first option in the "case"-statement, it might speed things up. Maybe i am wrong, but somehow it seems like it worked. But maybe i changed something else as well without remembering.

But, of course, you're right anyway.

----------

## pilla

I'm getting 

```
alloc_dev: Unable to allocate device
```

when I try to run wlanconfig on it. (madwifi-driver-0.1401.20060117). Any clue?

----------

## rem5

Hi,

I try the new ebuild and nothing better : wpa_supplicant time out (and I have set it to more than 60s)....like some of other in this thread...

I try with or without broadcasting the SSID

I switch to ndiswrapper >=1.7 and no more problem so wpa_supplicant config is right !

Have anyone any suggestion ?

edit : spell

----------

## shiggity s

 *djnauk wrote:*   

> There have been a number of problems recently for those (unlucky) few who have Atheros cards, a WPA wireless connection and have installed the latest kernel (i.e. 2.6.14 or later).

 

Does God just hate us...?    :Crying or Very sad: 

----------

## Adrien

 *shiggity s wrote:*   

> Does God just hate us...?   

 

 :Twisted Evil:   Yes he does! Trust me!!!   :Twisted Evil: 

----------

## asarazan

I just want to confirm, as things are a bit unclear after having jumped all over this thread and back again: There is no cure for the huge timeout needed to get this thing to successfully connect under the new drivers, correct? 

...seriously, that timeout is brutal.

----------

## Da Fox

I'm not experiencing that much of a time out, actually. It just takes about the same time as usual to connect and authenticate (about 10 seconds). I am using kernel 2.6.13-r3 and wpa_supplicant 0.50.

However, I am however expecting the kernel-module of being unstable, as I've been experiencing odd crashes and software failures lately. (grep segfaulting, vmware giving errors when starting windows, mplayer suddenly quitting in the middle of an avi-file, firefox closing for no reason, and then when restarting segfaulting, even complete systemhangs while I'm not doing anything (out for lunch) etc etc etc. I'm running memtest right now (almost 24h without error), so I'm reasonably sure it's not the memory.

The reason I'm suspecting madwifi is that this is the last thing that I changed.

What I would like is something like memtest86, that will test my CPU for stability problems. For now I will try a knoppix CD and see if the problems are still present then.

----------

## daff

I seem to be one of the lucky ones who got their wireless setup working again with the latest ~x86 packages (madwifi-driver, madwifi-tools and wpa_supplicant) from portage. It doesn't take THAT long to connect to the AP (about 15 to 20 seconds maybe, but I also blame that on the Netgear WGR614v4 piece of crap) and the kernel modules seem stable. 

What I do experience is that sometimes the association with the access point drops and I have to issue a /etc/init.d/net.ath0 restart to reconnect. I also blame that on the Netgear router since those association-drops happened before, too, and got really bad (disconnect every 5 minutes) until I reset the router to factory settings and installed it again. Such drops don't seem to occur under Windows, but they also don't seem to occur when I'm running Gentoo and connect to the campus WLAN at my university, so it's probably the router.

Apart from that the new madwifi drivers work fine for me! So I think there might be hope for everyone.

----------

## asarazan

I've had the same problems with netgear routers, POS's. Although I have to say I have problems with my campus AP's too, so dunno.

----------

## smlgbl

Hi guys,

i am running a 2.6.15-nitro3 kernel, the latest madwifi-snapshot and wpa_supplicant-0.5.0, all working fine here. It took a bit of fiddling, but it is working, although with a 15 - 20 second timeout. No instability complaints, no reconnects, all fine.

Sorry, but i am happy.

----------

## alexandref75

I am experiencing the same type of problems as described below with madwifi-driver-0.1401 and even trying with a new version 0.1405. I can confirm it is madwifi because reverting to madwifi-driver-0.1_pre20050420-r1 corrects all the problems.

My machine is a Dell C510, D-link DWL-G650 wireless card and kernel suspend2-source-2.6.15-r3.

 *Da Fox wrote:*   

> I'm not experiencing that much of a time out, actually. It just takes about the same time as usual to connect and authenticate (about 10 seconds). I am using kernel 2.6.13-r3 and wpa_supplicant 0.50.
> 
> However, I am however expecting the kernel-module of being unstable, as I've been experiencing odd crashes and software failures lately. (grep segfaulting, vmware giving errors when starting windows, mplayer suddenly quitting in the middle of an avi-file, firefox closing for no reason, and then when restarting segfaulting, even complete systemhangs while I'm not doing anything (out for lunch) etc etc etc. I'm running memtest right now (almost 24h without error), so I'm reasonably sure it's not the memory.
> 
> The reason I'm suspecting madwifi is that this is the last thing that I changed.
> ...

 

----------

## fintan

Just to add to this, I'm getting the same error as pilla. 

```

alloc_dev: Unable to allocate device

```

I'm using the lastest and greatest from portage. Any clues?

----------

## smlgbl

Hi,

just updated to wpa_supplicant-0.5.0-r1. Seems to be a tick faster.

----------

## NightDragon

Hi everbody, have the same problem like pilla and fintan:

 *Quote:*   

> Feb  3 16:57:33 ndragon ath_hal: 0.9.16.13 (AR5210, AR5211, AR5212, RF5111, RF5112, RF2413, RF5413, DFS)
> 
> Feb  3 16:57:33 ndragon wlan: 0.8.4.2 (Atheros/multi-bss)
> 
> Feb  3 16:57:33 ndragon ath_rate_amrr: 0.1
> ...

 

The command wlanconfig produces the last 5 errors... everytime i run it.

ath0 doesn't exist and i can't destroy the device, cause it's not existing.

Could that be a problem of the Kernel-Config?

```

Bus options (PCI, PCMCIA, EISA, MCA, ISA)  --->

               PCCARD (PCMCIA/CardBus) support  --->

                          [  ]     PCMCIA control ioctl (obsolete)

```

Cause wlanconfig reports something about an ioctl input/output error, when i try to create ath0

----------

## DevSolar

I thought I would add my experience, and a bit of an update. There's wpa_supplicant-0.4.7-r1 in the portage tree, which basically adds what the excellent guide in post #1 of this thread suggests (the madwifi USE-flag). There are newer madwifi ebuilds, which add udev rules for doing the wlanconfig bit. This makes things a good deal easier.

```

$ echo "=net-wireless/wpa_supplicant-0.4.7-r1 ~x86" >> /etc/portage/package.keywords

$ echo "net-wireless/madwifi-driver ~x86" >> /etc/portage/package.keywords

$ echo "net-wireless/madwifi-tools ~x86" >> /etc/portage/package.keywords

$ USE="madwifi" emerge wpa_supplicant

$ ln -s /etc/init.d/net.lo /etc/init.d/net.ath0

$ modprobe ath_pci

$ modprobe wlan_tkip

$ udevstart

$ cp /etc/wpa_supplicant.conf.example /etc/wpa_supplicant.conf

```

The madwifi ebuilds emerged were version 0.1401.20060117. You'll probably want to add ath_pci and wlan_tkip to /etc/modules.autoload.d/kernel-2.6 once you got it running.

The kernel is 2.6.15-gentoo-r1, with Network device support -> Wireless LAN -> Wireless LAN drivers & Wireless Extensions enabled, everything under "Kernel hacking" disabled, and everything under "Networking" on default (i.e., no "Generic IEEE 802.11 Networking Stack" enabled).

In /etc/wpa_supplicant.conf, I added (after deleting the example configs):

```

network={

    ssid="MySSID"

    psk="..."

}

```

In /etc/conf.d/net:

```

modules_ath0=( "wpa_supplicant" )

wpa_supplicant_ath0="-Dmadwifi"

wpa_timeout=60

```

After that, I was successfully online with a mere

```

$ /etc/init.d/net.ath0 start

```

That, you'll probably want to get away with by "rc-config add net.ath0 default" to get it running automatically at boot time.

That is all it took. The hardware involved was a Netgear WG311T on a 32bit Athlon system and a Fritz.box WLAN AP (using dhcp). I'll try this on a PIII laptop with a WG511T cardbus next and post the results here.

Edit: It seems the udev script installed by madwifi (65-madwifi.rules or something, I didn't write it down, sitting in the same directory as 05-udev-early-something and 50-udev-something) does not get run at startup; I have to manually call udevstart to make the ath0 interface appear. Shouldn't its presence in the rules directory suffice for it being run?

Edit2: Nevermind, there's already a thread about it.

----------

## maguro

I took a working madwifi setup, and did the stupid thing. I updated my software to the latest and greatest. Of course it doesn't work now.

I am currently using the latest software as of yesterday (Feb 9). The versions are:

Kernel: 2.6.15-gentoo-r1

madwifi-driver-0.1443.20060207

madwifi-tools--0.1443.20060207 

wpa_supplicant-0.5.1

Everything seems to be in order until wpa_supplicant attempts to associate with the AP, then it errors out.

iwconfig

```

lo        no wireless extensions.

eth0      no wireless extensions.

wifi0     no wireless extensions.

ath0      IEEE 802.11a  ESSID:"ila109MD"

          Mode:Managed  Channel:0  Access Point: Not-Associated

          Bit Rate:0 kb/s   Tx-Power:17 dBm   Sensitivity=0/3

          Retry:off   RTS thr:off   Fragment thr:off

          Encryption key:off

          Power Management:off

          Link Quality=0/94  Signal level=-95 dBm  Noise level=-95 dBm

          Rx invalid nwid:1754  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

```

wpa_supplicant -iath0 -Dmadwifi -c/etc/wpa_supplicant.conf -dd

```

Initializing interface 'ath0' conf '/etc/wpa_supplicant.conf' driver 'madwifi' ctrl_interface 'N/A'

Configuration file '/etc/wpa_supplicant.conf' -> '/etc/wpa_supplicant.conf'

Reading configuration file '/etc/wpa_supplicant.conf'

ctrl_interface='/var/run/wpa_supplicant'

ctrl_interface_group=0

eapol_version=1

ap_scan=1

fast_reauth=1

Line: 10 - start of a new network block

ssid - hexdump_ascii(len=8):

     69 6c 61 31 30 39 4d 44                           ila109MD

mode=0 (0x0)

scan_ssid=1 (0x1)

proto: 0x1

key_mgmt: 0x1

auth_alg: 0x1

eap methods - hexdump(len=16): 00 00 00 00 15 00 00 00 00 00 00 00 00 00 00 00

identity - hexdump_ascii(len=5):

     72 6f 67 65 72                                    roger

anonymous_identity - hexdump_ascii(len=9):

     61 6e 6f 6e 79 6d 6f 75 73                        anonymous

password - hexdump_ascii(len=6): [REMOVED]

ca_cert - hexdump_ascii(len=18):

     2f 65 74 63 2f 63 65 72 74 2f 72 6f 6f 74 2e 70   /etc/cert/root.p

     65 6d                                             em

phase2 - hexdump_ascii(len=9):

     61 75 74 68 3d 43 48 41 50                        auth=CHAP

priority=10 (0xa)

Line: 28 - start of a new network block

ssid - hexdump_ascii(len=6):

     61 31 61 50 30 53                                 a1aP0S

key_mgmt: 0x4

wep_key0 - hexdump(len=13): [REMOVED]

wep_key1 - hexdump(len=13): [REMOVED]

wep_tx_keyidx=0 (0x0)

auth_alg: 0x2

priority=5 (0x5)

Priority group 10

   id=0 ssid='ila109MD'

Priority group 5

   id=1 ssid='a1aP0S'

Initializing interface (2) 'ath0'

EAPOL: SUPP_PAE entering state DISCONNECTED

EAPOL: KEY_RX entering state NO_KEY_RECEIVE

EAPOL: SUPP_BE entering state INITIALIZE

EAP: EAP entering state DISABLED

EAPOL: External notification - portEnabled=0

EAPOL: External notification - portValid=0

SIOCGIWRANGE: WE(compiled)=19 WE(source)=13 enc_capa=0x0

  capabilities: key_mgmt 0x0 enc 0x3

Own MAC address: 00:20:d8:03:89:5e

wpa_driver_madwifi_del_key: keyidx=0

wpa_driver_madwifi_del_key: keyidx=1

wpa_driver_madwifi_del_key: keyidx=2

wpa_driver_madwifi_del_key: keyidx=3

wpa_driver_madwifi_set_countermeasures: enabled=0

wpa_driver_madwifi_set_drop_unencrypted: enabled=1

Setting scan request: 0 sec 100000 usec

Added interface ath0

Wireless event: cmd=0x8b06 len=8

Ignore event for foreign ifindex 5

RTM_NEWLINK, IFLA_IFNAME: Interface 'ath0' added

RTM_NEWLINK, IFLA_IFNAME: Interface 'ath0' added

State: DISCONNECTED -> SCANNING

Starting AP scan (specific SSID)

Scan SSID - hexdump_ascii(len=8):

     69 6c 61 31 30 39 4d 44                           ila109MD

Wireless event: cmd=0x8b1a len=17

Scan timeout - try to get results

Received 1146 bytes of scan results (6 BSSes)

Scan results: 6

Selecting BSS from priority group 10

0: 00:20:d8:03:8c:80 ssid='a1aP0S' wpa_ie_len=24 rsn_ie_len=0 caps=0x11

   skip - SSID mismatch

1: 00:20:d8:03:8c:80 ssid='ila109MD' wpa_ie_len=26 rsn_ie_len=0 caps=0x11

   selected based on WPA IE

Trying to associate with 00:20:d8:03:8c:80 (SSID='ila109MD' freq=5280 MHz)

Cancelling scan request

WPA: clearing own WPA/RSN IE

Automatic auth_alg selection: 0x1

Overriding auth_alg selection: 0x1

WPA: using IEEE 802.11i/D3.0

WPA: Selected cipher suites: group 8 pairwise 8 key_mgmt 1

WPA: set AP WPA IE - hexdump(len=26): dd 18 00 50 f2 01 01 00 00 50 f2 02 01 00 00 50 f2 02 01 00 00 50 f2 01 00 00

WPA: clearing AP RSN IE

WPA: using GTK TKIP

WPA: using PTK TKIP

WPA: using KEY_MGMT 802.1X

WPA: Set own WPA IE default - hexdump(len=24): dd 16 00 50 f2 01 01 00 00 50 f2 02 01 00 00 50 f2 02 01 00 00 50 f2 01

No keys have been configured - skip key clearing

wpa_driver_madwifi_set_drop_unencrypted: enabled=1

State: SCANNING -> ASSOCIATING

wpa_driver_madwifi_associate

ioctl[unknown???]: Argument list too long

Association request to the driver failed

Setting authentication timeout: 5 sec 0 usec

EAPOL: External notification - portControl=Auto

Wireless event: cmd=0x8b1a len=17

Wireless event: cmd=0x8b19 len=8

```

Does any one have an idea why the "ioctl[unknown???]: Argument list too long" error?

----------

## asarazan

I get a similar error when I try to run kismet, fyi.

----------

## daff

I seem to having some problems as well with the stability of the madwifi modules. When using madwifi-driver-0.1401.20060117 with gentoo-sources-2.6.15-r1 I thought everything was stable and it really seemed that way. Unfortunately I had to reinstall Gentoo on my laptop (the EXT-3 filesystem was failing, apparently) and from that point forward the problems started, I think.

I don't know what causes the madwifi module to crash and fail, but it is easily recognized that it crashed, just by running dmesg and seeing a lot of stack trace messages and stuff. After such a crash happens the whole system becomes quite flaky (Da Fox mentioned examples). aclocal segfaulting, firefox segfaulting, Azureus crashing and burning really badly, emerge hanging, etc. I have to reboot and everything is fine again, until the next crash of the madwifi module.

My system is very stable and running nicely when I use the wired interface and not load the madwifi modules.

I have tried several combinations of gentoo-sources-2.6.15 (r1, ..., r4) and madwifi-driver 20060117, 20060201 and 20060207 but the instabilities remain, especially (it seems) when running Azureus and downloading a torrent or two. More than once it froze the whole system (X) and I had to pull the plug. Nothing of the kind happens when I am wired to the ethernet.

I can't quite put my finger on what the real cause of these problems is but I think I'll try filing a bug report, hopefully Brix or someone else knowledgeable can point out a few ways to debug this. 

The current situation makes using madwifi and a wireless connection effectively impossible.

----------

## PaulBredbury

 *daff wrote:*   

> When using madwifi-driver-0.1401.20060117 with gentoo-sources-2.6.15-r1 I thought everything was stable and it really seemed that way.

 

madwifi-driver-0.1401.20060117 with gentoo-sources-2.6.15-r* is rock-solid for me (I don't use WPA).

----------

## asarazan

I use WEP, but up til now I had used WPA_Supplicant to connect, as it had always been better at scanning. With the new drivers though, it rarely finds an AP, and when it does, it usually times out on dhcp (with a 60 second timeout). I switched to iwconfig, however, and both scanning and dhcp are fast again.

So if anybody else has this problem, give iwconfig another try.

----------

## daff

 *PaulBredbury wrote:*   

>  *daff wrote:*   When using madwifi-driver-0.1401.20060117 with gentoo-sources-2.6.15-r1 I thought everything was stable and it really seemed that way. 
> 
> madwifi-driver-0.1401.20060117 with gentoo-sources-2.6.15-r* is rock-solid for me (I don't use WPA).

 

Could you try using Azureus and leech some torrents? I think there is a connection between the instability and the number of concurrent TCP connections coming in via the wireless interface. I don't know if this has something to do with using or not using WPA, although it certainly could. 

Da Fox and me both have the same problems when using Azureus: both the madwifi modules and Azureus would crash (don't know which one crashes first), taking with them such things as Firefox, grep, aclocal and stuff like that, or even the whole X window system. Let's see what the madwifi forums and mailing lists say.

----------

## Da Fox

I think maybe it's the Java VM that crashes (hard), and azureus just happens to die with it.

Perhaps we can test other java applications and non-java applications that make a lot of connections and see if we can make it crash / hang / die horribly   :Twisted Evil: 

PaulBredbury: Could you update to madwifi-driver-0.1443.20060207, and try with that to confirm if it is a driver problem (even though most likely it is)?

----------

## daff

Just to reiterate: running Azureus and being connected via a wired interface doesn't crash a thing. Only when running wirelessly. 

To check how Azureus (or any other Java application for that matter?) crashes it is best to run it from a terminal and then notice the error message about the VM failure. After that check dmesg and see lots of output concerning the wlan modules (not just madwifi) having crashed (stack trace and whatnot). And after that, for the sake of the system, reboot the computer cleanly  :Smile: 

----------

## pilla

I've got wpa_supplicant to work with madwifi-ng:

net-wireless/madwifi-driver-0.1443.20060207

net-wireless/madwifi-tools-0.1443.20060207

net-wireless/wpa_supplicant-0.5.1

sys-apps/baselayout-1.11.14-r3

sys-kernel/suspend2-sources-2.6.15-r6

The trick that I've missed was to pass an option to ath_pci to generate automatically an interface in the station mode. The option is 

```

autocreate=sta

```

(You can autocreate other kinds of default interfaces, but it's all described into the madwifi docs)

I've added this to my /etc/modules.d/ath_pci, run modules-update and reloaded the thing

```

options ath_pci autocreate=sta

```

Of course, you still have to setup the whole thing in wpa_supplicant.conf, net, and wireless, but the other posts cover this well.

I apologize if this has been said before.

edit: funny enough, this seems to be the default option for that module   :Embarassed: 

----------

## fintan

I've the same setup

net-wireless/madwifi-driver-0.1443.20060207

net-wireless/madwifi-tools-0.1443.20060207

net-wireless/wpa_supplicant-0.5.1

sys-apps/baselayout-1.11.14-r3 

but wpa_supplicant refuses to start. 

```

wpa_supplicant has exited unexpectedly.

```

It times out from the command line with

```

Authentication with 00:00:00:00:00:00 timed out.

```

Anyone have any ideas? Thanks

----------

## pilla

fintan, does it work if you disable WPA and use it with key management as NONE?

----------

## fintan

It was working yesterday. Couldn't start it from the rc scripts though. How do you disable WPA?

----------

## pilla

You must disable WPA in your AP, and then edit /etc/wpa_supplicant.conf, comment the psk line and add         

```

key_mgmt=NONE

```

----------

## fintan

Here's the output from 

wpa_supplicant -Dmadwifi -iath0 -c/etc/wpa_supplicant/wpa_supplicant.conf -dd

```

Initializing interface 'ath0' conf '/etc/wpa_supplicant/wpa_supplicant.conf' driver 'madwifi' ctrl_interface 'N/A'

Configuration file '/etc/wpa_supplicant/wpa_supplicant.conf' -> '/etc/wpa_supplicant/wpa_supplicant.conf'

Reading configuration file '/etc/wpa_supplicant/wpa_supplicant.conf'

ctrl_interface='/var/run/wpa_supplicant'

ctrl_interface_group=440

ap_scan=2

opensc_engine_path='/usr/lib/opensc/engine_opensc.so'

pkcs11_engine_path='/usr/lib/opensc/engine_pkcs11.so'

pkcs11_module_path='/usr/lib/pkcs11/opensc-pkcs11.so'

update_config=1

Line: 9 - start of a new network block

ssid - hexdump_ascii(len=8):

     77 69 72 65 6c 65 73 73                           wireless

proto: 0x1

key_mgmt: 0x1

pairwise: 0x8

group: 0xe

eap methods - hexdump(len=16): 00 00 00 00 ff 00 00 00 00 00 00 00 00 00 00 00

identity - hexdump_ascii(len=0):

password - hexdump_ascii(len=0): [REMOVED]

ca_cert - hexdump_ascii(len=0):

disabled=1 (0x1)

Line: 22 - start of a new network block

ssid - hexdump_ascii(len=8):

     48 65 6c 70 64 65 73 6b                           Helpdesk

PSK (ASCII passphrase) - hexdump_ascii(len=8): [REMOVED]

proto: 0x1

key_mgmt: 0x4

pairwise: 0x8

PSK (from passphrase) - hexdump(len=32): [REMOVED]

Line 28: removed CCMP from group cipher list since it was not allowed for pairwise cipher

Priority group 0

   id=0 ssid='wireless'

   id=1 ssid='Helpdesk'

Initializing interface (2) 'ath0'

ENGINE: Loading dynamic engine

ENGINE: Loading OpenSC Engine from /usr/lib/opensc/engine_opensc.so

ENGINE: 'SO_PATH' '/usr/lib/opensc/engine_opensc.so'

ENGINE: 'ID' 'opensc'

ENGINE: 'LIST_ADD' '1'

ENGINE: 'LOAD' '(null)'

ENGINE: Loading pkcs11 Engine from /usr/lib/opensc/engine_pkcs11.so

ENGINE: 'SO_PATH' '/usr/lib/opensc/engine_pkcs11.so'

ENGINE: 'ID' 'pkcs11'

ENGINE: 'LIST_ADD' '1'

ENGINE: 'LOAD' '(null)'

ENGINE: 'MODULE_PATH' '/usr/lib/pkcs11/opensc-pkcs11.so'

EAPOL: SUPP_PAE entering state DISCONNECTED

EAPOL: KEY_RX entering state NO_KEY_RECEIVE

EAPOL: SUPP_BE entering state INITIALIZE

EAP: EAP entering state DISABLED

EAPOL: External notification - portEnabled=0

EAPOL: External notification - portValid=0

SIOCGIWRANGE: WE(compiled)=19 WE(source)=13 enc_capa=0x0

  capabilities: key_mgmt 0x0 enc 0x3

Own MAC address: 00:0b:6b:37:8e:74

wpa_driver_madwifi_del_key: keyidx=0

wpa_driver_madwifi_del_key: keyidx=1

wpa_driver_madwifi_del_key: keyidx=2

wpa_driver_madwifi_del_key: keyidx=3

wpa_driver_madwifi_set_countermeasures: enabled=0

wpa_driver_madwifi_set_drop_unencrypted: enabled=1

Setting scan request: 0 sec 100000 usec

Added interface ath0

Wireless event: cmd=0x8b06 len=8

Ignore event for foreign ifindex 6

RTM_NEWLINK, IFLA_IFNAME: Interface 'ath0' added

RTM_NEWLINK, IFLA_IFNAME: Interface 'ath0' added

State: DISCONNECTED -> SCANNING

Trying to associate with SSID 'Helpdesk'

Cancelling scan request

WPA: clearing own WPA/RSN IE

Automatic auth_alg selection: 0x1

WPA: clearing AP WPA IE

WPA: clearing AP RSN IE

WPA: clearing own WPA/RSN IE

No keys have been configured - skip key clearing

wpa_driver_madwifi_set_drop_unencrypted: enabled=0

State: SCANNING -> ASSOCIATING

wpa_driver_madwifi_associate

Setting authentication timeout: 60 sec 0 usec

EAPOL: External notification - portControl=ForceAuthorized

Wireless event: cmd=0x8b1a len=17

CTRL_IFACE monitor attached - hexdump(len=24): 2f 74 6d 70 2f 77 70 61 5f 63 74 72 6c 5f 31 37 34 34 31 2d 31 00 ec 6e

RX ctrl_iface - hexdump_ascii(len=6):

     53 54 41 54 55 53                                 STATUS

ioctl[SIOCGIFADDR]: Cannot assign requested address

RX ctrl_iface - hexdump_ascii(len=13):

     4c 49 53 54 5f 4e 45 54 57 4f 52 4b 53            LIST_NETWORKS

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=6):

     53 54 41 54 55 53                                 STATUS

ioctl[SIOCGIFADDR]: Cannot assign requested address

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=6):

     53 54 41 54 55 53                                 STATUS

ioctl[SIOCGIFADDR]: Cannot assign requested address

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=6):

     53 54 41 54 55 53                                 STATUS

ioctl[SIOCGIFADDR]: Cannot assign requested address

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=6):

     53 54 41 54 55 53                                 STATUS

ioctl[SIOCGIFADDR]: Cannot assign requested address

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=6):

     53 54 41 54 55 53                                 STATUS

ioctl[SIOCGIFADDR]: Cannot assign requested address

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

Wireless event: cmd=0x8b1a len=17

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

RX ctrl_iface - hexdump_ascii(len=4):

     50 49 4e 47                                       PING

```

I upgraded the basylayout yesterday. Gona try reverting and see what happens. I can't disable WPA in my AP. It's for work.

----------

## fintan

I've tried different baselayouts with the same effect. When I scan for any AP's I'm getting nothing. Anyone?

----------

## cgmd

I'm switching from a prior pcmcia card requiring ndiswrapper and a windows driver. I now have a netgear WG511T and, after emerging madwifi-driver and madwifi-tools, have tried to follow this thread to get the card working. Unfortunately, I can't get wpa_supplicant to see the madwifi driver:

```
drivers:

  hostap = Host AP driver (Intersil Prism2/2.5/3)

  prism54 = Prism54.org driver (Intersil Prism GT/Duette/Indigo)

  atmel = ATMEL AT76C5XXx (USB, PCMCIA)

  wext = Linux wireless extensions (generic)

  ndiswrapper = Linux ndiswrapper

  ipw = Intel ipw2100/2200 driver

  wired = wpa_supplicant wired Ethernet driver
```

What might I have failed to do for this to happen?? How should I correct it?

Thanks!

----------

## daff

Using wpa_supplicant-0.5.2 with the madwifi USE-flag enabled and the latest madwifi-driver and -tools-0.1485.20060325 should work just fine. A recent kernel assumed of course. Also never forget to reemerge wpa_supplicant after you updated the madwifi-drivers.

----------

## cgmd

daff wrote: *Quote:*   

> Using wpa_supplicant-0.5.2 with the madwifi USE-flag enabled...

 

Thanks so much! That worked to get the madwifi driver listed!   :Smile: 

After reboot, I now get: 

```
iwconfig         

eth0      no wireless extensions.

                                

lo        no wireless extensions.

                                

wifi0     no wireless extensions.

                                

ath0      IEEE 802.11g  ESSID:""  

          Mode:Managed  Channel:0  Access Point: Not-Associated   

          Bit Rate:0 kb/s   Tx-Power:19 dBm   Sensitivity=0/3  

          Retry:off   RTS thr:off   Fragment thr:off

          Encryption key:off    

          Power Management:off  

          Link Quality=0/94  Signal level=-95 dBm  Noise level=-95 dBm

          Rx invalid nwid:6448  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

                                

```

Access Point: Not-Associated--> Why?

I also get: 

```
cgmd # ifconfig

ath0      Link encap:Ethernet  HWaddr 00:14:6C:03:CD:DA  

          UP BROADCAST MULTICAST  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:100 errors:0 dropped:0 overruns:0 frame:0

          TX packets:100 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:5000 (4.8 Kb)  TX bytes:5000 (4.8 Kb)

wifi0     Link encap:Ethernet  HWaddr 00:14:6C:03:CD:DA  

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:6572 errors:0 dropped:0 overruns:0 frame:10598

          TX packets:639 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:199 

          RX bytes:581434 (567.8 Kb)  TX bytes:29403 (28.7 Kb)

          Interrupt:11 Memory:d1560000-d1570000 

```

Why no inet addr line for ath0 or wifi0??

I'm a bit confused as to how these things should be!  :Confused: 

Some additional help would be very much appreciated...   :Very Happy: 

----------

## daff

Do you have reasonable settings in /etc/conf.d/net? Do you have an /etc/init.d/net.ath0 script? Check the wireless network section in the Gentoo network configuration guide.

----------

## cgmd

I have incorporated the script suggested by djnauk into my /etc/conf.d/net. 

Regarding wpa_supplicant.conf, I'm confused as to where that file belongs... /etc/wpa_supplicant.conf or /etc/wpa_supplicant/wpa_supplicant.conf (the emerge instructions from portage indicated the latter). 

Also, in editing wpa_supplicant.conf, I have all the necessary elements as described in the tutorial, but I don't understand if I am to choose a single one of the examples to use (e.g. Simple case:) or if I use all the choices to try to "cover all bases" as I move my laptop from location to location??

Any suggestions?

Thanks, again!

----------

## daff

With the new madwifi-drivers you don't need any script in /etc/conf.d/net anymore. It all works out of the box as far as loading the module, creating the interface, etc. is concerned.

My configuration looks like this, you may find it useful:

/etc/conf.d/net:

```

config_eth0=( "dhcp" )

modules_ath0=( "wpa_supplicant" )

wpa_supplicant_ath0="-Dmadwifi"

preferred_aps=( "essid1" "essid2" "essid3" "essid4" )

associate_order="forcepreferredonly"

mode_ath0="managed"

config_essid1=( "dhcp" )

config_essid2=( "dhcp" )

config_essid3=( "dhcp" )

config_essid4=( "dhcp" )

```

/etc/wpa_supplicant.conf:

```

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

# Campus WLAN non-encrypted

network={

        ssid="essid1"

        scan_ssid=1

        key_mgmt=NONE

        priority=3

}

# Home WPA-PSK encrypted

network={

        proto=WPA

        ssid="essid2"

        key_mgmt=WPA-PSK

        pairwise=TKIP

        group=TKIP

        psk="myverysecretkeyphrase"

        priority=5

}

# Non-encrypted WLAN

network={

        ssid="essid3"

        scan_ssid=0

        key_mgmt=NONE

        priority=3

}

# WEP encrypted WLAN

network={

        ssid="essid4"

        scan_ssid=0

        key_mgmt=NONE

        wep_key0=hex_wep_key

        wep_key1=hex_wep_key

        wep_key2=hex_wep_key

        wep_key3=hex_wep_key

        wep_tx_keyidx=0

}

```

That should be all there is. Provided the components work well together. The WLAN with essid4 in the above configuration for example uses some POS Netgear router with 128bit WEP where I just can't connect to. Don't know if this a problem with WEP itself, a hardware incompatibility or something else.

You shouldn't rely on WEP anyway if you have alternatives.

----------

## Gergan Penkov

Well, is there any possibility to make WEP work?

I have lost probably two days with this sh.t   :Mad: 

First I have bought a d-link g520 card, which was listed as working perfectly well with madwifi, simply to make this painless. 

After two days of futile tinkering (yes I know wep is not secure, but I don't have a choice), I have installed ndiswrapper and all worked from the first moment.

Now if this is called native support   :Evil or Very Mad: 

I'm simply mad at atheros and all the others, for their negligent attitude towards the foss-community.

----------

## cgmd

daff wrote: *Quote:*   

> My configuration looks like this, you may find it useful:
> 
> 

 

Very helpful... Thanks!

... However, although I am now able to connect to my home wlan using WPA-PSK, there is one remaining glitch... ath0 doesn't grab an IP during boot, and after boot I must run:

```
# dhcpcd ath0
```

As a consequence, ntp-client, which needs net access, is also not started during boot and must then be started manually.   :Sad: 

What alternatives are there to make ath0 gain net access during the boot process (after eth0 fails...e.g.when there is no hard wired connection)? 

In summary, if I have only a wifi environment in which to work, and I boot my laptop... it fails to achieve net access, and I must manually run dhcpcd ath0. Then I am also able to manually start ntp-client.

Adding "dhcpcd ath0" and "/etc/init.d/ntp-client to /etc/conf.d/local.start is a work-around, suggested elsewhere... I'm curious, though, if there is a "cleaner" solution??

How do others, using ath0, deal with this issue?? Anyone have suggestions about resolving this??

Thanks, once again, this thread has been very helpful!   :Very Happy: 

----------

## erik258

I believe you can do this very thing by editing /etc/conf.d/net

I just did a new install on a computer and i found that no configuration yields dhcp on that interface.  

what does your /etc/conf.d/net look like?

----------

## cgmd

My /etc/conf.d/net is a modification of the example offered a few posts above by daff:

```
config_eth0=( "dhcp" )

dhcpcd_eth0="-t 10"

modules_ath0=( "wpa_supplicant" )

wpa_supplicant_ath0="-Dmadwifi"

wpa_timeout_ath0=60

preferred_aps=( "my_ssid" "essid2" "essid3" "essid4" )    #"my_ssid" is the ssid of my home lan

associate_order="forcepreferredonly"

mode_ath0="managed"

config_myssid=( "dhcp" )

config_essid2=( "dhcp" )
```

I don't yet understand some of the lines it uses, but in conjunction with a modification of the wpa_supplicant.conf that daff presented in that same post, I was able, at last, to connect to "my_ssid" using WPA_PSK. My current evolving wpa_supplicant.conf:

```
ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

eapol_version=1

ap_scan=1

fast_reauth=1

# Home WLAN: WPA-PSK, PSK as an ASCII passphrase, allow all valid ciphers

network={

        proto=WPA

        ssid="my_ssid"

        scan_ssid=0

        key_mgmt=WPA-PSK

        pairwise=TKIP

        group=TKIP

        psk="my_private_key"

        priority=5

}

# Non-encrypted WLAN: eg my public WLAN at work... This isn't yet working!

network={

        ssid="essid2"

        scan_ssid=1

        key_mgmt=NONE

        priority=5

}

```

...For whatever it's worth, this works for my secured home environment, but not for my unsecured work environment.   :Confused: 

Thanks, again, for your comments!

----------

## erik258

 *Quote:*   

> but not for my unsecured work environment.

 

 *Quote:*   

> associate_order="forcepreferredonly" 

 

could that be why?

----------

## cgmd

You may be correct... I was trying to set up wpa_supplicant to first look for "my_ssid" (my home WPA-PSK wlan), then to search at work (or anywhere else with an available unsecure public wlan), for the strongest available AP in that location.

I think my wpa_supplicant.conf needs different wording if it is to work with:

```
associate_order="forcepreferredonly"

```

I'll tinker with that setting when I'm back in the work environment, tomorrow...

Thanks, for the suggestion.   :Smile: 

----------

## erik258

maybe you just need to add your work id to the list, consider taking out the fake-looking ones if they don't need to be there for your purposes.

----------

## cgmd

 *Quote:*   

> maybe you just need to add your work id to the list, consider taking out the fake-looking ones if they don't need to be there for your purposes.

 

I'll try that...  but, then, how would I construct a generic listing for use in public places other than "home" or "work" (e.g.  @airport or @starbucks, etc.)?

----------

## erik258

try 'any' . many access points, like mine, are set to accept that essid.  That way people can effectively roam, i guess.

from http://de.pastebin.ca/17859

 *Quote:*   

> # preferred_aps=( "ESSID1" "ESSID2" )

 

maybe you should just use that instead.  You will use your preffered access points if available, but if not, you can still scan.

from the same document (line 212), 

 *Quote:*   

> #
> 
> # "forcepreferredonly" means it forceably connects to the APs in order and does not bother
> 
> #
> ...

 

there's actually a lot of nice configuration stuff there that you might be interested in.

hope that's the clue you need : )

----------

## cgmd

Adding my work ssid to /etc/conf.d/net and also to wpa_supplicant.conf has indeed solved the problem of wlan access at work... 

Thanks for pointing me in that direction!

----------

## blubbi

Hi all,

Now i followed this thread to the end, but still NoGo here after I synced today und upgraded to the -ng stuff.

The network-card starts to blink as usual when wpa_supplicant is startet but than it gets "timed out".

I'll try to post all relevant stuff and hopfully someone can help me out...

Ethernet PCI (on the Laptop PCMCIA) card

```

03:00.0 Ethernet controller: Atheros Communications, Inc. AR5212 802.11abg NIC (rev 01)

(Netgear WG511T)
```

Wireless components installed

```

net-wireless/madwifi-ng-0.1485.20060325

net-wireless/madwifi-ng-tools-0.1485.20060325

net-wireless/wpa_supplicant-0.5.2

```

/etc/modules.d/ath_pci

```
options ath_pci autocreate=sta
```

/etc/conf.d/net

```

#

#Wireless

#

modules=( "dhcp" "wpa_supplicant" )

wpa_supplicant_ath0="-Dmadwifi"

preferred_aps=( "MyLan" )

associate_order="forcepreferredonly"

mode_ath0="managed"

config_MyLan=( "dhcp" )

fallback_ath0=( "10.0.123.124 broadcast 10.0.123.255 netmask 255.255.255.0" )

fallback_route_ath0=( "default via 10.0.123.2" )

```

/etc/wpa_supplicant.conf 

```

update_config=1

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=wheel

eapol_version=1

ap_scan=1

fast_reauth=1

# Home WPA-PSK encrypted

network={

        proto=WPA

        ssid="MyLan"

        scan_ssid=1

        key_mgmt=WPA-PSK

        pairwise=TKIP

        group=TKIP

        psk="mysecretpassword"

        priority=5

}
```

```

/etc/init.d/net.ath0 restart

 * Caching service dependencies ...                                                                 [ ok ]

 * Starting ath0

 *   Starting wpa_supplicant on ath0 ...                                                            [ ok ]

            *     timed out                                                                                    [ !! ]

```

regards

blubbi

----------

## uxbod

Interesting thread as I am experiencing similar problems under X86_64 https://forums.gentoo.org/viewtopic-t-454296.html?sid=86283a867b040c626664cb6c72065e9a

will try some of the module options out tomorrow.

----------

## jkomar

 *blubbi wrote:*   

> Hi all,
> 
> Now i followed this thread to the end, but still NoGo here after I synced today und upgraded to the -ng stuff.
> 
> The network-card starts to blink as usual when wpa_supplicant is startet but than it gets "timed out".

 

I had this same issue after doing emerge -uavD world. I don't know if it's the same for you, but for me it was actually related to a bash upgrade that seems to affect wpa_supplicant. A small file modification fixed it for me.

See the following thread:

https://forums.gentoo.org/viewtopic-t-454141-highlight-wpasupplicant.html

Cheers,

Jason

----------

## blubbi

Thanks for the link, indeed, it was the baselayout update.

And as written in the link you provided

changing the line in /lib/rcscripts/net.modules.d/wpa_supplicant (wpa_supplicant_associated() ) to 

```
 local -a status 

 eval status=( "$( wpa_cli -i${1} status | awk -F= '/^key_mgmt|^wpa_state|^EAP state/ { print "\""$2"\"" }' )" ) 
```

worked for me.

Thx a lot!

regards blubbi

----------

