# wpa_supplicant and madwifi

## markandrew

i've practically now got my wireless connection working using madwifi and wpa_supplicant - to the point where, starting the interfaces and scripts manually i've managed to get the connection working twice, albeit only for a short period. but no matter what i try, i cannot get my wireless working using the gentoo init scripts alone (i'm trying by using /etc/init.d/wpa_supplicant which in turn calls init.d/net.ath0), and when i manage to get the connection up manually, it drops again after a few seconds. 

getting the interface 'up' is no problem:

```

 Link encap:Ethernet  HWaddr 00:05:4E:43:7A:C3  

          inet addr:192.168.2.3  Bcast:192.168.2.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:199 

          RX bytes:4686 (4.5 Kb)  TX bytes:11456 (11.1 Kb)

          Interrupt:11 Memory:f90c0000-f90d0000 

```

but actually getting data across it is another matter. the wpa handshake seems to go smoothly enough, but even if dhcpcd allocates an IP address, trying to send a ping over the connection just results in a long fruitless wait. and then after a few seconds wpa_supplicant gets bored of being connected, disconnects itself, and starts over. on the two occasions i managed to successfully use the connection, it dropped again after about  3 seconds, due to the wpa_supplicant deciding to restart everything.

can anyone give me a pointer? i'm using the latest baselayout and drivers, and everything works fine in windows so the hardware is ok.

----------

## UberLord

ensure that conf.d/net disables iwconfig support

modules=( "!iwconfig" )

If you then get an error about essidnet missing a function then delete essidnet from /lib/rcscripts/net.modules.d

For more details,  see bug #73607

----------

## markandrew

i have the !iwconfig line in my config already - i just added 'essidnet' to the same line to get rid of essidnet. makes no difference  :Sad:  i'll try removing essidnet from modules.d to make sure, though

the problem seems to be that wpa_supplicant restarts itself every 3 seconds

----------

## markandrew

at first that seemed to work - tried running things manually and voila! the connection works.

then i tried it with the scripts, it failed, and now it won't work at all. manually or otherwise.

with init scripts:

```

root@zen markho # /etc/init.d/net.ath0 start

 * Starting wpa_supplicant ...

 *  ath0 ...

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

Priority group 2

   id=0 ssid='firenze2'

Daemonize..                                                               [ ok ]

 * Configuring wireless network for ath0 ...

 * Scanning for access points

 * Found firenze2

 * Connecting to firenze2                                                 [ ok ]

 * Bringing ath0 up ...

 * Failed to bring ath0 up                                                [ !! ]

```

and manually:

```

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

Trying to associate with 00:30:f1:ec:c3:5f (SSID='firenze2' freq=2462 MHz)

WPA: Key negotiation completed with 00:30:f1:ec:c3:5f

Trying to associate with 00:30:f1:ec:c3:5f (SSID='firenze2' freq=2462 MHz)

WPA: Key negotiation completed with 00:30:f1:ec:c3:5f

Trying to associate with 00:30:f1:ec:c3:5f (SSID='firenze2' freq=2462 MHz)

WPA: Key negotiation completed with 00:30:f1:ec:c3:5f

Trying to associate with 00:30:f1:ec:c3:5f (SSID='firenze2' freq=2462 MHz)

WPA: Key negotiation completed with 00:30:f1:ec:c3:5f

Trying to associate with 00:30:f1:ec:c3:5f (SSID='firenze2' freq=2462 MHz)

WPA: Key negotiation completed with 00:30:f1:ec:c3:5f

```

 :Sad: 

the time it worked, the key negotiation was done only once.

----------

## UberLord

 *markandrew wrote:*   

> 
> 
> ```
> 
>  * Configuring wireless network for ath0 ...
> ...

 

That shows the the iwconfig module is still running.

You could try removing that module from /lib/rcscripts/net.modules.d as well if you need too

----------

## markandrew

now when i try the scripts they don't give any errors, but they don't work, either:

```

root@zen markho # /etc/init.d/wpa_supplicant restart

 * Stopping wpa_supplicant ...                                            [ ok ]

 * Starting wpa_supplicant ...

 *  ath0 ...

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

Priority group 2

   id=0 ssid='firenze2'

Daemonize..                                                               [ ok ]

root@zen markho # ping www.google.com

ping: unknown host www.google.com

```

```

root@zen markho # /etc/init.d/net.ath0 start

 * Configuring wireless network for ath0 ...

 * Scanning for access points

 * Found firenze2

 * Connecting to firenze2                                                 [ ok ]

 * Bringing ath0 up ...                                                   [ ok ]

root@zen markho # ping www.google.com

ping: unknown host www.google.com

```

----------

## UberLord

Could you ensure that net.ath0 is a symlink to net.lo? I'm thinking that net.ath0 is a seperate script with built in wireless ..... which means that the !iwconfig module line will not work

----------

## markandrew

now it's all gone pera-shaped. running the wpa_supplicant as the init script worked twice, and now my machine is going mad:

```

top - 12:57:57 up 17:15,  7 users,  load average: 6.41, 4.44, 2.46

Tasks:  96 total,   2 running,  94 sleeping,   0 stopped,   0 zombie

Cpu(s):  5.0% us,  1.0% sy,  0.0% ni, 93.2% id,  0.4% wa,  0.1% hi,  0.2% si

Mem:   1034372k total,   922032k used,   112340k free,   340936k buffers

Swap:   982760k total,        0k used,   982760k free,   339420k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND           

21472 root      25  -5  1712  752 1300 R 19.1  0.1   0:00.10 modprobe           

21392 root      19  -5  2732 1568 2140 S  9.5  0.2   0:00.17 runscript.sh       

21407 root      20   0  2004  984 1796 R  1.9  0.1   0:00.01 top               

```

and i can't stop it - every time i try to stop wpa_supplicant it refuses as the modules won't unload, and when i manage to rmmod the modules, a minute later they're back in the kernel and running amock again. here's what /var/log/messages keeps spewing out (the same thing all the time, not just for the current madness)

```

Dec  9 12:59:26 zen ath_pci: 0.9.4.6 (EXPERIMENTAL)

Dec  9 12:59:26 zen PCI: Found IRQ 11 for device 0000:02:02.0

Dec  9 12:59:26 zen PCI: Sharing IRQ 11 with 0000:00:1d.2

Dec  9 12:59:26 zen PCI: Sharing IRQ 11 with 0000:00:1f.1

Dec  9 12:59:26 zen rc-scripts: No Access Points found for ath0

Dec  9 12:59:26 zen rc-scripts: Failed to configure wireless for ath0

Dec  9 12:59:26 zen ath0: 11a rates: 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps

Dec  9 12:59:26 zen ath0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps

Dec  9 12:59:26 zen ath0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps

Dec  9 12:59:26 zen ath0: mac 5.6 phy 4.1 5ghz radio 1.7 2ghz radio 2.3

Dec  9 12:59:26 zen ath0: 802.11 address: 00:05:4e:43:7a:c3

Dec  9 12:59:26 zen ath0: Use hw queue 0 for WME_AC_BE traffic

Dec  9 12:59:26 zen ath0: Use hw queue 1 for WME_AC_BK traffic

Dec  9 12:59:26 zen ath0: Use hw queue 2 for WME_AC_VI traffic

Dec  9 12:59:26 zen ath0: Use hw queue 3 for WME_AC_VO traffic

Dec  9 12:59:26 zen ath0: Atheros 5212: mem=0xc0210000, irq=11

Dec  9 12:59:27 zen ath_pci: driver unloaded

Dec  9 12:59:27 zen ath_hal: driver unloaded

Dec  9 12:59:27 zen ath_hal: 0.9.12.5

Dec  9 12:59:27 zen ath_pci: Unknown parameter `ath_hal'

Dec  9 12:59:27 zen ath_pci: 0.9.4.6 (EXPERIMENTAL)

Dec  9 12:59:27 zen PCI: Found IRQ 11 for device 0000:02:02.0

Dec  9 12:59:27 zen PCI: Sharing IRQ 11 with 0000:00:1d.2

Dec  9 12:59:27 zen PCI: Sharing IRQ 11 with 0000:00:1f.1

Dec  9 12:59:27 zen rc-scripts: No Access Points found for ath0

Dec  9 12:59:27 zen rc-scripts: Failed to configure wireless for ath0

Dec  9 12:59:27 zen ath0: 11a rates: 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps

Dec  9 12:59:27 zen ath0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps

Dec  9 12:59:27 zen ath0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps

Dec  9 12:59:27 zen ath0: mac 5.6 phy 4.1 5ghz radio 1.7 2ghz radio 2.3

Dec  9 12:59:27 zen ath0: 802.11 address: 00:05:4e:43:7a:c3

Dec  9 12:59:27 zen ath0: Use hw queue 0 for WME_AC_BE traffic

Dec  9 12:59:27 zen ath0: Use hw queue 1 for WME_AC_BK traffic

Dec  9 12:59:27 zen ath0: Use hw queue 2 for WME_AC_VI traffic

Dec  9 12:59:27 zen ath0: Use hw queue 3 for WME_AC_VO traffic

Dec  9 12:59:27 zen ath0: Atheros 5212: mem=0xc0210000, irq=11

Dec  9 12:59:28 zen ath_pci: driver unloaded

Dec  9 12:59:28 zen ath_hal: driver unloaded

Dec  9 12:59:28 zen ath_hal: 0.9.12.5

Dec  9 12:59:28 zen ath_pci: Unknown parameter `ath_hal'

Dec  9 12:59:28 zen ath_pci: 0.9.4.6 (EXPERIMENTAL)

Dec  9 12:59:28 zen PCI: Found IRQ 11 for device 0000:02:02.0

Dec  9 12:59:28 zen PCI: Sharing IRQ 11 with 0000:00:1d.2

Dec  9 12:59:28 zen PCI: Sharing IRQ 11 with 0000:00:1f.1

Dec  9 12:59:28 zen rc-scripts: No Access Points found for ath0

Dec  9 12:59:28 zen rc-scripts: Failed to configure wireless for ath0

```

the 2 times i got it working just now i ran the wpa_supplicant init script, and then ran 'dhcpcd ath0' manually to get an IP address. but it only worked twice.

*sigh*

----------

## markandrew

net.ath0 is indeed it's own script. i'll replace with a link and try again. thanks

----------

## markandrew

no, doesn't work:

```

root@zen markho # ls -l /etc/init.d/net*

lrwxrwxrwx  1 root root    18 Dec  9 13:05 /etc/init.d/net.ath0 -> /etc/init.d/net.lo

lrwxrwxrwx  1 root root     6 Dec  8 19:51 /etc/init.d/net.eth0 -> net.lo

root@zen markho # /etc/init.d/net.ath0 start

 * Re-caching dependency info (mtimes differ)...

 * Starting ath0

 *    Bringing up ath0

 *       dhcp

 *          ath0 does not exist                                           [ !! ]

root@zen markho # /etc/init.d/wpa_supplicant start

 * Starting wpa_supplicant ...

 *  ath0 ...

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

Priority group 2

   id=0 ssid='firenze2'

Daemonize..                                                               [ ok ]

root@zen markho # ifconfig 

ath0      Link encap:Ethernet  HWaddr 00:05:4E:43:7A:C3  

          UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:199 

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

          Interrupt:11 Memory:f90c0000-f90d0000 

root@zen markho # dhcpcd ath0 -d

dhcpcd: MAC address = 00:05:4e:43:7a:c3

root@zen markho # ping www.google.com

ping: unknown host www.google.com

```

and here's messages again:

```

Dec  9 13:07:08 zen rc-scripts: WARNING:  "net.ath0" has already been started.

Dec  9 13:07:13 zen dhcpcd[20341]: recvfrom: Network is down

Dec  9 13:07:13 zen rc-scripts: WARNING:  "net.ath0" has already been started.

Dec  9 13:07:26 zen dhcpcd[20993]: recvfrom: Network is down

Dec  9 13:07:47 zen dhcpcd[21732]: infinite IP address lease time. Exiting

Dec  9 13:07:48 zen dhcpcd[21387]: timed out waiting for a valid DHCP server response

Dec  9 13:08:04 zen dhcpcd[22040]: infinite IP address lease time. Exiting

Dec  9 13:08:22 zen dhcpcd[22713]: infinite IP address lease time. Exiting

Dec  9 13:08:22 zen dhcpcd[22712]: dhcpConfig: ioctl SIOCADDRT: File exists

Dec  9 13:08:22 zen dhcpcd[22712]: infinite IP address lease time. Exiting

```

----------

## UberLord

You do know that you have to start wpa_supplicant *before* net.ath0 yes?

And if that fails, I recommend rebooting your box

----------

## markandrew

i've tried it before, after and during. i've tried adding it to the preup function of conf.d/net. i've added 'provide wpa' to the wpa scrit and 'need wpa' to the ath0 script. i've tried running wpa manually and starting ath0 with the init scripts and manually... i've tried every permutation i can think of, and i've only got a working connection 4 times in the last 48 hours - and two of those dropped after 3 seconds.

i'll reboot and try again; starting to get sick of it now, though  :Smile: 

thanks for the suggestions though, i'll keep trying for a bit

----------

## UberLord

1) Remove any preup/down functions you have in conf.d/net - you don't need them anymore for any wireless stuff

2) Remove any reference to wireless.sh - it's not needed either

Here's a sample config file that works with baselayout-1.11.7-r2

```

modules=( "!iwconfig" )

```

Yes, that right, just that. DHCP is assumed to be the default if nothing is specified now.

----------

## markandrew

after a reboot, adding wpa_supplicant to the default runlevel, and starting ath0... it seems to be working! i've stopped and started it 3 times and it's worked fine each time - i'm using it now to post this (ethernet cable unplugged just to be sure). so, fingers crossed, it seems to be working. 

thanks for all your help; if this remains pretty stable it could save my relationship  :Smile:  (as i'll now be able to work at night in bed rather than staying in the living room til 2am, thus annoying my gf)

----------

## markandrew

not that i spend all my time in bed working, you understand  :Smile: 

----------

## markandrew

OK, following emerging of the latest baselayout, it's now borked:

```

markho # /etc/init.d/wpa_supplicant start

 * Starting wpa_supplicant ...

 *   ath0 ...

Initializing interface 'ath0' conf '/etc/wpa_supplicant.conf' driver 'madwifi'

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

Priority group 2

   id=0 ssid='firenze2'

Daemonize..                                                               [ ok ]

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

 * Starting ath0

 *    Starting wpa_supplicant on ath0 ...

 *    wpa_supplicant_ath0 does not define a driver

ioctl[PRISM2_IOCTL_PRISM2_PARAM]: Operation not supported

ioctl[PRISM2_IOCTL_PRISM2_PARAM]: Operation not supported

Failed to enable WPA in the driver.

ioctl[PRISM2_IOCTL_HOSTAPD]: Operation not supported

ioctl[PRISM2_IOCTL_PRISM2_PARAM]: Operation not supported

ioctl[PRISM2_IOCTL_PRISM2_PARAM]: Operation not supported

Failed to disable WPA in the driver.

ioctl[PRISM2_IOCTL_PRISM2_PARAM]: Operation not supported

ioctl[PRISM2_IOCTL_PRISM2_PARAM]: Operation not supported 

```

*sigh*

----------

## UberLord

baselayout-1.11.8 now has wpa_supplicant support

You need to remove wpa_supplicant run any run levels, and don't start it by hand.

You also need to configure any specific options for it in /etc/conf.d/net

```

wpa_supplicant_ath0="-Dmadwifi"
```

To force wpa_supplicant to use madwifi - which I think you need

You can now prefer wpa_supplicant over iwconfig instead of disabling iwconfig

```
modules=( "wpa_supplicant" )
```

----------

## markandrew

ok, that almost works:

```

markho # /etc/init.d/net.ath0 restart

 * Stopping ath0

 *    Bringing down ath0

 *       Shutting down ath0 ...                                           [ ok ]

 *       Stopping wpa_supplicant on ath0 ...                              [ ok ]

 * Starting ath0

 *    Starting wpa_supplicant on ath0 ...

```

but it never returns from starting wpa_supplicant, just sits there, waiting... although a 'ps' shows that wpa_ is running

btw, i needed to edit a file to get it this far:

```

/lib/rcscripts/net.modules.d/wpa_supplicant: line 14: /usr/sbin/wpa_cli: No such

 file or directory

```

wpa_cli is in /usr/bin, not /usr/sbin

----------

## Codo

I have wpa_supplicant working perfectly, and I ran into problems like yours.

Apparently, wpa_supplicant brings the interface up and down by itself.  If you try to bring it up yourself it breaks.

I'm not at home now, but I think I I did

```
!iwconfig, !ifconfig
```

This prevents the interface being brought up by the baselayout scripts.

wpa_supplicant is always checking for available networks and attaches to whatever by itself...

----------

## markandrew

i tried putting those !'s in conf.d/net but it made wpa not even start, just complain about there being no ath0 device!

----------

## UberLord

hmmm - it's borked for wpa_supplicant-0.3.x atm

Should work fine with 0.2.x - I'll see if I can get something done ASAP

----------

## UberLord

https://bugs.gentoo.org/show_bug.cgi?id=74637

----------

## astaroth_pod

Hm, I am trying your excellent wireless baselayout scripts UberLord, but I am having some slight troubles with the 1.11.8 and WPA.

After applying the patch mentioned in the bug notice above (and also if I don't patch, but just symlink from /usr/bin to /usr/sbin) I get this error:

```
Daemonize..

Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory

```

At the end of the initialization of the net.ath0 interface.

Here's the whole thing:

```
 * Starting ath0

 *    Starting wpa_supplicant on ath0 ...

Initializing interface 'ath0' conf '/etc/wpa_supplicant.conf' driver 'madwifi'

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

Reading configuration file '/etc/wpa_supplicant.conf'

Line: 1 - start of a new network block

scan_ssid=0 (0x0)

priority=5 (0x5)

proto: 0x1

key_mgmt: 0x2

pairwise: 0x18

group: 0x1e

ssid - hexdump_ascii(len=12):

     62 65 65 70 62 6f 6f 70 69 64 6f 70               beepboopidop

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

Line: 12 - start of a new network block

scan_ssid=0 (0x0)

priority=4 (0x4)

proto: 0x1

key_mgmt: 0x2

pairwise: 0x18

group: 0x1e

ssid - hexdump_ascii(len=9):

     6b 6f 6b 6b 65 6c 75 72 65                        kokkelure

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

Priority group 5

   id=0 ssid='beepboopidop'

Priority group 4

   id=1 ssid='kokkelure'

Daemonize..

Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory

Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory

```

Everything seems perfectly correct, and the output is exactly the same as the wpa_supplicant script, all the way down to the error.

Also, it seems to do everything but the DHCP part: If I run dhcpcd after the error, it comes up without blinking.

Is it just pointing wrong to some script file?

----------

## markandrew

mine works fine with the patch; but i did go through all the steps outlined in this thread beforehand.

----------

## astaroth_pod

Which version of wpa_supplicant?

I've also followed the instructions herewithin, although it's mostly null and void after 1.11.8 baselayout.

My /etc/conf.d/net looks like this...

```
wpa_supplicant_ath0="-dd -w -Dmadwifi"

modules=( "wpa_supplicant" )

```

And that's really all there's to it that I can see. the wpa_supplicant init script works if I use that instead, and I have no net services (but net.lo) starting up at startup...

Using wpa_supplicant 3.1.

----------

## astaroth_pod

UberLord - any tips?

----------

## astaroth_pod

Still can't get 1.11.8 working right with wpa_supplicant =(

----------

## UberLord

Ensure that no wpa_supplicat process is running.

Then erase the directory /var/run/wpa_supplicant

Then try again!

----------

## markandrew

ok, i'm now getting the wpa_ctrl_open error after upgrading to 0.3.2

it's still working, but spewing the error too:

```

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

 * Starting ath0

 *    Starting wpa_supplicant on ath0 ...

Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or dir  [ ok ]

 *       ath0 connected to "firenze2" at 00:30:F1:EC:C3:5F

 *    Bringing up ath0

 *       dhcp

 *          Running dhcpcd ...                                            [ ok ]

 *          ath0 received address 192.168.2.3

```

----------

## astaroth_pod

No process running, and no directory /var/run/wpa_supplicant. Maybe lack of the directory is a problem? I'll check...

----------

## astaroth_pod

Still no-go... Hm. Mine also just repeats the message over and over, never comes up...

----------

## UberLord

I'll look into it sometime in the new year - I've just moved house and only have WEP wireless at work :/

----------

## yangman

 *astaroth_pod wrote:*   

> No process running, and no directory /var/run/wpa_supplicant. Maybe lack of the directory is a problem? I'll check...

 

Make sure the following line is uncommented in your /etc/wpa_supplicant.conf

```
ctrl_interface=/var/run/wpa_supplicant
```

----------

## astaroth_pod

 *Quote:*   

> Make sure the following line is uncommented in your /etc/wpa_supplicant.conf
> 
> ```
> ctrl_interface=/var/run/wpa_supplicant
> ```
> ...

 

Hi,

Thanks; I noticed this earlier as well, and this made the error just appear once then stop and eventually time out, instead of repeat over and over.

Permissions look good, it's in any case being run by root but the error persists...

----------

## astaroth_pod

Error still persists (wpa_supplicant 0.3.4 now). Anyone got a clue?

----------

## UberLord

Try only specifying the driver in your wpa_supplicant options

----------

## trunet

I have the same problem of  astaroth_pod here! I'd already put only the driver in the wpa_supplicant options and no go.

----------

## UberLord

```
Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or dir
```

That message means that wpa_supplicant has segfaulted/crashed - I only found this last night as wpa_supplicant-0.3.4 segfaults on my AMD64 box.

I'll see if I can put better error messaging in

----------

## astaroth_pod

Must be the wpa_cli or something unimportant that crashes - because wpa is working fine, I can just ctrl-c the script and run dhcpcd ath0, and it works.

----------

## MadOtis

I don't know if it matters or not, but I had the exact same series of problems as in this thread.  I finally get everything working by emerge -C madwifi-driver and fetching the WPA branch of MadWifi from CVS.

```
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/madwifi co -r WPA madwifi
```

Did an old fashioned 'make && make install', rebooted, and it came up and started working.

I don't know if the key was the WPA branch or what, but I know that as soon as I unmerged the portage version of madwifi and replaced it with a manual build of the latest code, it started working.

Hope this helps in some little way.

Cheers,

Randy

----------

## mOjO_420

i think i figured it out... someone re-write the function more elegantly please.. i'm not a coder.

https://forums.gentoo.org/viewtopic.php?p=1982963#1982963

----------

## MadOtis

Mojo,

For not being a programmer, you didn't do half-bad there...  Your script modification is very close to Uberlord's.  The only real difference is, this line

```
local -a status=( $( wpa_cli -i${1} status | awk -F='/^key_mgmt|^wpa_state|^decision/ { print $2 }' ) )
```

is changed to this

```
local -a status=( $( wpa_cli -i${1} status | awk -F='/^key_mgmt|^wpa_state/ { print $2 }' ) )
```

and this line

```
[[ ${status[2]} == COND_SUCC ]]
```

was replaced with this

```
[[ ${status[1]} == COMPLETE ]]

```

Oh, and Uberlord's patch can be found at: 

https://bugs.gentoo.org/show_bug.cgi?id=74637

Cheers!

----------

## mOjO_420

patch applied.

thanks...  :Wink: 

figures this had been solved already and i wasted a few hours for nuttin.   :Surprised: 

anyone else been getting occasional kernel panics with 2.6.10-r4 and the madwifi patch...?  i think the patch was maybe hastily written.  i dunno.. i pulled it off the forums and not bugs or anywhere official.

really the kernel panics are few and far between but they always happen when i'm doing something involving that atheros wifi card (DWL-G650).

----------

## astaroth_pod

This doesn't solve anything for me though - I must  be missing something completely.

The problem isn't that I get a dhcp timeout - I just don't get a dhcp anything, it stops at the error

```
Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or dir
```

and hangs there infinitely - it never gets to where it wants to run the dhcp at all.

----------

## UberLord

@astaroth_pod - that means that the wpa_supplicant daemon has segfaulted - or it's looking in the wrong location for ctrl_interface

Ensure that /etc/wpa_supplicant.conf has the below line exactly

```

ctrl_interface=/var/run/wpa_supplicant

```

----------

## astaroth_pod

Thanks Uberlord, after applying your patches it now gives the error once then continues to start.

Error still persists, but it completes and works - so its good enough for now.

I have the ctrl interface right, and also the wpa_cli points to the right location (I used to change that manually).

Again, thanks =)

----------

