# can't connect to WEP network using wpa_supplicant [SOLVED]

## NotCourse6

Right, so I have a Prism 2.5 chipset from Intersil Corp. and I have been trying for a while to connect to a WEP network (later identified as net2) using wpa_supplicant.  This is my kernel configuration for hostap:

```

Networking Support -->

     Generic IEEE 802.11 Networking Stack -->

          [*] IEEE 802.11 WEP encryption

          [M] IEEE 802.11i CCMP support

          [M] IEEE 802.11i TKIP support

Device Drivers -->

     Network Device Support -->

          Wireless LAN (non-hamradio) -->

               [*] Wireless LAN drivers (non-hamradio) & Wireless Extensions

               [M] Hermes chipset 802.11b support (Orinoco/Prism2/Symbol)

                    [M] Prism 2.5 PCI 802.11b adapter support

               [*] IEEE 802.11 for HostAP (Prism 2/2.5/3 and WEP/TKIP/CCMP)

                    [*] Support for downloading firmware images with Host AP driver

                    [M] Host AP driver for Prism 2/2.5/3 in PLX9052 PCI adapters

                    [*] Host AP driver for Prism 2.5 PCI adapters

                    [M] Host AP driver for Prism 2/2.5/3 PC Cards

```

  Of those compiled as modules, orinoco, hermes, orinoco_pci, ieee80211_crypt_ccmp, and ieee80211_crypt_tkip are loaded (in that order).  I understand that I don't need the ieee80211_crypt modules for WEP, but I figure it's better to have them available just in case.

  On my computer, then, I've installed:

baselayout 1.12.0_pre16-r3

hostap_utils 0.4.7

wpa_supplicant 0.5.2

udhcp 0.9.9_pre20041216-r1

  Wireless is initialized via the net.wlan0 init script only at the default runlevel.  These are the relevant contents of /etc/conf.d/rc:

```

# RC_NET_STRICT_CHECKING allows some flexibility with the 'net' service.

# The following values are allowed:

#  none  - The 'net' service is always considered up.

#  no    - This basically means that at least one net.* service besides net.lo

#          must be up.  This can be used by notebook users that have a wifi and

#          a static nic, and only wants one up at any given time to have the

#          'net' service seen as up.

#  lo    - This is the same as the 'no' option, but net.lo is also counted.

#          This should be useful to people that do not care about any specific

#          interface being up at boot.

#  yes   - For this ALL network interfaces MUST be up for the 'net' service to

#          be considered up.

RC_NET_STRICT_CHECKING="no"

# RC_AUTO_INTERFACE allows us to try and configure your interfaces

# automatically. This includes:

# - link /etc/{resolv,ntp,yp}.conf to /var/lib/net-scripts

# - calculate a metric based on what interfaces are up and type

# - apply interface state (resolv.conf, ntp.conf, etc)

# - merge resolv.conf and ntp.conf from active interfaces based on metric

# otherwise we don't do the above

RC_AUTO_INTERFACE="yes"

# RC_DOWN_INTERFACE allows you to specify if RC will bring the interface

# compeletly down when it stops. The default is yes, but there are some

# instances where you may not want this to happen such as using Wake On LAN.

RC_DOWN_INTERFACE="yes"

```

  Next are the relevant settings in /etc/conf.d/net:

```

hotplug_wlan0="no"

modules_wlan0=( "wpa_supplicant" "udhcpc" )

# wpa_supplicant configuration options

wpa_supplicant_wlan0="-Dhostap"

wpa_timeout_wlan0=20

# configuration for wlan0

config_wlan0=( "dhcp" )

```

  Relevant settings in /etc/wpa_supplicant.conf

```

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

eapol_version=1

ap_scan=1

fast_reauth=1

# for net1

network={

        ssid="net1"

        scan_ssid=1

        key_mgmt=NONE

        priority=1

}

# for net2

network={

        ssid="net2"

        key_mgmt=NONE

        auth_alg=SHARED

        wep_key0="**********"

        wep_tx_keyidx=0

        priority=2

}

# for net3

network={

        ssid="net3"

        key_mgmt=NONE

        auth_alg=SHARED

        wep_key0="**********"

        wep_tx_keyidx=0

        priority=3

}

# for net4

network={

        ssid="net4"

        key_mgmt=NONE

        priority=4

}

```

  The values of the network ssid's and the WEP keys have been changed for obvious reasons.  I should also mention that I've tried working with auth_alg=NONE, as some websites have advised, but changed it to SHARED per instructions in /etc/wpa_supplicant.conf.example  The logging output for the case where auth_alg=NONE is included for comparison below, where indicated.  Here's the output of hostap_diag wlan0:

```

Host AP driver diagnostics information for 'wlan0'

NICID: id=0x8013 v1.0.0 (PRISM II (2.5) Mini-PCI (SST parallel flash))

PRIID: id=0x0015 v1.1.1

STAID: id=0x001f v1.7.4 (station firmware)

```

  If I run /etc/init.d/net.wlan0 restart, I get:

```

 * Caching service dependencies ...                                          [ ok ]

 * Stopping wlan0

 *   Loading networking modules for wlan0

 *     modules: apipa arping bridge tuntap macchanger macnet rename netplugd iwconfig wpa_supplicant essidnet iptunnel ifconfig iproute2 ip6to4 system udhcpc

 *   Bringing down wlan0

 *     Shutting down wlan0 ...                                               [ ok ]

 *     Stopping wpa_cli on wlan0 ...                                         [ ok ]

 *     Stopping wpa_supplicant on wlan0 ...                                  [ ok ]

 *   Selecting best interface: eth0

 * Starting wlan0

 *   Loading networking modules for wlan0

 *     modules: apipa arping bridge tuntap macchanger macnet rename netplugd wpa_supplicant essidnet iptunnel iproute2 ip6to4 system udhcpc

 *       netplugd provides plug

 *       wpa_supplicant provides wireless

 *       iproute2 provides interface

 *       udhcpc provides dhcp

 *   Configuring wlan0 for MAC address ##:##:##:##:##:## ...                 [ ok ]

 *   netplug does not work with wireless

 *   Starting wpa_supplicant on wlan0 ...                                    [ ok ]

 *   Starting wpa_cli on wlan0 ...                                           [ ok ]

 *     Waiting for association                                               [ ok ]

 *     Failed to configure wlan0 in the background                           [ !! ]

```

  Once again, certain numbers have been changed for obvious reasons.  And now the output of ifconfig and iwconfig:

```

eth0      Link encap:Ethernet  HWaddr ##:##:##:##:##:##  

          inet addr:###.###.#.#  Bcast:###.###.#.###  Mask:255.255.255.0

          inet6 addr: ####::###:####:####:####/## Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000 

          RX bytes:3906755 (3.7 Mb)  TX bytes:325493 (317.8 Kb)

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

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

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

          collisions:0 txqueuelen:0 

          RX bytes:772 (772.0 b)  TX bytes:772 (772.0 b)

wifi0     Link encap:UNSPEC  HWaddr ##-##-##-##-##-##-##-##-##-##-##-##-##-##-##-##  

          UP BROADCAST MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000 

          RX bytes:207827 (202.9 Kb)  TX bytes:204 (204.0 b)

          Interrupt:11 

wlan0     Link encap:Ethernet  HWaddr ##:##:##:##:##:##  

          UP BROADCAST MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:0 

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

          Interrupt:11 

```

```

eth0      no wireless extensions.

lo        no wireless extensions.

Warning: Driver for device wifi0 has been compiled with version 19

of Wireless Extension, while this program supports up to version 18.

Some things may be broken...

wifi0     IEEE 802.11b  ESSID:"net2"  

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

          Bit Rate:2 Mb/s   Sensitivity=1/3  

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

          Encryption key:3033-3139-3139-3531-3033   Security mode:open

          Power Management:off

          

wlan0     IEEE 802.11b  ESSID:"net2"  

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

          Bit Rate:2 Mb/s   Sensitivity=1/3  

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

          Encryption key:3033-3139-3139-3531-3033   Security mode:open

          Power Management:off

          Link Quality=0/70  Signal level=-73 dBm  Noise level=-73 dBm

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

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

```

  Finally, dmesg gives me:

```

[ 2317.539401] wlan0: Trying to join BSSID 00:06:25:49:a3:5e

[ 2317.564839] wifi0: LinkStatus=6 (Association failed)

[ 2317.565063] wifi0: LinkStatus: BSSID=44:44:44:44:44:44

[ 2327.874645] wifi0: LinkStatus=2 (Disconnected)

[ 2327.876548] wifi0: LinkStatus: BSSID=44:44:44:44:44:44

[ 2327.897770] wifi0: LinkStatus=2 (Disconnected)

[ 2327.899671] wifi0: LinkStatus: BSSID=44:44:44:44:44:44

[ 2327.920897] wifi0: LinkStatus=2 (Disconnected)

[ 2327.921095] wifi0: LinkStatus: BSSID=44:44:44:44:44:44

[ 2327.933563] wlan0: Trying to join BSSID 00:06:25:3b:c7:b3

[ 2327.959035] wifi0: LinkStatus=6 (Association failed)

[ 2327.959270] wifi0: LinkStatus: BSSID=44:44:44:44:44:44

[ 2338.639426] wifi0: LinkStatus=2 (Disconnected)

[ 2338.639621] wifi0: LinkStatus: BSSID=44:44:44:44:44:44

[ 2338.666903] wifi0: LinkStatus=2 (Disconnected)

[ 2338.679059] wifi0: LinkStatus: BSSID=44:44:44:44:44:44

[ 2338.690174] wifi0: LinkStatus=2 (Disconnected)

[ 2338.690410] wifi0: LinkStatus: BSSID=44:44:44:44:44:44

```

  The above snippet of code repeats for a while in dmesg.  My logger is metalog, so looking through /var/log/everything/current I find:

```

Apr  9 09:15:18 [netplugd] wifi0: ignoring event

Apr  9 09:15:18 [kernel] [ 2263.984129] ADDRCONF(NETDEV_UP): wifi0: link is not ready

Apr  9 09:15:18 [netplugd] wlan0: ignoring event

Apr  9 09:15:18 [kernel] [ 2263.984965] ADDRCONF(NETDEV_UP): wlan0: link is not ready

Apr  9 09:15:18 [netplugd] wlan0: ignoring event

Apr  9 09:15:19 [netplugd] No interface name

Apr  9 09:15:19 [netplugd] Callback failed

(the last two lines repeat a lot, interjected by:)

Apr  9 09:15:39 [rc-scripts] Failed to configure wlan0 in the background

```

  I used to use ifplugd but thought it was ridiculously annoying, and I was under the impression that netplugd was only supposed to watch eth0.

  Now, if auth_alg=NONE, the events of /etc/init.d/net.wlan0 do not change but other things do:

ifconfig:

```

wifi0     Link encap:UNSPEC  HWaddr ##-##-##-##-##-##-##-##-##-##-##-##-##-##-##-##    

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000 

          RX bytes:311837 (304.5 Kb)  TX bytes:4524 (4.4 Kb)

          Interrupt:11 

wlan0     Link encap:Ethernet  HWaddr ##:##:##:##:##:##

          inet6 addr: ####::###:####:####:###/## Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:0 

          RX bytes:0 (0.0 b)  TX bytes:4428 (4.3 Kb)

          Interrupt:11 

```

iwconfig:

```

Warning: Driver for device wifi0 has been compiled with version 19

of Wireless Extension, while this program supports up to version 18.

Some things may be broken...

wifi0     IEEE 802.11b  ESSID:"net2"  

          Mode:Managed  Frequency:2.422 GHz  Access Point: ##:##:##:##:##:##

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

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

          Encryption key:3033-3139-3139-3531-3033   Security mode:open

          Power Management:off

          

wlan0     IEEE 802.11b  ESSID:"net2"  

          Mode:Managed  Frequency:2.422 GHz  Access Point: ##:##:##:##:##:##

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

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

          Encryption key:3033-3139-3139-3531-3033   Security mode:open

          Power Management:off

          Link Quality=20/70  Signal level=-78 dBm  Noise level=-99 dBm

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

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

```

dmesg:

```

[ 2867.629304] wlan0: Preferred AP (SIOCSIWAP) is used only in Managed mode when                              

 host_roaming is enabled

[ 2869.443214] ADDRCONF(NETDEV_UP): wifi0: link is not ready

[ 2869.443541] ADDRCONF(NETDEV_UP): wlan0: link is not ready

[ 2869.651323] wifi0: LinkStatus=2 (Disconnected)

[ 2869.651545] wifi0: LinkStatus: BSSID=44:44:44:44:44:44

[ 2869.697122] wifi0: LinkStatus=2 (Disconnected)

[ 2869.697346] wifi0: LinkStatus: BSSID=44:44:44:44:44:44

[ 2869.712976] wlan0: Preferred AP (SIOCSIWAP) is used only in Managed mode when                              

 host_roaming is enabled

[ 2869.796902] wifi0: LinkStatus=2 (Disconnected)

[ 2869.797125] wifi0: LinkStatus: BSSID=44:44:44:44:44:44

[ 2869.999244] wifi0: LinkStatus=2 (Disconnected)

[ 2870.001147] wifi0: LinkStatus: BSSID=44:44:44:44:44:44

[ 2870.022522] wifi0: LinkStatus=2 (Disconnected)

[ 2870.022750] wifi0: LinkStatus: BSSID=44:44:44:44:44:44

[ 2870.045755] wifi0: LinkStatus=2 (Disconnected)

[ 2870.045953] wifi0: LinkStatus: BSSID=44:44:44:44:44:44

[ 2870.058575] wlan0: Trying to join BSSID 00:06:25:49:a3:5e

[ 2870.082679] wifi0: LinkStatus=1 (Connected)

[ 2870.082954] wifi0: LinkStatus: BSSID=00:06:25:49:a3:5e

[ 2870.085855] ADDRCONF(NETDEV_CHANGE): wifi0: link becomes ready

[ 2870.085889] ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

[ 2871.751487] wifi0: decryption failed (SA=00:06:25:49:a3:5e) res=-2

[ 2873.592369] wifi0: decryption failed (SA=00:06:25:49:a3:5e) res=-2

[ 2875.739936] wifi0: decryption failed (SA=00:06:25:49:a3:5e) res=-2

[ 2877.581287] wifi0: decryption failed (SA=00:06:25:49:a3:5e) res=-2

[ 2877.890385] wifi0: decryption failed (SA=00:06:25:49:a3:5e) res=-2

[ 2877.894372] wifi0: decryption failed (SA=00:06:25:49:a3:5e) res=-2

[ 2877.897756] wifi0: decryption failed (SA=00:06:25:49:a3:5e) res=-2

[ 2877.900669] wifi0: decryption failed (SA=00:06:25:49:a3:5e) res=-2

[ 2877.904431] wifi0: decryption failed (SA=00:06:25:49:a3:5e) res=-2

[ 2877.907743] wifi0: decryption failed (SA=00:06:25:49:a3:5e) res=-2

[ 2877.911236] wifi0: decryption failed (SA=00:06:25:49:a3:5e) res=-2

[ 2877.914690] wifi0: decryption failed (SA=00:06:25:49:a3:5e) res=-2

[ 2877.918519] wifi0: decryption failed (SA=00:06:25:49:a3:5e) res=-2

[ 2877.921832] wifi0: decryption failed (SA=00:06:25:49:a3:5e) res=-2

[ 2879.624812] wifi0: LinkStatus=2 (Disconnected)

[ 2879.625019] wifi0: LinkStatus: BSSID=00:06:25:49:a3:5e

[ 2880.363085] wifi0: LinkStatus=2 (Disconnected)

[ 2880.364959] wifi0: LinkStatus: BSSID=00:06:25:49:a3:5e

[ 2880.388061] wifi0: LinkStatus=2 (Disconnected)

[ 2880.388256] wifi0: LinkStatus: BSSID=44:44:44:44:44:44

[ 2880.413505] wifi0: LinkStatus=2 (Disconnected)

[ 2880.415435] wifi0: LinkStatus: BSSID=44:44:44:44:44:44

[ 2880.426213] wlan0: Trying to join BSSID 00:12:17:70:70:30

[ 2880.450222] wifi0: LinkStatus=1 (Connected)

[ 2880.450587] wifi0: LinkStatus: BSSID=00:12:17:70:70:30

[ 2880.621342] wlan0: no IPv6 routers present

[ 2880.621375] ADDRCONF(NETDEV_CHANGE): wifi0: link becomes ready

[ 2881.745239] wifi0: decryption failed (SA=00:12:17:70:70:30) res=-2

[ 2883.586293] wifi0: decryption failed (SA=00:12:17:70:70:30) res=-2

[ 2885.734040] wifi0: decryption failed (SA=00:12:17:70:70:30) res=-2

[ 2887.574979] wifi0: decryption failed (SA=00:12:17:70:70:30) res=-2

[ 2889.722697] wifi0: decryption failed (SA=00:12:17:70:70:30) res=-2

```

  Sorry that that last snippet hasn't been edited, but I thought it best to include everything.  Finally, the output of /var/log/everything/current:

```

Apr  9 09:32:12 [netplugd] wifi0: ignoring event

Apr  9 09:32:12 [kernel] [ 3276.473001] ADDRCONF(NETDEV_CHANGE): wifi0: link becomes ready

Apr  9 09:32:12 [netplugd] wlan0: ignoring event

Apr  9 09:32:14 [udhcpc] udhcpc (v0.9.9-pre) started

Apr  9 09:32:23 [udhcpc] No lease, failing.

Apr  9 09:32:23 [rc-scripts] udhcpc (v0.9.9-pre) started_deconfig_Sending discover..._Sending discover..._Sending discover..._leasefail_No lease, failing.

Apr  9 09:32:32 [rc-scripts] Failed to configure wlan0 in the background

```

  Oy.  It is finally worth noting that in the absence of the need for a WEP key (i.e. if I am in the vicinity of "net1" as defined in /etc/wpa_supplicant.conf above), then I get access without a problem, and everything works fine.

  Any ideas?

-R-Last edited by NotCourse6 on Sat Apr 15, 2006 2:44 am; edited 1 time in total

----------

## UberLord

 *NotCourse6 wrote:*   

>   Oy.  It is finally worth noting that in the absence of the need for a WEP key (i.e. if I am in the vicinity of "net1" as defined in /etc/wpa_supplicant.conf above), then I get access without a problem, and everything works fine.

 

So that indicates that it is a wpa_supplicant issue.

https://bugs.gentoo.org/show_bug.cgi?id=116714 may be of help.

----------

## NotCourse6

After going through the bug report I find that the answer of using ap_scan=2 doesn't work for me.  However, the following does:

```

# wpa_supplicant -i wlan0 -D hostap -c /etc/wpa_supplicant.conf

Trying to associate with 00:06:25:49:a3:5e (SSID='linksys' freq=2437 MHz)

Associated with 00:06:25:49:a3:5e

CTRL-EVENT-CONNECTED - Connection to 00:06:25:49:a3:5e completed (auth)

# iwconfig

wifi0     IEEE 802.11b  ESSID:"linksys"  

          Mode:Managed  Access Point: 00:06:25:49:A3:5E   Bit Rate:11 Mb/s   

          Sensitivity=1/3  

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

          Encryption key:3033-3139-3139-3531-3033   Security mode:open

          Power Management:off

          

wlan0     IEEE 802.11b  ESSID:"linksys"  

          Mode:Managed  Access Point: 00:06:25:49:A3:5E   Bit Rate:11 Mb/s   

          Sensitivity=1/3  

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

          Encryption key:3033-3139-3139-3531-3033   Security mode:open

          Power Management:off

          Link Quality=17/70  Signal level=-79 dBm  Noise level=-96 dBm

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

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

#  udhcpc wlan0

udhcpc (v0.9.9-pre) started

Sending discover...

Sending select for 192.168.1.104...

Lease of 192.168.1.104 obtained, lease time 86400

deleting routers

SIOCDELRT: No such process

adding dns 68.87.64.146

adding dns 68.87.75.194

```

So working manually without modifying /etc/wpa_supplicant.conf gets it to run without a hitch.  So next I tried using the init script:

```

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

 * Starting wlan0

 *   Loading networking modules for wlan0

 *     modules: apipa arping bridge tuntap macchanger macnet rename netplugd wpa_supplicant essidnet iptunnel iproute2 ip6to4 system udhcpc

 *       netplugd provides plug

 *       wpa_supplicant provides wireless

 *       iproute2 provides interface

 *       udhcpc provides dhcp

 *   Configuring wlan0 for MAC address 00:05:3C:04:04:EE ...              [ ok ]

 *   netplug does not work with wireless

 *   Starting wpa_supplicant on wlan0 ...

Daemonize..                                                               [ ok ]

 *   Starting wpa_cli on wlan0 ...                                        [ ok ]

 *     Waiting for association                                            [ ok ]

 *     Failed to configure wlan0 in the background                        [ !! ]

# iwconfig

wifi0     IEEE 802.11b  ESSID:"linksys"  

          Mode:Managed  Frequency:2.422 GHz  Access Point: 00:12:17:70:70:30   

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

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

          Encryption key:3033-3139-3139-3531-3033   Security mode:open

          Power Management:off

          

wlan0     IEEE 802.11b  ESSID:"linksys"  

          Mode:Managed  Frequency:2.422 GHz  Access Point: 00:12:17:70:70:30   

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

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

          Encryption key:3033-3139-3139-3531-3033   Security mode:open

          Power Management:off

          Link Quality=21/70  Signal level=-77 dBm  Noise level=-99 dBm

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

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

# dmesg

[ 1601.901178] wifi0: decryption failed (SA=00:12:17:70:70:30) res=-2

[ 1603.705701] wifi0: decryption failed (SA=00:12:17:70:70:30) res=-2

(and a whole heck more of those)

# cat /var/log/everything/current

Apr 14 21:22:02 [kernel] [ 1497.496276] ADDRCONF(NETDEV_CHANGE): wifi0: link becomes ready

Apr 14 21:22:02 [netplugd] wlan0: ignoring event

Apr 14 21:22:04 [udhcpc] udhcpc (v0.9.9-pre) started

Apr 14 21:22:13 [udhcpc] No lease, failing.

Apr 14 21:22:13 [rc-scripts] udhcpc (v0.9.9-pre) started_deconfig_Sending discover..._Sending discover..._Sending discover..._leasefail_No lease, failing.

Apr 14 21:22:18 [udhcpc] udhcpc (v0.9.9-pre) started

Apr 14 21:22:27 [udhcpc] No lease, failing.

Apr 14 21:22:27 [rc-scripts] udhcpc (v0.9.9-pre) started_deconfig_Sending discover..._Sending discover..._Sending discover..._leasefail_No lease, failing.

Apr 14 21:23:02 [rc-scripts] Failed to configure wlan0 in the background

```

So something screwy is going on between wpa_supplicant and (possibly) udhcpc as initialized by /etc/init.d/net.wlan0 versus being initialized manually.  Now, for the coup de grace: if I edit /etc/init.d/wpa_supplicant in the following way,

```

start() {

        ebegin "Starting wpa_supplicant"

        if [ ! -f /etc/wpa_supplicant.conf ]; then

                eerror "Configuration file /etc/wpa_supplicant.conf not found"

                return 1

        fi

        if [ -z "$INTERFACES" ]; then

                eerror "No interfaces specified in /etc/conf.d/wpa_supplicant"

                return 1

        fi

        for IFACE in $INTERFACES; do

                ebegin "  ${IFACE}"

                eval ARGS_IFACE=\"\$\{ARGS_$IFACE\}\"

                /sbin/ifconfig ${IFACE} up

                start-stop-daemon --start --quiet --exec /sbin/wpa_supplicant \

                         -- -B -i${IFACE} -c/etc/wpa_supplicant.conf ${ARGS} ${ARGS

_IFACE}

[color=red]                /sbin/udhcpc ${IFACE}[/color]

                eend $?

        done

}

```

Then the following occurs,

```

#  /etc/init.d/wpa_supplicant start

 * Starting wpa_supplicant ...

 *   wlan0 ...

udhcpc (v0.9.9-pre) started

Sending discover...

Sending select for 192.168.1.104...

Lease of 192.168.1.104 obtained, lease time 86400

deleting routers

SIOCDELRT: No such process

adding dns 68.87.64.146

adding dns 68.87.75.194                                                   [ ok ]

```

Accordingly, I think I'm going to screw the net.wlan0 init script and go with my modified version of wpa_supplicant.  I think the problem is neither wpa_supplicant nor udhcpc, but rather the way net.wlan0 initializes and runs.  I've taken a look at it, and found it too complex to be properly examined at this time.  Perhaps that is its failing; after all, in any engineering solution more complexity usually means more opportunities for failure.

-Ricardo-

----------

