# wpa_supplicant and WEP woes

## Lophophora

Hi,

I'm having trouble connecting to a WEP network using my RaLink RT2760 PCI card. I'm using the kernel staging drivers compiled as modules

```
04:02.0 Network controller: RaLink RT2760 Wireless 802.11n 1T/2R Cardbus

        Subsystem: RaLink Device 2760

        Flags: bus master, slow devsel, latency 64, IRQ 17

        Memory at fdaf0000 (32-bit, non-prefetchable) [size=64K]

        Capabilities: [40] Power Management version 3

        Kernel driver in use: rt2860

        Kernel modules: rt2860sta
```

Up to a month ago I was connecting to an unsecured network using a simple wpa_supplicant.conf file and everything worked perfect. I recently moved houses & modified my wpa_supplicant.conf and net files accordingly:

```
ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=wheel

eapol_version=2

ap_scan=1

update_config=1

network={

   ssid="Gustav"

   scan_ssid=1

   priority=5

   key_mgmt=NONE

   wep_key0=F27FFBC4EFC4301724F2359956

   wep_tx_keyidx=0

}
```

```
modules=( "wpa_supplicant" )

wpa_supplicant_wlan0="-Dwext"

config_wlan0=( "192.168.0.10 netmask 255.255.255.0" )

routes_wlan0=( "default via 192.168.0.1" )
```

When I start wlan0 I get:

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

 * Bringing up interface wlan0

 *   Starting wpa_supplicant on wlan0 ...                                 [ ok ]

 *   Starting wpa_cli on wlan0 ...                                        [ ok ]

 *   Backgrounding ... ...

 * WARNING: net.wlan0 has started, but is inactive
```

If I kill the service and start wpa_supplicant manually, the output is:

```
wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant/wpa_suppcant.conf -dd

Initializing interface 'wlan0' conf '/etc/wpa_supplicant/wpa_supplicant.conf' driver 'wext' ctrl_interface 'N/A' bridge '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='wheel'

eapol_version=2

ap_scan=1

update_config=1

Line: 7 - start of a new network block

ssid - hexdump_ascii(len=6):

     47 75 73 74 61 76                                 Gustav          

scan_ssid=1 (0x1)

priority=5 (0x5)

key_mgmt: 0x4

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

wep_tx_keyidx=0 (0x0)

Priority group 5

   id=0 ssid='Gustav'

SIOCGIWRANGE: WE(compiled)=22 WE(source)=14 enc_capa=0xf

  capabilities: key_mgmt 0xf enc 0xf flags 0x0

netlink: Operstate: linkmode=1, operstate=5

Own MAC address: 00:18:46:01:ef:6d

wpa_driver_wext_set_key: alg=0 key_idx=0 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_key: alg=0 key_idx=1 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_key: alg=0 key_idx=2 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_key: alg=0 key_idx=3 set_tx=0 seq_len=0 key_len=0

wpa_driver_wext_set_countermeasures

RSN: flushing PMKID list in the driver

Setting scan request: 0 sec 100000 usec

EAPOL: SUPP_PAE entering state DISCONNECTED

EAPOL: Supplicant port status: Unauthorized

EAPOL: KEY_RX entering state NO_KEY_RECEIVE

EAPOL: SUPP_BE entering state INITIALIZE

EAP: EAP entering state DISABLED

EAPOL: Supplicant port status: Unauthorized

EAPOL: Supplicant port status: Unauthorized

ctrl_interface_group=10 (from group name 'wheel')

Added interface wlan0

RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])

RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added

RTM_NEWLINK: operstate=0 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])

RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added

RTM_NEWLINK: operstate=0 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])

RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added

Wireless event: cmd=0x8b06 len=8

RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])

RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added

Trying to get current scan results first without requesting a new scan to speed up initial association

Received 0 bytes of scan results (0 BSSes)

BSS: Start scan result update 1

Cached scan results are empty - not posting

Selecting BSS from priority group 5

Try to find WPA-enabled AP

Try to find non-WPA AP

No suitable network found

Setting scan request: 0 sec 0 usec

State: DISCONNECTED -> SCANNING

Scan SSID - hexdump_ascii(len=6):

     47 75 73 74 61 76                                 Gustav          

Starting AP scan for specific SSID(s)

Scan requested (ret=0) - scan timeout 5 seconds

EAPOL: disable timer tick

EAPOL: Supplicant port status: Unauthorized

Scan timeout - try to get results

Received 209 bytes of scan results (2 BSSes)

BSS: Start scan result update 2

BSS: Add new id 0 BSSID 00:13:49:a1:18:90 SSID 'ISSHomeBase'

BSS: Add new id 1 BSSID 00:0f:b5:15:74:76 SSID 'Gustav'

New scan results available

Selecting BSS from priority group 5

Try to find WPA-enabled AP

0: 00:13:49:a1:18:90 ssid='ISSHomeBase' wpa_ie_len=0 rsn_ie_len=0 caps=0x11

   skip - no WPA/RSN IE

1: 00:0f:b5:15:74:76 ssid='Gustav' wpa_ie_len=0 rsn_ie_len=0 caps=0x11

   skip - no WPA/RSN IE

Try to find non-WPA AP

0: 00:13:49:a1:18:90 ssid='ISSHomeBase' wpa_ie_len=0 rsn_ie_len=0 caps=0x11

   skip - SSID mismatch

1: 00:0f:b5:15:74:76 ssid='Gustav' wpa_ie_len=0 rsn_ie_len=0 caps=0x11

   selected non-WPA AP 00:0f:b5:15:74:76 ssid='Gustav'

Trying to associate with 00:0f:b5:15:74:76 (SSID='Gustav' freq=2427 MHz)

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_wext_set_key: alg=1 key_idx=0 set_tx=1 seq_len=0 key_len=13

State: SCANNING -> ASSOCIATING

wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT)

netlink: Operstate: linkmode=-1, operstate=5

wpa_driver_wext_associate

wpa_driver_wext_set_drop_unencrypted

wpa_driver_wext_set_psk

Setting authentication timeout: 10 sec 0 usec

EAPOL: External notification - EAP success=0

EAPOL: Supplicant port status: Unauthorized

EAPOL: External notification - EAP fail=0

EAPOL: Supplicant port status: Unauthorized

EAPOL: External notification - portControl=ForceAuthorized

EAPOL: Supplicant port status: Unauthorized

RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])

RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added

Wireless event: cmd=0x8b06 len=8

RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])

RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added

Wireless event: cmd=0x8b04 len=12

RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])

RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added

Wireless event: cmd=0x8b1a len=14

RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])

RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added

Wireless event: cmd=0x8c07 len=8

AssocReq IE wireless event - hexdump(len=0):

RTM_NEWLINK: operstate=0 ifi_flags=0x11003 ([UP][LOWER_UP])

RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added

Wireless event: cmd=0x8b15 len=20

Wireless event: new AP: 00:0f:b5:15:74:76

Association info event

req_ies - hexdump(len=0):

WPA: clearing own WPA/RSN IE

State: ASSOCIATING -> ASSOCIATED

wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT)

netlink: Operstate: linkmode=-1, operstate=5

Associated to a new BSS: BSSID=00:0f:b5:15:74:76

Associated with 00:0f:b5:15:74:76

WPA: Association event - clear replay counter

WPA: Clear old PTK

EAPOL: External notification - portEnabled=0

EAPOL: Supplicant port status: Unauthorized

EAPOL: External notification - portValid=0

EAPOL: Supplicant port status: Unauthorized

EAPOL: External notification - portEnabled=1

EAPOL: SUPP_PAE entering state S_FORCE_AUTH

EAPOL: Supplicant port status: Authorized

EAPOL: SUPP_BE entering state IDLE

Cancelling authentication timeout

State: ASSOCIATED -> COMPLETED

CTRL-EVENT-CONNECTED - Connection to 00:0f:b5:15:74:76 completed (auth) [id=0 id_str=]

wpa_driver_wext_set_operstate: operstate 0->1 (UP)

netlink: Operstate: linkmode=-1, operstate=6

Cancelling scan request

RTM_NEWLINK: operstate=1 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])

RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
```

dhcpcd wlan0 results in being assigned with an IP address that I know is not in the range of the router (i.e. 192.168.0.*) and predictably, there's no functioning connection.

Can someone make sense of all this? I should probably mention that the same key is working on Windoze so that can't be the issue.

Many thanks in advance!

----------

## gerdesj

Sorry, I'm using the wife's Windows laptop so can't get a config up to look at.

However, you have key management = NONE which I think means that it ignores the PSK etc.  I think you are attaching to someone else's Wifi instead of your own, hence the wrong address range.

Try removing that line completely.

Also, if you can - use WPA2.  WEP is really sad nowadays and easily crackable.  With WPA2 I'm fairly sure that I only need:

network={

   priority=1

   ssid="MY_SSID"

   key_mgmt=WPA-PSK 

   psk="MY_PSK"

}

Cheers

Jon

----------

## Lophophora

Hi and thanks for your reply. I'm not sure that's the problem, I looked around the fora quite a bit while I was trying to set the net up and there seems to be a universal consensus for "key_mgmt=NONE" when it comes to WEP networks. The automatically generated wpa_supplicant.conf when I use the wpa_supplicant GUI also has the same value and the output I pasted from manually starting wpa_supplicant shows that's it trying to connect to my network (Gustav) so I suspect the problem is elsewhere... I believe the address dhcpcd gives is the last address it "remembers" from my previous network. Nonetheless I couldn't agree with you more that WPA is better but unfortunately I don't manage the network   :Sad: 

In any case, I reverted to plan B which involves using a Belkin extender and an ethernet cable plugged to my ethernet card so I guess for the time being it's problem circumvented rather than problem solved!

----------

## gerdesj

There are some more options:

Try network manager

Get /etc/conf.d/net to do everything

I use wpa_supplicant.conf as you do but I notice that in /usr/share/doc/openrc-<version>/net.example there is mention of setting the config up in net including keys etc etc.  Why not try that when you next have some spare time.

Cheers

Jon

----------

