# WPA - Gurus wanted

## Codo

Change: Changed subject!

Hello Everybody!

  I am starting this thread for two reasons: to fix my problem and to find out what happens, so everybody can find this info later, so any gurus out there!!!

  Config:

WG511 v3 "Made in China" with ndiswrapper v0.11 and winbloze drivers from the box

NETGEAR Wireless ADSL Modem / Router / Firewall blablabla

Neighbour has 3com router  :Wink: 

wpa_supplicant v0.2.5

baselayout 1.11.6-r1

gcc 3.4.3

/etc/conf.d/net <--- Empty

/etc/conf.d/wireless <--- Empty

/etc/wpa_supplicant.conf

```
ctrl_interface=/var/run/wpa_supplicant

network={

        ssid="My Network"

        psk="MySecretPassword"

        proto=WPA

        key_mgmt=WPA-PSK

}
```

So far so good.  Now, I want to make clear that the card WORKS!  In fact, it is very stable.  I am writing this using the card, but here is where the problem starts.

To make it work, what I do is:

1. make sure ndiswrapper is unloaded

2. 

```
$ wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant.conf
```

3. Very quickly run wpa_cli

4. In wpa_cli, there is a message like "Authentication will time out in 10 seconds..."

5. Very quickly, on another terminal 

```
ifconfig wlan0 up

dhcpcd wlan0
```

If I am lucky, the timings will be ok and the link will go up.  If I don't follow this order, or if the timing is not right, everything dies and I have to start all over again.

If I use /etc/init.d/net.wlan0 start it will die for sure.  I think part of the problem lies in the fact that the net.lo script will try to setup the wireless and setup some ESSID, but the ESSID has been negotiated already, and trying to do anything with ESSID, etc... will kill the card.  Maybe I am wrong...

Well, the ideal would be to have wpa_supplicant and net.wlan0 on the default runlevel.  Any ideas how to fix this timing issues / fix initscripts / etc?

Thanks.Last edited by Codo on Mon Nov 29, 2004 11:52 am; edited 1 time in total

----------

## UberLord

In /etc/conf.d/net

```

modules=( "!iwconfig" )

```

This should be documented in /etc/conf.d/net.example

----------

## Codo

Aha!  I agree totally with you, this will solve the issue about killing the card, but /net/init.d/net.wlan0 will try to bring wlan0 up.

By the way, I have found that it is not necessary to

```
ifconfig wlan0 up
```

As I understand it, it is already up, am I wrong?  I think the only thing missing would be a 

```
dhcpcd wlan0
```

Am I right?

And, what will happen if you go out of range, and then you are in range with another DHCP server... is dhcpcd able to handle this?  Would it be necessary to trigger a renegotiation with the new server?

----------

## UberLord

 *Codo wrote:*   

> Aha!  I agree totally with you, this will solve the issue about killing the card, but /net/init.d/net.wlan0 will try to bring wlan0 up.

 

Isn't this the desired behaviour? If not, what is?

 *Quote:*   

> 
> 
> And, what will happen if you go out of range, and then you are in range with another DHCP server... is dhcpcd able to handle this?  Would it be necessary to trigger a renegotiation with the new server?

 

DHCP doesn't handle this directly ....

wpa_supplicant may start/stop the net.xxx script when it associates/de-associates with an AP. This handles the DHCP restart.

----------

## Codo

 *UberLord wrote:*   

> 
> 
> Isn't this the desired behaviour? If not, what is?
> 
> 

 

Yes, but /etc/init.d/wpa_supplicant has already brought up the interface, so /etc/init.d/net.lo should avoid bringing it up again and only configure it in case you want DHCP, or fixed IP, etc...

 *UberLord wrote:*   

> 
> 
> wpa_supplicant may start/stop the net.xxx script when it associates/de-associates with an AP. This handles the DHCP restart.

 

Maybe wpa_supplicant can call 

```
/etc/init.d/net.wlan0 start / stop 
```

 on the specified interface if the above behaviour is supported by /etc/init.d/net.lo (not bringing up the interface, as it is already up), although I can imagine you would like this behaviour with DHCP only...  agree??

----------

## UberLord

Note: I don't use wpa_supplicant as my hardware doesn't support it.

Is there a problem with issuing iconfig ethx up when it's already up?

----------

## Codo

 *UberLord wrote:*   

> Note: I don't use wpa_supplicant as my hardware doesn't support it.

 

You can use wpa_supplicant with WEP, I think, if you want to do some testing...

 *UberLord wrote:*   

> Is there a problem with issuing ifconfig ethx up when it's already up?

 

I'm now at the office, but as soon as I go back home I'll confirm this.  I think it kills the card and becomes unusable.  I remember commenting out ifconfig {$IFACE} up in /etc/init.d/wpa_supplicant.

----------

## UberLord

FYI I cannot get wpa_supplicant + WEP working at all with my prism54 card. I've tried both the -Dprism54 and -Dwext options, but prism54 cannot set the wep key and wext cannot associate :/

Please ensure that this is not what you're getting

----------

## Codo

Ok, I think I have found something very interesting indeed.

1. in /etc/init.d/wpa_supplicant I commented out 

```
ifconfig ${IFACE} up
```

2. My /etc/conf.d/wpa_supplicant

```
# List of interfaces

INTERFACES="wlan0"

# Common arguments to all wpa_supplicant instances

ARGS="-Dndiswrapper"

# Interface specific arguments

# ARGS_wlan0=""
```

3. I have added wpa_supplicant to the default runlevel

4. I have REMOVED any net.wlan0 from any runlevel...

5. My /etc/conf.d/wireless:

```
modules=( "!iwconfig" )
```

reboot...

And wpa_supplicant brings up everything, even the script...:

```
$ /etc/init.d/status

 * status:   started
```

```
# rc-update show | grep "net\."

            net.eth0 |

              net.lo |         boot

            net.ppp0 |

           net.wlan0 |
```

----------

