# Problems with wireless connection [solved]

## samo

Hello,

I try to use my Fritz!WLAN USB Stick N with ndiswrapper 1.53 (kernel 2.6.25.11), but I can't connect to my router. The configuration files /etc/conf.d/net and /etc/wpa_supplicant/wpa_supplicant.conf look like this:

```
config_wlan0=( "dhcp" )

modules=( "wpa_supplicant" )

wpa_supplicant_wlan0="-Dwext"

wpa_timeout_wlan0=60
```

```
ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

ap_scan=1

fast_reauth=1

network={

   ssid="Gentoo"

   scan_ssid=1

   proto=RSN

   key_mgmt=WPA-PSK

   pairwise=CCMP TKIP

   group=CCMP

   psk="password"

   priority=2

}
```

```
/etc/init.d/net.wlan0 -> /etc/init.d/net.lo
```

dmesg doesn't show any problem

```
ndiswrapper version 1.53 loaded (smp=no, preempt=yes)

usb 1-5: reset high speed USB device using ehci_hcd and address 4

ndiswrapper: driver fwusbn (AVM Berlin,12/19/2007,4.0.0.48) loaded

wlan0: ethernet device 00:1c:4a:fa:00:d5 using NDIS driver: fwusbn, version: 0x40700, NDIS version: 0x501, vendor: 'Atheros OTUS Wireless Network Adapter', 057C:8401.F.conf

wlan0: encryption modes supported: WEP; TKIP with WPA, WPA2, WPA2PSK; AES/CCMP with WPA, WPA2, WPA2PSK

usbcore: registered new interface driver ndiswrapper

```

With /etc/init.d/net.wlan0 restart I get the following:

```
gentoo thomas # /etc/init.d/net.wlan0 restart

 * Stopping wlan0

 *   Bringing down wlan0

 *     Shutting down wlan0 ...                                                                                         [ ok ]

 *     Stopping wpa_cli on wlan0 ...                                                                                   [ ok ]

 *     Stopping wpa_supplicant on wlan0 ...                                                                            [ ok ]

 * Starting wlan0

 *   Starting wpa_supplicant on wlan0 ...

ioctl[SIOCSIWPMKSA]: Invalid argument                                                                                  [ ok ]

 *   Starting wpa_cli on wlan0 ...                                                                                     [ ok ]

 *     Backgrounding ...

```

And when I start wpa_supplicant it looks like this:

```
gentoo thomas # wpa_supplicant -i wlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf -d -Dwext

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='0' (DEPRECATED)

ap_scan=1

fast_reauth=1

Priority group 2

   id=0 ssid='Gentoo'

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

ioctl[SIOCSIWPMKSA]: Invalid argument

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

  capabilities: key_mgmt 0xf enc 0xf

WEXT: Operstate: linkmode=1, operstate=5

Own MAC address: 00:1c:4a:fa:00:d5

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

wpa_driver_wext_set_drop_unencrypted

Setting scan request: 0 sec 100000 usec

Using existing control interface directory.

ctrl_interface_group=0

ctrl_iface bind(PF_UNIX) failed: Address already in use

ctrl_iface exists, but does not allow connections - assuming it was leftover from forced program termination

Successfully replaced leftover ctrl_iface socket '/var/run/wpa_supplicant/wlan0'

Added interface wlan0

RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])

Wireless event: cmd=0x8b06 len=8

State: DISCONNECTED -> SCANNING

Starting AP scan (specific SSID)

Scan SSID - hexdump_ascii(len=6):

     47 65 6e 74 6f 6f                                 Gentoo

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

Received 1104 bytes of scan results (4 BSSes)

Scan results: 4

Selecting BSS from priority group 2

0: 00:1a:4f:8d:78:52 ssid='WLAN-CB501V' wpa_ie_len=26 rsn_ie_len=0 caps=0x11

   skip - SSID mismatch

1: 00:1c:4a:4f:9e:f9 ssid='Gentoo' wpa_ie_len=0 rsn_ie_len=22 caps=0x11

   selected based on RSN IE

Trying to associate with 00:1c:4a:4f:9e:f9 (SSID='Gentoo' freq=2412 MHz)

Cancelling scan request

WPA: clearing own WPA/RSN IE

Automatic auth_alg selection: 0x1

RSN: using IEEE 802.11i/D9.0

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

WPA: clearing AP WPA IE

WPA: set AP RSN IE - 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

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

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: 10 sec 0 usec

EAPOL: External notification - EAP success=0

EAPOL: External notification - EAP fail=0

EAPOL: External notification - portControl=Auto

RSN: Ignored PMKID candidate without preauth flag

RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])

Wireless event: cmd=0x8b06 len=8

RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])

Wireless event: cmd=0x8b04 len=12

RTM_NEWLINK: operstate=0 ifi_flags=0x1003 ([UP])

Wireless event: cmd=0x8b1a len=14

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=0x8c07 len=54

AssocReq IE wireless event - hexdump(len=46): 00 06 47 65 6e 74 6f 6f 01 04 82 84 8b 96 32 08 0c 12 18 24 30 48 60 6c 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00

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

Wireless event: cmd=0x8c08 len=24

AssocResp IE wireless event - hexdump(len=16): 01 04 82 84 8b 96 32 08 0c 12 18 24 30 48 60 6c

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

Wireless event: cmd=0x8b15 len=20

Wireless event: new AP: 00:1c:4a:4f:9e:f9

Association info event

req_ies - hexdump(len=46): 00 06 47 65 6e 74 6f 6f 01 04 82 84 8b 96 32 08 0c 12 18 24 30 48 60 6c 30 14 01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f ac 02 00 00

resp_ies - hexdump(len=16): 01 04 82 84 8b 96 32 08 0c 12 18 24 30 48 60 6c

WPA: set own WPA/RSN IE - 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

State: ASSOCIATING -> ASSOCIATED

wpa_driver_wext_set_operstate: operstate 0->0 (DORMANT)

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

Associated to a new BSS: BSSID=00:1c:4a:4f:9e:f9

No keys have been configured - skip key clearing

Associated with 00:1c:4a:4f:9e:f9

WPA: Association event - clear replay counter

EAPOL: External notification - portEnabled=0

EAPOL: External notification - portValid=0

EAPOL: External notification - EAP success=0

EAPOL: External notification - portEnabled=1

EAPOL: SUPP_PAE entering state CONNECTING

EAPOL: SUPP_BE entering state IDLE

Setting authentication timeout: 10 sec 0 usec

Cancelling scan request

RX EAPOL from 00:1c:4a:4f:9e:f9

Setting authentication timeout: 10 sec 0 usec

IEEE 802.1X RX: version=2 type=3 length=95

  EAPOL-Key type=2

  key_info 0x8a (ver=2 keyidx=0 rsvd=0 Pairwise Ack)

  key_length=16 key_data_length=0

  replay_counter - hexdump(len=8): 00 00 00 00 00 00 00 01

  key_nonce - hexdump(len=32): 25 73 61 4e 26 39 f3 04 af 03 2f de b6 8f 05 0f 97 31 a7 82 f1 82 c3 f5 22 64 20 10 ec 3b 13 f3

  key_iv - hexdump(len=16): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

  key_rsc - hexdump(len=8): 00 00 00 00 00 00 00 00

  key_id (reserved) - hexdump(len=8): 00 00 00 00 00 00 00 00

  key_mic - hexdump(len=16): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

State: ASSOCIATED -> 4WAY_HANDSHAKE

WPA: RX message 1 of 4-Way Handshake from 00:1c:4a:4f:9e:f9 (ver=2)

RSN: msg 1/4 key data - hexdump(len=0):

WPA: Renewed SNonce - hexdump(len=32): e9 46 21 c3 3e 0f b7 d0 a5 6b 68 fb 14 57 db 8c 27 b2 b1 21 03 71 eb 1d 8d fb 89 32 f3 1d 04 a1

WPA: PMK - hexdump(len=32): [REMOVED]

WPA: PTK - hexdump(len=64): [REMOVED]

WPA: WPA IE for msg 2/4 - 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

WPA: Sending EAPOL-Key 2/4

RX EAPOL from 00:1c:4a:4f:9e:f9
```

Does someone know, what's wrong?

RegardsLast edited by samo on Sat Sep 12, 2009 11:06 am; edited 2 times in total

----------

## samo

I changed /etc/conf.d/net *Quote:*   

> modules=( "ifconfig" )
> 
> config_eth0=( "192.168.178.20 netmask 255.255.255.0 broadcast 192.168.178.255" )
> 
> config_eth1=( "dhcp" )
> ...

 

And now I have network access, but only after I do the following things after power on: *Quote:*   

> 1. /etc/init.d/net.wlan0 stop
> 
> 2. /etc/init.d/net.eth0 start
> 
> 3. /etc/init.d/net.eth0 stop
> ...

 

Does someone know, why I have to start net.eth0first?

----------

## samo

The above described workaround doesn't work any longer. I don't know why.

When I start wpa_supplicant from the command line, my PC is connected to the router.

```
wpa_supplicant -i wlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf -d -Dwext
```

But when I start net.wlan0 I get no connection. I assume, that there is something wrong with my /etc/conf.d/net

```
modules=( "ifconfig" )

modules_wlan0=( "!iwconfig" "wpa_supplicant" )

config_eth0=( "dhcp" )

config_eth1=( "dhcp" )

config_wlan0=( "dhcp" )

wpa_supplicant_wlan0="-Dwext" # For generic wireless

wpa_timeout_wlan0=60
```

----------

## samo

I have installed the following versions:

- wpa_supplicant 0.5.10

- dhcpcd 4.0.1

- ndiswrapper 1.53

I can connect with

```
wpa_supplicant -i wlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf -d -Dwext
```

And I can run dhcpcd manually 

```
gentoo # dhcpcd -d wlan0

wlan0: dhcpcd 4.0.1 starting

wlan0: hardware address = 00:1c:4a:fa:00:d5

wlan0: executing `/lib/dhcpcd/dhcpcd-run-hooks', reason PREINIT

wlan0: DUID = 00:01:00:01:10:69:b3:fb:00:1c:4a:fa:00:d5

wlan0: broadcasting for a lease

wlan0: sending DHCP_DISCOVER with xid 0x3c3a0b0e, next in 4.52 seconds

wlan0: offered 192.168.178.23 from 192.168.178.1

wlan0: checking 192.168.178.23 is available on attached networks

wlan0: sending ARP probe (1 of 3), next in 1.20 seconds

wlan0: sending ARP probe (2 of 3), next in 1.69 seconds

wlan0: sending ARP probe (3 of 3), next in 2.00 seconds

wlan0: sending DHCP_REQUEST with xid 0x3c3a0b0e, next in 3.48 seconds

wlan0: acknowledged 192.168.178.23 from 192.168.178.1

wlan0: leased 192.168.178.23 for 864000 seconds

wlan0: adding IP address 192.168.178.23/24

wlan0: adding route to 0.0.0.0/0 via 192.168.178.1

wlan0: executing `/lib/dhcpcd/dhcpcd-run-hooks', reason BOUND

wlan0: forking to background

```

After manually setting up the connection this way, also /etc/init.d/net.wlan0 restart works.

But executing /etc/init.d/net.wlan0 restart during startup doesn't work.

What wrong?

----------

## uvok

The problem could be that net.eth0 is running.

----------

## samo

I still have problems. My configuration looks like this:

- ndiswrapper 1.53-r1

- linux-2.6.27-gentoo-r8

- wpa_supplicant 0.6.4 with a patch described in http://hostap.epitest.fi/bugz/show_bug.cgi?id=255

net contains the following:

```
# cat /etc/conf.d/net

modules=( "ifconfig" )

modules_wlan0=( "!iwconfig" "wpa_supplicant" )

config_eth0=( "192.168.178.20 netmask 255.255.255.0 broadcast 192.168.178.255" )

config_eth1=( "192.168.178.21 netmask 255.255.255.0 broadcast 192.168.178.255" )

config_wlan0=( "192.168.178.22 netmask 255.255.255.0 broadcast 192.168.178.255" )

wpa_supplicant_wlan0="-Dwext"

wpa_timeout_wlan0=15

routes_eth0=(

        "default via 192.168.178.1" # IPv4 default route

        "10.0.0.0/8 via 192.168.178.1" # IPv4 subnet route

)

fallback_route_eth0=( "default via 192.168.178.1" )

dns_servers_eth0=("208.67.222.222")

routes_eth1=(

        "default via 192.168.178.1" # IPv4 default route

        "10.0.0.0/8 via 192.168.178.1" # IPv4 subnet route

)

fallback_route_eth1=( "default via 192.168.178.1" )

dns_servers_eth1=("208.67.222.222")

routes_wlan0=(

        "default via 192.168.178.1" # IPv4 default route

        "10.0.0.0/8 via 192.168.178.1" # IPv4 subnet route

)

fallback_route_wlan0=( "default via 192.168.178.1" )

dns_servers_wlan0=("208.67.222.222")
```

And wpa_supplicant.conf looks like this:

```
# cat /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

ap_scan=1

fast_reauth=1

network={

        ssid="Gentoo"

        scan_ssid=1

        proto=RSN

        key_mgmt=WPA-PSK

        pairwise=CCMP

        group=CCMP

        psk="password"

        priority=2

}
```

For debugging I start my system without wlan support. After booting I stop the eth0 and eth1 interface. Then I connect the USB stick and start ndiswrapper. After a while (>1 min) dmesg shows the following:

```
usb 1-6: new high speed USB device using ehci_hcd and address 8

usb 1-6: configuration #1 chosen from 1 choice

scsi7 : SCSI emulation for USB Mass Storage devices

usb-storage: device found at 8

usb-storage: waiting for device to settle before scanning

scsi 7:0:0:0: CD-ROM            FRITZ!   WLAN selfinstall 1.00 PQ: 0 ANSI: 0 CCS

sr2: scsi3-mmc drive: 52x/52x cd/rw xa/form2 cdda tray

sr 7:0:0:0: Attached scsi CD-ROM sr2

sr 7:0:0:0: Attached scsi generic sg4 type 5

usb-storage: device scan complete

end_request: I/O error, dev sr2, sector 848

Buffer I/O error on device sr2, logical block 212

end_request: I/O error, dev sr2, sector 848

Buffer I/O error on device sr2, logical block 212

end_request: I/O error, dev sr2, sector 848

Buffer I/O error on device sr2, logical block 212

end_request: I/O error, dev sr2, sector 848

Buffer I/O error on device sr2, logical block 212

end_request: I/O error, dev sr2, sector 848

Buffer I/O error on device sr2, logical block 212

end_request: I/O error, dev sr2, sector 848

Buffer I/O error on device sr2, logical block 212

end_request: I/O error, dev sr2, sector 848

Buffer I/O error on device sr2, logical block 212

end_request: I/O error, dev sr2, sector 848

Buffer I/O error on device sr2, logical block 212

end_request: I/O error, dev sr2, sector 848

Buffer I/O error on device sr2, logical block 212

ndiswrapper version 1.53 loaded (smp=no, preempt=yes)

usbcore: registered new interface driver ndiswrapper

usb 1-6: USB disconnect, address 8

scsi 7:0:0:0: rejecting I/O to dead device

scsi 7:0:0:0: rejecting I/O to dead device

scsi 7:0:0:0: rejecting I/O to dead device

usb 1-6: new high speed USB device using ehci_hcd and address 9

usb 1-6: configuration #1 chosen from 1 choice

usb 1-6: reset high speed USB device using ehci_hcd and address 9

ndiswrapper: driver fwusbn (AVM Berlin,12/19/2007,4.0.0.48) loaded

wlan0: ethernet device 00:1c:4a:fa:00:d5 using NDIS driver: fwusbn, version: 0x40700, NDIS version: 0x501, vendor: 'Atheros OTUS Wireless Network Adapter', 057C:8401.F.conf

wlan0: encryption modes supported: WEP; TKIP with WPA, WPA2, WPA2PSK; AES/CCMP with WPA, WPA2, WPA2PSK
```

But net.wlan0 aborts after timeout

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

 * Starting wlan0

 *   Starting wpa_supplicant on wlan0 ...

ioctl[SIOCSIWPMKSA]: Invalid argument

ioctl[SIOCSIWPMKSA]: Invalid argument                                                                                  [ ok ]

 *     Timed out                                                                                                       [ !! ]
```

Running wpa_supplicant directly works 

```
# wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf

ioctl[SIOCSIWPMKSA]: Invalid argument

ioctl[SIOCSIWPMKSA]: Invalid argument

CTRL-EVENT-SCAN-RESULTS

Trying to associate with 00:1c:4a:4f:9e:f9 (SSID='Gentoo' freq=2412 MHz)

CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys

WPA: Key negotiation completed with 00:1c:4a:4f:9e:f9 [PTK=CCMP GTK=CCMP]

CTRL-EVENT-CONNECTED - Connection to 00:00:00:00:00:00 completed (auth) [id=0 id_str=]
```

It seem's that there is something wrong with net.wlan0. But what?

----------

## samo

Could someone give me a hint?

----------

## stephen.p

Have you looked at this ?

https://bugs.gentoo.org/show_bug.cgi?id=219785

----------

## samo

My routing table is empty:

```
# route

Kernel IP Routentabelle

Ziel            Router          Genmask         Flags Metric Ref    Use Iface

loopback        *               255.0.0.0       U     0      0        0 lo

```

And I get an error, when I try to add one router manually:

```
# route add default gw 192.168.178.1

SIOCADDRT: Network is unreachable

```

----------

## samo

Problem is still pending. Is there anybody how can give me a hint?

----------

## das bletch

Have you tried supplying ndiswrapper as the driver to wpa_supplicant instead of wext?

I don't know if that would help. 

Also, have you successfully connected to the internet wireless to an unencrypted access point? wpa_supplicant is for accessing wpa encrypted points, and it seems like theres a whole lot more of us on here trying to make it work than those who know how to get it to work. 

If you can't access an unencrypted access point, deal with that before wpa_supplicant.

----------

## samo

Fritz!WLAN USB Stick N is now supported by kernel 2.6.31. ndiswrapper isn't necessary anymore.

----------

