# gentoo BCM4312, wpa_supplicant connection problem

## philthi

Hello,

I know this is a frequent question, and I have pored over the gentoo manual, as well as done quite a lot of google searching, plus asking gentoo using colleagues in work for help, as I really do not want to waste your time, but I am truly stuck and would appreciate some help, I will try to be as informative as I can, please let me know if I have missed any important information.

I have a Broadcom BCM4312 wireless network card, the drivers appear to be installed correctly, I have emerged wpa_supplicant (and its gui) and also wireless-tools (I have tried but currently removed wicd also).

My /etc/wpa_supplicant/wpa_supplicant.conf looks like this:

```

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=wheel

update_config=1

network={

    SSID="mySSID"

    psk="myPSK"

}

```

I have created an /etc/init.d/net.wlan0 which is a symbolic link to /etc/init.d/net.lo, this outputs the following.

with start:

```
starting wlan0

    starting wpa_supplicant on wlan0... ok

    starting wpa_cli on wlan0 ... ok

       Backgrounding ... ok
```

with stop:

```
stopping wlan0

   bringing down wlan0

      shutting down wlan0 ... ok

      stopping wpa_cli on wlan0 ... ok

      stopping wpa_supplicant on wlan0 ... ok
```

Interestingly (maybe!), with restart (or an immediate stop and start):

```
stopping wlan0

   bringing down wlan0

      shutting down wlan0 ... ok

      stopping wpa_cli on wlan0 ... ok

      stopping wpa_supplicant on wlan0 ... ok

starting wlan0

SIOCSIFFLAGS: unknown error 132

SIOCSIFFLAGS: unknown error 132

    starting wpa_supplicant on wlan0... ok

    starting wpa_cli on wlan0 ... ok

       Backgrounding ... ok
```

Ok, that would seem to be sufficient background (if more is needed please let me know), now on to where I think the error manifests itself.

When I either open up the wpa_gui (I am a user in the wheel group), or when I run iwevent, I get this text repeated endlessly (I may not have accurately reflected the start and end of the block, as you can imagine, it is difficult to work out where it starts and ends, so I made my best guess):

```
<timestamp> wlan0 New Access Pont/Cell address 00:22:3F:12:5C:5E

<timestamp> wlan0 New Access Point/Cell address:Not-Associated

<timestamp> wlan0 Scan request completed

<timestamp> wlan0 set Essid:off/any

<timestamp> wlan0 Set Mode:Managed

<timestamp> wlan0 Set Frequency:2.412 Ghz (Channel 1)

<timestamp> wlan0 Set Essid: "mySSID"

<timestamp> wlan0 Association Response IEs: <hexadecimal jibber-jabba>
```

This is basically the same in WPA_GUI, the only difference (other than phrasing) is that after it saying:

```
Associated with MAC ADDRESS
```

It then says:

```
CTRL-EVENT_DISCONNECTED bssid=MAC ADDRESS reason=()
```

Things I have tried:

I have re-emerged wpa_supplicant and wireless-tools, 

configuring the network using wicd, and then, being concerned this was actually just interfering, i uninstalled it.

configuring the network from wpa_gui

configuring the network from wpa_supplicant.conf

generating the network configuration with wpa_passphrase

rebooting  :Smile: 

installing knetworktools (but couldnt get that to install, though as I understand it, these are basically different viewing portals to the same sub-system)

changing my router to WEP and changing the network settings accordingly

changing my router through each of its various security systems and modifying my config accordingly (Including no authentication at all)

I have disconnected my ethernet connection, (before all of these tests) to ensure it was not interfering (painstakingly copying all the text by hand to this forum on another PC!)

tried toggling the broadcast/dont broadcast setting on my router

tried resetting the routers wireless passphrase

I can still connect to my wireless router from my iPhone

I do hope I havent gone on too long and sincerely hope someone out there can help me!

----------

## xhakerek

First try to:

-setup your card in kernel

-check firmware version on this site: http://wireless.kernel.org/en/users/Drivers/b43

-install wireless-tools

-stop all services for your wireless card

-connect to your AP by iwconfig...

I have 4315LP and everything worked fine but WEP is not selected by my card driver so you must select hostap driver.

----------

## GungHo

Hi all,

I'm facing nearly the same prob, but my WLAN card is Atheros based  (so no firmware should be needed):

```
# lspci -v

...

03:07.0 Ethernet controller: Atheros Communications Inc. AR2413 802.11bg

NIC (rev 01)

        Subsystem: Atheros Communications Inc. Compex Wireless 802.11

b/g  MiniPCI Adapter, Rev A1 [WLM54G]

        Flags: bus master, medium devsel, latency 168, IRQ 21

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

        Capabilities: [44] Power Management version 2

        Kernel driver in use: ath5k

        Kernel modules: ath5k
```

My box is x86_64, kernel is stable gentoo-sources-2.6.34-r12. I want to use the ath5k driver of the kernel, not madwifi. In dmesg I can see:

```

ath5k 0000:03:07.0: PCI INT A -> GSI 21 (level, low) -> IRQ 21

ath5k 0000:03:07.0: registered as 'phy0'

ieee1394: Host added: ID:BUS[0-00:1023]  GUID[002a144000001fd0]

ath: EEPROM regdomain: 0x809c

ath: EEPROM indicates we should expect a country code

ath: doing EEPROM country->regdmn map search

ath: country maps to regdmn code: 0x52

ath: Country alpha2 being used: CN

ath: Regpair used: 0x52

phy0: Selected rate control algorithm 'minstrel'

ath5k phy0: Atheros AR2413 chip found (MAC: 0x78, PHY: 0x45)

cfg80211: Calling CRDA for country: CN
```

When I do a 

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

 I can see:

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

 * Starting wlan0

 *   Loading networking modules for wlan0

 *     modules: apipa arping bridge ccwgroup macchanger macnet rename

wpa_supplicant essidnet iptunnel iproute2 system dhcpcd ip6to4

 *       wpa_supplicant provides wireless

 *       iproute2 provides interface

 *       dhcpcd provides dhcp

RTNETLINK answers: Unknown error 132

RTNETLINK answers: Unknown error 132

 *   Configuring wlan0 for MAC address 00:21:27:F0:B3:8D ...

  [ ok ]

 *   Starting wpa_supplicant on wlan0 ...

  [ ok ]

 *   Starting wpa_cli on wlan0 ...

  [ ok ]

 *     Waiting for association

  [ ok ]

 *     Backgrounding ...
```

But I can do a 

```
iwlist scan
```

 and can see about 5 WLAN's nearby (all on other channels). But when I perform an 

```
iwconfig
```

, I have never seen a successfull association to my AP, so I believe the above "Waiting for association" is a hint into the direction of the prob. My AP (OpenWRT) is configured to only allow WPA2 (maybe I should give WPA a try   :Wink:  )

My wpa_supplicant is wpa_supplicant-0.7.2-r3. I have also tried with vanilla-sources-2.6.34.5, but been faced with the same prob.

With a recent Debian Lenny and an adequate setup, no prob.

Any hints, suggestions   :Question: 

TIA

----------

## pappy_mcfae

philthi,

Which driver are you using for this device? You have a choice of the in-kernel b43 (not the best driver for it, really), the broadcom-sta driver, or ndiswrapper. I have experience setting up all three drivers.

Cheers,

Pappy

----------

## roarinelk

with most wireless devices, you first have to "ifconfig up" it, otherwise they don't work.

The bcm4312 needs firmware to do anything at all, which is uploaded first when the

interface is brought up.

----------

## GungHo

Hi,

updating to the most recent gentoo-sources-2.6.36-r5 has not changend the misbehaviour. Think I have to twiddle around on wpa_supplicant.

cheers

----------

## Logicien

Hello,

I have a Broadcom BCM4312 wireless card. I work with Debian and ArchLinux on an AMD64 processor. The only driver who I succeed to make work well is the hybrid broadcom-sta wl module. The b43 module, even with the good firmware, can see nodes with iwlist, some times can connect, but is always disconnect fast. The ndiswrapper cause kerneloops with 64 bits Windows drivers. I would like to use b43, but I do not know why I can't.

----------

## pappy_mcfae

Logicien,

While I personally think it's the worst choice, what happens when you try to get the b43 to work?

Cheers,

Pappy

----------

## Logicien

I told it in my last message, but more complete is that b43 load the firmware as dmesg say. I can activate wlan0 with ifconfig. I can scan nodes in the area. The problems starts when I try to connect to an access point. Often I can't and if I can, I am disconnected right away or there's no data transfer between the card and the access point. Then it become impossible to see nodes anymore with iwlist wlan0 scan. I have to unload b43 and restart with the same result.

----------

## pappy_mcfae

I'm going to make a bet that your kernel isn't configured correctly to make the b43 work. Even so, you would do much better with either ndiswrapper or broadcom-sta. The b43 module has always been a not-so-good thing. Where either of the two drivers I mention can reach the full speed of which the device is capable (generally 2 - 2.8 Mb/s), the b43 tends to not go over 1 MB/s. And as you've noticed, it can be persnickety at times as well.

To get you going, please send your .config, the results of lspci -n and cat /proc//cpuinfo as well as your /etc/fstab file, and I'll get you set up your wireless to work properly without b43.

Cheers,

Pappy

----------

## Logicien

I appréciate what you want to do pappy_mcfae, but my BCM4312 is working well with the broadcom-sta driver as I wrote before. I don't want to use an other module than wl until a free driver will work as good. The only thing I have to criticize with broadcom-sta is the close source code of the blob binary include in this hybrid driver. Fine would be the broadcom-sta become completely free and the b43 become completely good. The firmware use by b43 should come free at the same time.

----------

## GungHo

Hi All,

I was able to solve my prob. It was not the kernel, it was a wrong parameter in wpa_supplicant.conf. By using the debug switch of wpa_supplicant I could see that wpa_supplicant tried to do a WPA-EAP based association instead of WPA-PSK. This was caused by a statement "proto=WPA" in wpa_supplicant.conf. I can not remember when I copied this statement into wpa_supplicant.conf, and from where it was coming, may be I copied it from some place in the net, I don't know   :Rolling Eyes: 

Then I tried to copy a few bigger files, but the transfer rate varied wildly between 200kB/s and nearly 2MB/s. The distance between the AP and the antenna is less than 5m, there is no metal between both of them, and I was alone on channel 3. There are other WLANs on channel 1 and channel 6, but with iwconfig I could see that the Link Quality was constantly varying between less than 25 and about 40   :Shocked: 

My antenna is the simple omnidirectional stick which was delivered with the WLAN card, but I can not believe that the electromagnetic field varies so much over such a short distance. May be this is the "noise floor calibration failed" bug   :Evil or Very Mad:  . I'll do some tests with a USB WLAN stick I'm normally using on another box.

Sorry for jumping into this thread. But the "RTNETLINK answers: Unknown error 132" is not a very helpful error message.

Merry christmas and a happy new year   :Very Happy: 

----------

## pappy_mcfae

Cool. At least you have things going.

I personally use ndiswrapper because I can configure some special files, and get my wireless to scream. Broadcom-sta is a close second, and was used a lot before ndiswrapper started working again.

Cheers,

Pappy

----------

