# Broadcom 4322, and wpa_supplicant [SOLVED]

## justin_brody

Hello,

I'm trying to get Gentoo going on my new Macbook pro, and am having trouble getting the wireless working.  Here's some basic info about the machine:

```
citta ~ # uname -a

Linux citta 2.6.30-gentoo-r6 #8 SMP Tue Sep 22 12:30:20 EDT 2009 i686 Intel(R) Core(TM)2 Duo CPU P8700 @ 2.53GHz GenuineIntel GNU/Linux

~# lspci

04:00.0 Network controller: Broadcom Corporation BCM4322 802.11a/b/g/n Wireless LAN Controller (rev 01)

```

I'm running broadcom-sta version 5.10.91.9.3 and it seems to have at least basic functionality, since it can detect the right network:

```

citta ~ # iwlist eth1 scan

eth1      Scan completed :

          Cell 01 - Address: 00:14:D1:C4:83:8F

                    ESSID:"JB"

                    Mode:Managed

                    Frequency:2.422 GHz (Channel 3)

                    Quality:5/5  Signal level:-30 dBm  Noise level:-89 dBm

                    IE: IEEE 802.11i/WPA2 Version 1

                        Group Cipher : TKIP

                        Pairwise Ciphers (2) : TKIP CCMP

                        Authentication Suites (1) : PSK

                    IE: Unknown:DD780050F204104A0001101044000102103B000103104700107B4F0A5E138C3667ACC423180803EF3F102100085452454E446E65741023000A5445572D363331425250102400024131104200046E6F6E651054000800060050F204000110110013576972656C6573732031316E20526F75746572100800020004

                    IE: WPA Version 1

                        Group Cipher : TKIP

                        Pairwise Ciphers (2) : TKIP CCMP

                        Authentication Suites (1) : PSK

                    Encryption key:on

                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s

                              9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s

                              48 Mb/s; 54 Mb/s

```

On the other hand, I can't get it to connect properly:

```

/etc/init.d/net.eth1 restart

 * Stopping eth1

 *   Bringing down eth1

 *     Stopping dhcpcd on eth1 ...

  [ ok ]

 *     Shutting down eth1 ...

  [ ok ]

 *     Stopping wpa_cli on eth1 ...

  [ ok ]

 *     Stopping wpa_supplicant on eth1 ...

  [ ok ]

 * Starting eth1

 *   Starting wpa_supplicant on eth1 ...

1253977045.894629: Initializing interface 'eth1' conf '/etc/wpa_supplicant/wpa_supplicant.conf' driver 'wext' ctrl_interface 'N/A' bridge 'N/A'

1253977045.894664: Configuration file '/etc/wpa_supplicant/wpa_supplicant.conf' -> '/etc/wpa_supplicant/wpa_supplicant.conf'

1253977045.894670: Reading configuration file '/etc/wpa_supplicant/wpa_supplicant.conf'

1253977045.894690: ctrl_interface='/var/run/wpa_supplicant'

1253977045.894696: ctrl_interface_group='0'

1253977045.894701: ap_scan=1

1253977045.894705: update_config=1

1253977045.894710: Line: 14 - start of a new network block

1253977045.894718: ssid - hexdump_ascii(len=2):

     4a 42                                             JB

1253977045.894731: proto: 0x1

1253977045.894737: key_mgmt: 0x2

1253977045.894742: pairwise: 0x18

1253977045.894747: group: 0x1e

...

1253977045.914084: Priority group 10

1253977045.914089:    id=0 ssid='JB'

1253977045.914093:    id=1 ssid='FandM-WiFi'

1253977045.914097: Priority group 2

1253977045.914100:    id=2 ssid='NQ2E7'

1253977045.914105:    id=3 ssid='umd-secure'

1253977045.914108: Initializing interface (2) 'eth1'

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

1253977045.914343:   capabilities: key_mgmt 0xf enc 0xf flags 0x0

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

1253977045.921462: Own MAC address: 00:26:08:e9:9c:66

1253977045.921470: wpa_driver_wext_set_wpa

1253977045.921480: wpa_driver_wext_set_key: alg=0 key_idx=0 set_tx=0 seq_len=0 key_len=0

1253977045.921495: wpa_driver_wext_set_key: alg=0 key_idx=1 set_tx=0 seq_len=0 key_len=0

1253977045.921507: wpa_driver_wext_set_key: alg=0 key_idx=2 set_tx=0 seq_len=0 key_len=0

1253977045.921518: wpa_driver_wext_set_key: alg=0 key_idx=3 set_tx=0 seq_len=0 key_len=0

1253977045.921529: wpa_driver_wext_set_countermeasures

1253977045.921543: wpa_driver_wext_set_drop_unencrypted

1253977045.921552: RSN: flushing PMKID list in the driver

1253977045.921562: Setting scan request: 0 sec 100000 usec

1253977045.922385: EAPOL: SUPP_PAE entering state DISCONNECTED

1253977045.922391: EAPOL: KEY_RX entering state NO_KEY_RECEIVE

1253977045.922395: EAPOL: SUPP_BE entering state INITIALIZE

1253977045.922399: EAP: EAP entering state DISABLED

1253977045.922742: ctrl_interface_group=0

1253977045.922775: Added interface eth1

1253977045.922781: Daemonize..

```

Here's the relevant parts of my conf file:

```

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

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

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

ap_scan=1

update_config=1

#network={

#       key_mgmt=NONE

#       priority=-9999999

#}

network={

  ssid="JB"

  proto=WPA

  key_mgmt=WPA-PSK

  pairwise=CCMP TKIP

  group=CCMP TKIP WEP104 WEP40

  psk="******************"

  priority=10

}

```

For what it's worth, it's the same config file I use on my dell-based gentoo box (that one uses built-in b43 driver though).  

The router seems to acknowledge the machine, here's a bit of it's log:

 *Quote:*   

> 
> 
> INFO] Sat Sep 26 10:56:26 2009 Wireless system with MAC address 002608E99C66 disconnected for reason: Received Deauthentication.
> 
> [INFO] Sat Sep 26 10:56:23 2009 Blocked incoming UDP packet from 96.231.168.137:54709 to 98.235.27.195:26315
> ...

 

I'm fresh out of ideas.  Does anyone else have some?Last edited by justin_brody on Mon Dec 28, 2009 3:56 pm; edited 2 times in total

----------

## pappy_mcfae

If you compiled wpa_supplicant with the qt3 USE flag (and/or reportedly the qt4 as well), you will get a program called wpa_gui. This will give you the ability to scan for AP's, and to connect to them if they use WPA, and you know the passphrase. Give that a shot, and see what happens.

Blessed be!

Pappy

----------

## justin_brody

Thanks for the tip!

When I start wpa_gui, I get a current status that says:

 *Quote:*   

> 
> 
> Status:  COMPLETED
> 
> Authentication:  WPA-PSK
> ...

 

All of which looks good.  The IP address, however, is 169.254.135.242.  Does this mean the problem is with dhcpcd?

----------

## justin_brody

A little more info:

If I disconnect and then connect again, I get an intermediate error message that says "Association request to the driver failed".  But then it says "Associated with ..." followed by "WPA:  Key negotiation completed" 

Still not getting an IP address though.  I'm assuming the router settings are fine, because the same machine connects to the same router through OS X.  Any ideas?

----------

## pappy_mcfae

You're not connecting fully. What you need to do is scan for your desired network with wpa_gui. Once the scan is complete, click on your network, fill out the information that wpa_supplicant requests, and go from there. Once you get connected, go to /etc/wpa_supplicant/wpa_supplicant.conf. You will see an entry for the connection you just set up. Move it to the top, make sure you're set for dhcp, and reboot. See where that takes you.

Blessed be!

Pappy

----------

## justin_brody

Hey Pappy,

Same behavior after reboot   :Sad:  .  I'm noticing the CONFIG_SSB_POSSIBLE is set to yes in my kernel conf.  Would that mess me up?  I couldn't figure out how to disable it either - if I just changed it to "n" in the configuration file it would be back at "y" after a make.  Don't know if that's the issue anyway though.

Any other ideas?  [Thanks for all your help by the way!  This is the second time you've helped me out - I'm glad that there's such a kind soul out there!]

----------

## pappy_mcfae

If you're using the b43 module, then ssb must also be a module. If you are using broadcom-sta, you do not want ssb. The ssb driver will mess with broadcom-sta.

Blessed be!

Pappy

----------

## d2_racing

You should post your .config that is related with the wifi section.

----------

## justin_brody

 *Quote:*   

> 
> 
> #
> 
> # CONFIG_USBPCWATCHDOG is not set
> ...

 

For what it's worth, I tried upgrading to broadocm0-sta-5.10.91.9.3-r1 -- no help.    Thanks for your thoughts!

----------

## pappy_mcfae

If you're using broadcom-sta, change CONFIG_MAC80211=y  to CONFIG_MAC80211=n. Broadcom-sta does not use the MAC80211 stack. It is possible it might conflict as well.

Blessed be!

Pappy

----------

## d2_racing

In fact.

----------

## justin_brody

Thanks for the tip -- sorry to take so long to try it out.  I took that out of the kernel, no change unfortunately.  Seems strange, since i know other people have gotten this working with the same hardware.  

I'm going to give up for now and try again in a couple of months   :Sad: 

----------

## d2_racing

Ok, no problem.

----------

## pappy_mcfae

Someone will be here when you're ready. On that, you can depend.

Blessed be!

Pappy

----------

## justin_brody

I'm back   :Laughing: 

Just did a fresh install of the system; same behavior unfortunately.  I saw a recent post where someone had what sounded like a similar issue and fixed it by not broadcasting the SSID.  I tried that but it didn't seem to help.  I do sort of think that the association with the router is going o.k.; but somehow the dhcp part isn't working?  The router seems to see the machine.

Anyway, here's some log stuff.  The wpa_cli output was produced while I tried to connect with wpa_gui.  Any help very appreciated -- I'm missing gentoo greatly  :Sad: 

```

root@citta ~ # wpa_cli 

wpa_cli v0.6.9

Copyright (c) 2004-2009, Jouni Malinen <j@w1.fi> and contributors

This program is free software. You can distribute it and/or modify it

under the terms of the GNU General Public License version 2.

Alternatively, this software may be distributed under the terms of the

BSD license. See README and COPYING for more details.

Selected interface 'eth1'

Interactive modes

> status

bssid=00:14:d1:c4:83:8f

ssid=JB

id=0

pairwise_cipher=CCMP

group_cipher=TKIP

key_mgmt=WPA-PSK

wpa_state=COMPLETED

ip_address=169.254.15.31

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

<2>CTRL-EVENT-SCAN-RESULTS 

<2>Trying to associate with 00:14:d1:c4:83:8f (SSID='JB' freq=2422 MHz)

<2>Association request to the driver failed

<2>Associated with 00:14:d1:c4:83:8f

<2>WPA: Key negotiation completed with 00:14:d1:c4:83:8f [PTK=CCMP GTK=TKIP]

<2>CTRL-EVENT-CONNECTED - Connection to 00:14:d1:c4:83:8f completed (reauth) [id=0 id_str=]

> quit

root@citta ~ # 

root@citta ~ # 

root@citta ~ # 

root@citta ~ # lspci -v

04:00.0 Network controller: Broadcom Corporation BCM4322 802.11a/b/g/n Wireless LAN Controller (rev 01)

   Subsystem: Apple Computer Inc. Device 008d

   Flags: bus master, fast devsel, latency 0, IRQ 22

   Memory at d3200000 (64-bit, non-prefetchable) [size=16K]

   Capabilities: [40] Power Management version 3

   Capabilities: [58] Vendor Specific Information <?>

   Capabilities: [e8] Message Signalled Interrupts: Mask- 64bit+ Count=1/1 Enable-

   Capabilities: [d0] Express Endpoint, MSI 00

   Capabilities: [100] Advanced Error Reporting

      UESta:   DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSVoil-

      UEMsk:   DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSVoil-

      UESvrt:   DLP+ SDES- TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSVoil-

      CESta:   RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-

      CESta:   RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+

      AERCap:   First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-

   Capabilities: [13c] Virtual Channel <?>

   Capabilities: [160] Device Serial Number 26-00-e9-ff-ff-08-66-9c

   Capabilities: [16c] Power Budgeting <?>

   Kernel driver in use: wl

   Kernel modules: wl

root@citta ~ # ifconfig eth1

eth1      Link encap:Ethernet  HWaddr 00:26:08:e9:9c:66  

          inet addr:169.254.15.31  Bcast:169.254.255.255  Mask:255.255.0.0

          inet6 addr: fe80::226:8ff:fee9:9c66/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:52 errors:0 dropped:0 overruns:0 frame:1574

          TX packets:42 errors:6 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:15612 (15.2 KiB)  TX bytes:8233 (8.0 KiB)

          Interrupt:22 

root@citta ~ # cat /etc/conf.d/net

# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /etc/conf.d/net.example and save your configuration

# in /etc/conf.d/net (this file :]!).

modules=( "wpa_supplicant" )

wpa_supplicant_eth1="-Dwext"

dhcpcd_eth1="-r 192.168.10.108"

root@citta ~ # cat /etc/wpa_supplicant/wpa_supplicant.conf 

ctrl_interface=/var/run/wpa_supplicant

ctrl_interface_group=0

ap_scan=1

update_config=1

network={

   ssid="JB"

   psk="*****************"

   proto=WPA

   key_mgmt=WPA-PSK

   priority=100

}

```

----------

## d2_racing

Hi, first your ip adresse is invalid :

```

ip_address=169.254.15.31 

```

Can you try this one instead /etc/conf.d/net :

```

#WPA_SUPPLICANT

modules=( "wpa_supplicant" )

wpa_supplicant_eth1="-Dwext"

config_eth1=( "dhcp" )

```

----------

## hoacker

 *justin_brody wrote:*   

>  *Quote:*   
> 
> # CONFIG_HOSTAP is not set
> 
>  

 

Try changing this option as suggested here: Broadcom 4322 a/b/g/n with WPA & WPA2 working on 2.6.30.

----------

## justin_brody

Yes!!!!  That worked!!!

Thank-you   :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy:   :Very Happy: 

----------

## d2_racing

Nice then  :Razz: 

----------

## hujuice

The solution made the job.

What's funny, for me, is that the hostap module has not been loaded.

 :Shocked: 

Regards,

HUjuice

----------

## wormite

After spending a whole week on this problem, I have reached the final conclusion of BCM4322 on my latitude:

The Broadcom people did a bad job regarding their 802.11n card's driver to work on linux.

For gentoo users here, this is the suggestion:

First, if you are using bcm4322, forget about current (<=2.6.31) kernel support of it, they don't, linuxwireless (google it) said they are still working on it, so I would guess 2.6.33 kernel has the same problem.

Second, forget about ndiswrapper. Currently the windows driver ported to linux doesn't work out of box with 80211n card.

You have only one choice, the broadcom-sta driver.

Its 5.10.xx version works, 5.60.xx currently is broken without the ability to do iwlist scan stably.

Now, if you grab any existing 5.10.xx driver from either suse or ubuntu, since the >2.6.31 driver got deprecated. (Ubuntu probably patched on its kernel to have their Karmic retaining the old 80211 thingy,namely net_device), the module won't compile till you patch the driver source at several places.(net_device and tkip part).

Now, with the patched kernel module, I have tested the module under two cases.

1st, home, wpa/wpa2 with tkip. Does not work.

2nd, school, wpa-enterprise with, obviously, not tkip encry. Works.

My conclusion here: change your home wlan to non-tkip and have a try, if it works, it works.

If anyone is going to play with this, post here and I'll post the patch of 5.10.xx driver source for >=2.6.31.(I didn't patch it very well for <=2.6.29, so I really don't want to let it out unless you are sure you have >=2.6.31 kernel)

I'll follow up my test of the 5.60.xx driver on school network.

Signing off,

worm

----------

## wormite

OK, consider this solved for me. I just tried at home, with wpa2 and encryption as ccmp, it is finally working, my wpa_supplicant file is as the following:

```

# WPA2-EAP/CCMP using EAP-TLS

ctrl_interface=/var/run/wpa_supplicant

network={

    ssid="fredHome"

#my home network is using WPA-PSK

    key_mgmt=WPA-EAP WPA-PSK

 #they WPA2 IS RSN   

proto=WPA2 RSN

    pairwise=CCMP

    group=CCMP

#multiple file formats for your password, enable all of them

    eap=TTLS PEAP TLS

#password

    psk="your password in ASCII"

}

```

The wireless is no longer unstable, having been connected for several hours.

Finally!

----------

