# yet another DHCP and wpa_supplicant problem

## nahpets

I've been trying to get wireless working with WEP encryption all day.  I've managed to get it to work using iwconfig, but I'd really like to use wpa_supplicant instead.  I'm using an MN-520 PCMCIA card and a D-Link DI-624 router.  From what I can tell, wpa_supplicant isn't sending the WEP keys properly.  This is what 'iwconfig' gives me after I use 'iwconfig eth1 essid home key xxxxx':

```

eth1      IEEE 802.11b  ESSID:"home"  Nickname:"Prism  I"

          Mode:Managed  Frequency:2.437 GHz  Access Point: xx:xx:xx:xx:xx:xx

          Bit Rate:11 Mb/s   Sensitivity:1/3

          Retry min limit:8   RTS thr:off   Fragment thr:off

          Encryption key:xxxx-xxxx-xx   Security mode:open

          Power Management:off

          Link Quality=92/92  Signal level=5/153  Noise level=116/153

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

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

```

Notice that 'Encryption key' is properly set.  When I try using wpa_supplicant instead, the key doesn't change. My router shows that the wireless card is connecting, but DHCP just hangs forever and nothing happens.  I've been searching all day on the net and tried all sorts of different '/etc/wpa_supplicant.conf' settings and it still won't work.

I've used the '-D prism54' and '-D hostap' options and still nothing.  I'm thinking that there should be a way to make wpa_sup work since I'm able to get it to connect properly using iwconfig.

Oh yeah...  I'm able to get wpa_sup to work if I leave my router open with no encryption.  I've been reading about similar problems in the forums, but none of the solutions have worked for me.  Hopefully someone here can point me in the right direction.

----------

## wynn

You may already have tried this but here, with an Atheros card (/etc/conf.d/net)

```
config_eth0=( "192.168.1.37 netmask 255.255.255.0 broadcast 192.168.1.255" )

routes_eth0=(

        "default via 192.168.1.1"

)

config_ath0=( "dhcp" )

modules=( "wpa_supplicant" )

wpa_supplicant_ath0="-Dmadwifi" # For Atheros based cards

dhcpcd_ath0="-R -N -G"
```

 and (/etc/wpa_supplicant/wpa_supplicant.conf)

```
ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

eapol_version=1

ap_scan=1

fast_reauth=1

network={

        ssid="default"

        key_mgmt=NONE

        wep_key0="Elephants Dreamx"

        wep_tx_keyidx=0

        priority=1

}

```

it's fine.

Some notes: the arguments to dhcpcd are equivalent to "nodns nontp nogateway" because eth0 is the internet connection and ath0 mustn't stamp on the files.

I hope you find this helpful, sorry if you've already tried it.

----------

## nahpets

The problem doesn't seem to be with dhcp.  wpa_sup keeps giving me these errors:

```

wpa_driver_hostap_set_wpa: enabled=1

wpa_driver_hostap_set_key: alg=none key_idx=0 set_tx=0 seq_len=0 key_len=0

Failed to set encryption.

wpa_driver_hostap_set_key: alg=none key_idx=1 set_tx=0 seq_len=0 key_len=0

Failed to set encryption.

wpa_driver_hostap_set_key: alg=none key_idx=2 set_tx=0 seq_len=0 key_len=0

Failed to set encryption.

wpa_driver_hostap_set_key: alg=none key_idx=3 set_tx=0 seq_len=0 key_len=0

Failed to set encryption.

```

My wep keys are in hex and I've tried both upper and lower case.

----------

## wynn

I've had a look at the source but it is difficult to see if the settings "key_idx=0 set_tx=0 seq_len=0 key_len=0" are reasonable or not as the driver procedures which take these as arguments are in an array and are called indirectly. "Failed to set encryption." is returned when the driver IOCTL returns a non-zero value so that's hidden away too.

The point of the above is to show that it seems impossible to find out why it is failing â you must have been running in debug mode already to get those messages.

Funny thing is, I can get WEP working with WPA (madwifi driver) but not with iwconfig and you seem to have the opposite.

Sorry I can't help.

[Edit] There is a mailing list (and archives) for hostap and wpa_supplicant which you might find useful http://lists.shmoo.com/mailman/listinfo/hostap

----------

## nahpets

I've been digging a little more and I'm a little confused as to which driver I should be using with the MN-520 card.  It appears that hostap, prism54 and orinoco_cs all support the Prism chipsets.  I was thinking that I could try the other 2 by doing a 'rmmod -f orinoco_cs' and then modprobing prism54 or hostap.  Can you explain the difference between all these drivers?  Also, should I be using the drivers in portage or the kernel drivers?

----------

## wynn

 *Quote:*   

> I've been digging a little more and I'm a little confused as to which driver I should be using with the MN-520 card. It appears that hostap, prism54 and orinoco_cs all support the Prism chipsets.

 The card's chipset seems shrouded in (Microsoft) mystery: one place says it is made by NEC, and it is reported that "manfid: 02d2:0001" which, I presume, is the PCI vendor id and device id (if PCMCIA devices have these) but there is no 02d2 in the pci.ids table.

However, http://tuxmobil.org/pcmcia_ci10500.html says *Quote:*   

> You may have to add the following lines to /etc/pcmcia/config to get the driver to load automaticly:
> 
> card "Microsoft Wireless Notebook Adapter MN-520 1.0.3"
> 
> version "Microsoft", "Wireless Notebook Adapter MN-520", "", "1.0.3"
> ...

 so it looks as though your third alternative (trinative?) is the one to go for but there isn't an "orinoco" driver for wpa_supplicant and I don't know if using orinoco_cs with the hostap driver will work.

I don't know what distro is being used and, not having used PCMCIA, I can't say if this is part of Gentoo or not.

[A lot of qualifications, perhaps I'm a lawyer manquÃ©]

----------

