# wpa_supplicant and wireless-tools questions, intel 4965

## Moofar

I'm using iwlwifi in the latest kernel and wireless-tools on a thinkpad x60 notebook. First of all, when I start up and cannot associate with an access point, the command "iwlist wlan0 scan" says failed because wlan0 is not up or something. How can I get around this? I am generally wondering how can I change what access point I am connected to without unloading and reloading the driver module? Also, I get the message that the wireless radio has been killed if I start and stop the service, but if I stop it then do "modprobe -r iwl4965 && modprobe iwl4965", the wlan0 init service somehow starts in the background after loading the module and works. Why does loading the module start the service and is there an easy way to report the service starting success in the terminal? 

Also wpa_supplicant does not work and I'd like any suggestions on getting it to work. I am pasting relavent stuff for that. Would trying ndiswrapper be useful? 

Any comments would be appreciated, I am happy to learn more and test more, but I'm not sure what I should be testing or learning next. 

Heres all the things I can think of to debug wpa_supplicant. The only obvious error message is in the boot.msg.

from lspci:

```

03:00.0 Network controller: Intel Corporation PRO/Wireless 4965 AG or AGN Network Connection (rev 61)

```

/etc/conf.d/net

```
modules=("wpa_supplicant")

wpa_supplicant_wlan0="-Dwext -d"
```

```
#cat wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant

ap_scan=1

network={

   ssid="g2"

    key_mgmt=NONE

}

network={

    key_mgmt=NONE

    priority=-999999

}
```

from boot.msg

```
 * Device initiated services: net.wlan0 udev-postmount

 * Invalidating stale software suspend images ...

  [ ok ]

 * Setting hostname to gl61 ...

  [ ok ]

 * Loading ALSA modules ...

 *   Loading: snd-seq-oss ...

  [ ok ]

 *   Loading: snd-mixer-oss ...

  [ ok ]

 *   Loading: snd-pcm-oss ...

  [ ok ]

  [ ok ]

 * Restoring Mixer Levels ...

  [ ok ]

 * Loading key mappings ...

  [ ok ]

 * Setting terminal encoding to UTF-8 ...

  [ ok ]

 * Setting user font ...

  [ ok ]

 * Starting lo

 *   Loading networking modules for lo

 *     modules: iproute2 system

 *       iproute2 provides interface

 *   Bringing up lo

 *     127.0.0.1/8

  [ ok ]

 *   Adding routes

 *     127.0.0.0/8 ...

  [ ok ]

 * Starting wlan0

 *   Loading networking modules for wlan0

 *     modules: apipa arping ccwgroup macchanger macnet rename wpa_supplicant essidnet iptunnel iproute2 system dhcpcd ip6to4

 *       wpa_supplicant provides wireless

 *       iproute2 provides interface

 *       dhcpcd provides dhcp

 *   Configuring wlan0 for MAC address 00:1D:E0:6B:5A:D9 ...

  [ ok ]

 *   Starting wpa_supplicant on wlan0 ...

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'

ap_scan=1

ctrl_interface='/var/run/wpa_supplicant'

Priority group 0

   id=0 ssid='g2'

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:1d:e0:6b:5a:d9

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

Daemonize..

  [ ok ]

 *   Starting wpa_cli on wlan0 ...

  [ ok ]

 *     Waiting for association

  [ ok ]

 *     Backgrounding ...

 * Initializing random number generator ...

  [ ok ]

  * WARNING netmount is scheduled to start when net.wlan0 has started.
```

tail dmesg:

```
PCI: Setting latency timer of device 0000:03:00.0 to 64

iwl4965: Detected Intel Wireless WiFi Link 4965AGN

ACPI: PCI Interrupt 0000:00:1b.0[B] -> GSI 17 (level, low) -> IRQ 17

hda_intel: probe_mask set to 0x1 for device 17aa:20ac

PCI: Setting latency timer of device 0000:00:1b.0 to 64

iwl4965: Tunable channels: 11 802.11bg, 13 802.11a channels

phy0: Selected rate control algorithm 'iwl-4965-rs'

Clocksource tsc unstable (delta = -198532446 ns)

EXT3 FS on sda3, internal journal

EXT2-fs warning (device sda4): ext2_fill_super: mounting ext3 filesystem as ext2

Adding 4008208k swap on /dev/sda2.  Priority:1 extents:1 across:4008208k

ADDRCONF(NETDEV_UP): wlan0: link is not ready

wlan0: Initial auth_alg=0

wlan0: authenticate with AP 00:12:17:1f:5d:48

wlan0: Initial auth_alg=0

wlan0: authenticate with AP 00:12:17:1f:5d:48

wlan0: RX authentication from 00:12:17:1f:5d:48 (alg=0 transaction=2 status=0)

wlan0: authenticated

wlan0: associate with AP 00:12:17:1f:5d:48

wlan0: authentication frame received from 00:12:17:1f:5d:48, but not in authenticate state - ignored

wlan0: authentication frame received from 00:12:17:1f:5d:48, but not in authenticate state - ignored

wlan0: RX AssocResp from 00:12:17:1f:5d:48 (capab=0x401 status=0 aid=4)

wlan0: associated

wlan0: switched to short barker preamble (BSSID=00:12:17:1f:5d:48)

ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

wlan0: no IPv6 routers present

wlan0: RX deauthentication from 00:12:17:1f:5d:48 (reason=3)

wlan0: deauthenticated

wlan0: authenticate with AP 00:12:17:1f:5d:48

wlan0: RX authentication from 00:12:17:1f:5d:48 (alg=0 transaction=2 status=0)

wlan0: authenticated

wlan0: associate with AP 00:12:17:1f:5d:48

wlan0: RX ReassocResp from 00:12:17:1f:5d:48 (capab=0x401 status=0 aid=4)

wlan0: associated

wlan0: switched to short barker preamble (BSSID=00:12:17:1f:5d:48)
```

from wpa_cli:

```
Selected interface 'wlan0'

Interactive mode

> status

bssid=00:12:17:1f:5d:48

ssid=g2

id=0

pairwise_cipher=NONE

group_cipher=NONE

key_mgmt=NONE

wpa_state=COMPLETED  

ip_address=192.168.1.103

#this next part just comes up on its own when wpa_cli is left on.

> <2>CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys

<2>Associated with 00:12:17:1f:5d:48

<2>CTRL-EVENT-CONNECTED - Connection to 00:12:17:1f:5d:48 completed (reauth) [id=0 id_str=] 
```

----------

## BrummieJim

in /etc/conf.d/net

try

wpa_supplicant_wlan0="-Diwl4965"

instead

I'm having similar problems in https://forums.gentoo.org/viewtopic-p-4957604.html#4957604

----------

## leonidus

I have the following lines in my /etc/conf.d/net

```

preup() {

    if [[ ${IFACE} = "wlan0" ]] ; then

        ifconfig wlan0 up

    fi

    return 0

}

```

That should solve the problem with the interface not being up during boot.

I'm looking for a solution to the stop/start problem without having to unload/load the module again myself.

----------

