# ipw 4965 and wpa_supplicant - mostly working

## cumber

Okay, I have an Intel Pro Wireless 4965 built in wireless in my laptop, and I'm using iwlwifi and wpa_supplicant to connect to a WPA2 secured AP.

I can get it working fine, but it requires manual intervention every time I boot.

In my wpa_supplicant.conf file I have ap_scan set to 1, and it never connects. If I fire up wpa_cli nad ask for status, it just reports SCANNING. Then I set ap_scan to 2 (still from wpa_cli) and after a few seconds I get a message about trying to associate with can379 (my network's ssid) using a bssid of all 0s. Eventually this times out and it repeats the trying to associate with can379 using bssid 00:00:etc, which eventually times out again, and so on. Status reports ASSOCIATING this whole time. If I then set ap_scan BACK to 1, the next time the associate times out it tries the correct bssid and succeeds immediately, and everything is fine until next I have to start wlan0.

Anyone know what I can do about this? I should mention my AP has a 'hidden' ssid.

EDIT: Obviously I've tried setting ap_scan to 0, 1, and 2 in wpa_supplicant.conf, none of those settings "just work".

----------

## mamac

Hi,

Just to share an experience, I was unable to connect to my wireless network when the SSID was masked, and it's been working since I unmasked the SSID. If you can try to unmask...

By the way, can you post your wpa_supplicant.conf and /etc/conf.d/net?

----------

## lonrot_m

try using networkmanager, i had a lot of problem with iwlwifi until i started using it and also remmember to add QoS to your kernel.

----------

## cumber

wpa_supplicant.conf:

```
ap_scan=2

# This is a network block that connects to any unsecured access point.

# We give it a low priority so any defined blocks are preferred.

# CUMBER: don't do this, or we steal the neighbour's bandwidth!

#network={

#       key_mgmt=NONE

#       priority=-9999999

#}

# home network

network={

        ssid="can379"

        bssid=00:01:38:96:83:5a

        scan_ssid=1

        proto=WPA2

        key_mgmt=WPA-PSK

        pairwise=CCMP

        group=CCMP

        psk=<my key>

        priority=2

}
```

conf.d/net:

```
HOSTNAME="intyalie"

modules=( "wpa_supplicant" )

wpa_supplicant_wlan0="-Dwext"
```

I could change my SSID to broadcast, but I'd rather get it working without that if it's possible (since occaisionally the laptop will move to other networks whose settings I don't control).

----------

## mamac

Here's my wpa_supplicant.conf:

```

ctrl_interface=/var/run/wpa_supplicant

update_config=0

fast_reauth=1

eapol_version=1

ap_scan=1

network={

        ssid="jmb"

        psk="my_preshared_key_between_quotes"

        pairwise=TKIP

        group=TKIP

        priority=10

}

```

and my /etc/conf.d/net

```

modules=( "wpa_supplicant" )

# It's important that we tell wpa_supplicant which driver we should

# be using as it's not very good at guessing yet

wpa_supplicant_wlan0="-Dwext"

dhcp_wlan0="-N"

config_wlan0=( "dhcp" )

```

If it can help...

By the way, do you use dynamic or static IP?

----------

## mamac

I even changed my wpa_supplicant.conf to something more simple after reading "man wpa_supplicant.conf":

```

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=wheel

network={

        ssid="jmb"

        scan_ssid=1

        key_mgmt=WPA-PSK

        psk="very secret passphrase"

}

```

----------

## cumber

Sorry, thought I'd replied already.

I use dynamic ip addresses, and it works fine once it actually connects. Everything works perfectly as far as I can tell, except that initial step of connecting automatically.

----------

## mamac

Can you post the output of "rc-update -s" ?

----------

## cumber

```
(intyalie:/home/cumber) # rc-update -s

           alsasound | boot                          

           bluetooth |      default                  

            bootmisc | boot                          

             checkfs | boot                          

           checkroot | boot                          

               clock | boot                          

         consolefont | boot                          

                hald |      default                  

            hostname | boot                          

             keymaps | boot                          

               local |      default nonetwork        

          localmount | boot                          

             metalog |      default                  

             modules | boot                          

            net.eth0 |      default                  

              net.lo | boot                          

           net.wlan0 |      default                  

            netmount |      default                  

           rmnologin | boot                          

               samba |      default                  

               spamd |      default                  

             urandom | boot                          

          vixie-cron |      default                  

                 xdm |      default 
```

----------

## mamac

Can you post the output of:

```

#find /lib/modules/YOUR_KERNEL_VERSION/ -iname "*.o" -or -iname "*.ko"|rev|cut -d "." -f 2|cut -d "/" -f 1|rev

```

And the content of your /etc/modules.autoload.d/kernel-2.6 (if 2.6 is what you use)?

Did you try ipw3945 instead of iwlwifi (because iwlwifi is still masked)?

----------

## cumber

```
(intyalie:~) cumber% find /lib/modules/2.6.22-gentoo-r9/ -iname "*.o" -or -iname "*.ko"|rev|cut -d "." -f 2|cut -d "/" -f 1|rev

cbc

pcbc

ioatdma

smsc47b397

i2c-dev

scsi_wait_scan

lcd

ieee80211

ieee80211_crypt

ieee80211_crypt_ccmp

ieee80211_crypt_tkip

ieee80211_crypt_wep

mac80211

rc80211_simple

snd-mixer-oss

snd-pcm-oss

snd-seq-oss

snd-seq-device

snd-seq-midi-event

snd-seq

snd-page-alloc

snd-pcm

snd-rtctimer

snd-timer

snd

snd-hda-intel

soundcore

iwl4965

nvidia
```

```
# /etc/modules.autoload.d/kernel-2.6:  kernel modules to load when system boots.

#

# Note that this file is for 2.6 kernels.

#

# Add the names of modules that you'd like to load when the system

# starts into this file, one per line.  Comments begin with # and

# are ignored.  Read man modules.autoload for additional details.

# For example:

# aic7xxx

#

nvidia

iwl4965

ieee80211_crypt_ccmp
```

Yep, 2.6 kernel. No, I haven't tried ipw3945... does it work with the 4965 hardware?

----------

## Dagger

 *lonrot_m wrote:*   

> try using networkmanager, i had a lot of problem with iwlwifi until i started using it and also remmember to add QoS to your kernel.

 

could you tell me how did you forced networkmanager to work with wpa_supplicant? When I tried to use them I had 

```

Nov 25 17:15:31 [NetworkManager] <info>  Error opening supplicant global control interface._

Nov 25 17:15:31 [NetworkManager] <WARN>  real_act_stage2_config(): Activation (wlan0/wireless): couldn't connect to the supplicant._ 
```

this problem :S

manual config works perfectly, but it's a bit of the pain when you need to connect to the different network.

----------

## mamac

Try to add following modules in /etc/modules.autoload.d/kernel-2.6, reboot and see if it's better (check if modules are loaded correctly at startup):

```

ieee80211

ieee80211_crypt

ieee80211_crypt_tkip

ieee80211_crypt_wep

mac80211

rc80211_simple

```

 *cumber wrote:*   

> 
> 
> No, I haven't tried ipw3945... does it work with the 4965 hardware?
> 
> 

 

I though yes, but...no! Sorry, my mistake...

By the way, you compiled a bunch of modules (specially ALSA modules), why don't you load them at startup?

----------

## cumber

Okay, finally got around to trying that, didn't help. I still get exactly the same behaviour.

I might just have to go read up on how I can get the relevant scripts to run the workaround, although I seem to remember having trouble getting it to work with command line options to wpa_cli rather than starting an interactive session...

 *Quote:*   

> By the way, you compiled a bunch of modules (specially ALSA modules), why don't you load them at startup?

 

Um... I ran through the ALSA guide, and I don't remember it mentioning that step (though I guess it may have been taken as implicit that if you're compiling stuff as kernel modules you go and add them to your autoload file?), and the sound seems to work fine so I left it alone for now (apart from a Doom3 specific issue I managed to find the solution to already).

This is my first Gentoo system, hell it's the first Linux system I'm installing and admining myself, so most things are just in the "it works well enough" stage while I slowly work on getting one thing at a time setup exactly the way I like it.  :Smile: 

----------

## mamac

Would be interesting to use wpa-wupplicant command line and see the output:

```

wpa_supplicant -i eth1 -c /etc/wpa_supplicant/wpa_supplicant.conf -d

```

----------

## cumber

```
(intyalie:/home/cumber) # wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -d

Initializing interface 'wlan0' conf '/etc/wpa_supplicant/wpa_supplicant.conf' driver 'default' 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'

ap_scan=2

eapol_version=2

Priority group 2

   id=0 ssid='can379'

Initializing interface (2) 'wlan0'

EAPOL: SUPP_PAE entering state DISCONNECTED

EAPOL: KEY_RX entering state NO_KEY_RECEIVE

EAPOL: SUPP_BE entering state INITIALIZE

EAP: EAP entering state DISABLED

EAPOL: External notification - portEnabled=0

EAPOL: External notification - portValid=0

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

  capabilities: key_mgmt 0xf enc 0xf

WEXT: Operstate: linkmode=1, operstate=5

Own MAC address: 00:13:e8:7a:a3:7f

wpa_driver_wext_set_wpa

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

ioctl[SIOCSIWAUTH]: Operation not supported

WEXT auth param 4 value 0x0 - wpa_driver_wext_set_drop_unencrypted

ioctl[SIOCSIWAUTH]: Operation not supported

WEXT auth param 5 value 0x1 - Setting scan request: 0 sec 100000 usec

Added interface wlan0

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

Wireless event: cmd=0x8b06 len=12

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

State: DISCONNECTED -> SCANNING

Trying to associate with SSID 'can379'

Cancelling scan request

WPA: clearing own WPA/RSN IE

Automatic auth_alg selection: 0x1

WPA: No WPA/RSN IE available from association info

WPA: Set cipher suites based on configuration

WPA: Selected cipher suites: group 16 pairwise 16 key_mgmt 2 proto 2

WPA: clearing AP WPA IE

WPA: clearing AP RSN IE

WPA: using GTK CCMP

WPA: using PTK CCMP

WPA: using KEY_MGMT WPA-PSK

WPA: Set own WPA IE default - hexdump(len=22): 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00

No keys have been configured - skip key clearing

wpa_driver_wext_set_drop_unencrypted

ioctl[SIOCSIWAUTH]: Operation not supported

WEXT auth param 5 value 0x1 - State: SCANNING -> ASSOCIATING

wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT)

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

wpa_driver_wext_associate

Setting authentication timeout: 60 sec 0 usec

EAPOL: External notification - EAP success=0

EAPOL: External notification - EAP fail=0

EAPOL: External notification - portControl=Auto

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])

Wireless event: cmd=0x8b06 len=12

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

Wireless event: cmd=0x8b1a len=22

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

Wireless event: cmd=0x8b19 len=16

Received 869 bytes of scan results (3 BSSes)

Scan results: 3

Authentication with 00:00:00:00:00:00 timed out.

Added BSSID 00:00:00:00:00:00 into blacklist

State: ASSOCIATING -> DISCONNECTED

wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT)

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

No keys have been configured - skip key clearing

EAPOL: External notification - portEnabled=0

EAPOL: External notification - portValid=0

Setting scan request: 0 sec 0 usec

State: DISCONNECTED -> SCANNING

Trying to associate with SSID 'can379'

Cancelling scan request

WPA: clearing own WPA/RSN IE

Automatic auth_alg selection: 0x1

WPA: No WPA/RSN IE available from association info

WPA: Set cipher suites based on configuration

WPA: Selected cipher suites: group 16 pairwise 16 key_mgmt 2 proto 2

WPA: clearing AP WPA IE

WPA: clearing AP RSN IE

WPA: using GTK CCMP

WPA: using PTK CCMP

WPA: using KEY_MGMT WPA-PSK

WPA: Set own WPA IE default - hexdump(len=22): 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00

No keys have been configured - skip key clearing

wpa_driver_wext_set_drop_unencrypted

ioctl[SIOCSIWAUTH]: Operation not supported

WEXT auth param 5 value 0x1 - State: SCANNING -> ASSOCIATING

wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT)

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

wpa_driver_wext_associate

Setting authentication timeout: 60 sec 0 usec

EAPOL: External notification - EAP success=0

EAPOL: External notification - EAP fail=0

EAPOL: External notification - portControl=Auto

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=0x11003 ([UP][LOWER_UP])

RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added

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

Wireless event: cmd=0x8b06 len=12

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

Wireless event: cmd=0x8b1a len=22

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])

Wireless event: cmd=0x8b19 len=16

Received 1175 bytes of scan results (4 BSSes)

Scan results: 4

Authentication with 00:00:00:00:00:00 timed out.

BSSID 00:00:00:00:00:00 blacklist count incremented to 2

State: ASSOCIATING -> DISCONNECTED

wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT)

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

No keys have been configured - skip key clearing

EAPOL: External notification - portEnabled=0

EAPOL: External notification - portValid=0

Setting scan request: 0 sec 0 usec

State: DISCONNECTED -> SCANNING

Trying to associate with SSID 'can379'

Cancelling scan request

WPA: clearing own WPA/RSN IE

Automatic auth_alg selection: 0x1

WPA: No WPA/RSN IE available from association info

WPA: Set cipher suites based on configuration

WPA: Selected cipher suites: group 16 pairwise 16 key_mgmt 2 proto 2

WPA: clearing AP WPA IE

WPA: clearing AP RSN IE

WPA: using GTK CCMP

WPA: using PTK CCMP

WPA: using KEY_MGMT WPA-PSK

WPA: Set own WPA IE default - hexdump(len=22): 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00

No keys have been configured - skip key clearing

wpa_driver_wext_set_drop_unencrypted

ioctl[SIOCSIWAUTH]: Operation not supported

WEXT auth param 5 value 0x1 - State: SCANNING -> ASSOCIATING

wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT)

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

wpa_driver_wext_associate

Setting authentication timeout: 60 sec 0 usec

EAPOL: External notification - EAP success=0

EAPOL: External notification - EAP fail=0

EAPOL: External notification - portControl=Auto

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=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])

Wireless event: cmd=0x8b06 len=12

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

Wireless event: cmd=0x8b1a len=22

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

Wireless event: cmd=0x8b19 len=16

Received 1175 bytes of scan results (4 BSSes)

Scan results: 4

Authentication with 00:00:00:00:00:00 timed out.

BSSID 00:00:00:00:00:00 blacklist count incremented to 3

State: ASSOCIATING -> DISCONNECTED

wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT)

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

No keys have been configured - skip key clearing

EAPOL: External notification - portEnabled=0

EAPOL: External notification - portValid=0

Setting scan request: 0 sec 0 usec

State: DISCONNECTED -> SCANNING

Trying to associate with SSID 'can379'

Cancelling scan request

WPA: clearing own WPA/RSN IE

Automatic auth_alg selection: 0x1

WPA: No WPA/RSN IE available from association info

WPA: Set cipher suites based on configuration

WPA: Selected cipher suites: group 16 pairwise 16 key_mgmt 2 proto 2

WPA: clearing AP WPA IE

WPA: clearing AP RSN IE

WPA: using GTK CCMP

WPA: using PTK CCMP

WPA: using KEY_MGMT WPA-PSK

WPA: Set own WPA IE default - hexdump(len=22): 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00

No keys have been configured - skip key clearing

wpa_driver_wext_set_drop_unencrypted

ioctl[SIOCSIWAUTH]: Operation not supported

WEXT auth param 5 value 0x1 - State: SCANNING -> ASSOCIATING

wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT)

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

wpa_driver_wext_associate

Setting authentication timeout: 60 sec 0 usec

EAPOL: External notification - EAP success=0

EAPOL: External notification - EAP fail=0

EAPOL: External notification - portControl=Auto

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

RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added

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

Wireless event: cmd=0x8b06 len=12

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

Wireless event: cmd=0x8b1a len=22

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])

Wireless event: cmd=0x8b19 len=16

Received 1175 bytes of scan results (4 BSSes)

Scan results: 4
```

And so on and so forth. Sits for about a minute after each "Scan results: N" line.

----------

## mamac

 *cumber wrote:*   

> 
> 
> ```
> 
> ...
> ...

 

After upgrade to kernel 2.6.23-r3, I have now the same issue and can't get network anymore.

I had to umask ndiswrapper because the stable version doesn't compile against 2.6.23-r3.

cumber, did you succeed to get it work?

Thanks

----------

