# Can't set wlan0 on b43 wireless card by wpa_supplicant

## -=RaV=-

Hi,

I'm trying to set up an Acces point on my Broadcom 4318 chipset card and I'm getting irritating problem.

When I'm trying to run hostapd as an init script I get this message:

```
 * Starting wlan0

 *   Starting wpa_supplicant on wlan0 ...

ioctl[SIOCSIWAUTH]: Operation not supported                                      [ ok ]th param 4 value 0x0 - 

 *   Starting wpa_cli on wlan0 ...                                        [ ok ]

 *     Backgrounding ...

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

Then I realise that my net.wlan0 script starts but it's "inactive".

rc-status shows:

```
net.wlan0                                                          [ inactive ]
```

wpa_supplicant doesn't attach IP and other parameters to it.

Here's the ifconfig output:

```
eth0      Link encap:Ethernet  HWaddr 00:e0:4c:72:5d:99  

          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:33052 errors:0 dropped:0 overruns:0 frame:0

          TX packets:31035 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:5783288 (5.5 MiB)  TX bytes:18815478 (17.9 MiB)

          Interrupt:12 Base address:0xc000 

eth1      Link encap:Ethernet  HWaddr 00:a1:b0:01:34:f6  

          inet addr:XXX.XXX.XXX.XXX  Bcast:XXX.XXX.XXX.XXX  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:116520 errors:0 dropped:0 overruns:0 frame:0

          TX packets:119106 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:24622814 (23.4 MiB)  TX bytes:73377258 (69.9 MiB)

          Interrupt:11 Base address:0xc400 

lo        Link encap:Local Loopback  

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

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

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

          collisions:0 txqueuelen:0 

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 00:22:15:2f:a4:8d  

          UP BROADCAST MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000 

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wmaster0  Link encap:UNSPEC  HWaddr 00-22-15-2F-A4-8D-00-00-00-00-00-00-00-00-00-00  

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000 

          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
```

and the /etc/conf.d/net part with my WLAN settings:

```
modules=( "wpa_supplicant" )

wpa_supplicant_wlan0="-Dwext"

config_wlan0=( "192.168.1.1/24" )

channel_wlan0="6"

essid_wlan0="name"

mode_wlan0="master"
```

and also dmesg output:

```
b43-phy0: Broadcom 4318 WLAN found

Switched to high resolution mode on CPU 0

phy0: Selected rate control algorithm 'pid'

Broadcom 43xx driver loaded [ Features: P, Firmware-ID: FW13 ]

console [netcon0] enabled

netconsole: network logging started

...

eth0: link up, 100Mbps, full-duplex, lpa 0x45E1

eth1: link up, 100Mbps, full-duplex, lpa 0x45E1

eth1: link up, 100Mbps, full-duplex, lpa 0x45E1

b43-phy0: Loading firmware version 410.2160 (2007-05-26 15:32:10)

b43-phy0: Loading firmware version 410.2160 (2007-05-26 15:32:10)

b43-phy0: Radio turned off by software

b43-phy0: Radio turned on by software
```

Thank you very much for your help!

----------

## defenderBG

In your config there is: mode_wlan0="master" 

Do you intend to be the master? There are 2 bcm drivers (ndiswrapper and kernel) I know that one of them does not support being anything else then client. not much of a hint, I know, but try dmesg | tail to see if this is the problem.

----------

## -=RaV=-

I have to be "master" to set up an Acces Point. I use in-kernel driver: b43 and I surely know that it's possible to do what I want, but I'm stuck at this point and have no idea how to solve it.

----------

## IvanMajhen

Try runinng hostapd without starting gentoo network script and post output from it.

```
cd /etc/hostapd

hostapd -dd hostapd.conf
```

I have it working in master mode, it broadcast essid and i can connect to it with my other wlan card in my notebook. 

Next week i'll try to make wirelles repeater from old notebook using two ralink card (one rt73usb other cardbus with 2500 chipset) and then use it to connect to it with b43.

----------

## -=RaV=-

Here's the output of your request without starting net.wlan0 init script:

```
Configuration file: hostapd.conf

ctrl_interface_group=0

Opening raw packet socket for ifindex 5

BSS count 1, BSSID mask ff:ff:ff:ff:ff:ff (0 bits)

wlan0: IEEE 802.11 Fetching hardware channel/rate support not supported.

Flushing old station entries

Deauthenticate all stations

Mode: IEEE 802.11g  Channel: 60  Frequency: 0 MHz

Using interface wlan0 with hwaddr 00:22:15:2f:a4:8d and ssid 'name'

WPA: group state machine entering state GTK_INIT (VLAN-ID 0)

GMK - hexdump(len=32): [REMOVED]

GTK - hexdump(len=32): [REMOVED]

WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)

wlan0: Setup of interface done.

recv: Network is down
```

but I think that my problem occur sooner, in the interface configuration, before starting hostapd. But I might be wrong.

----------

## IvanMajhen

Run it without gentoo net scripts. Just run hostapd with configuration file in etc...

Anyway, this is moj conf:

```
interface=wlan0

driver=nl80211

logger_syslog=-1

logger_syslog_level=2

logger_stdout=-1

logger_stdout_level=2

dump_file=/tmp/hostapd.dump

ctrl_interface=/var/run/hostapd

ctrl_interface_group=0

ssid=test

channel=1

hw_mode=g

beacon_int=100

max_num_sta=255

rts_threshold=2347

fragm_threshold=2346

macaddr_acl=0

ignore_broadcast_ssid=0

tx_queue_data3_aifs=7

tx_queue_data3_cwmin=15

tx_queue_data3_cwmax=1023

tx_queue_data3_burst=0

wme_ac_be_aifs=3

wme_ac_be_cwmin=4

wme_ac_be_cwmax=10

wme_ac_be_txop_limit=0

wme_ac_be_acm=0

wme_ac_vo_aifs=2

wme_ac_vo_cwmin=2

wme_ac_vo_cwmax=3

wme_ac_vo_txop_limit=47

wme_ac_vo_acm=0

ap_max_inactivity=300

eapol_key_index_workaround=0

own_ip_addr=192.168.2.1

dynamic_vlan=0

passive_scan_interval=60

passive_scan_listen=10000

passive_scan_mode=0

ap_table_max_size=255

ap_table_expiration_time=3600

```

----------

## -=RaV=-

Using your configuration (and without any Gentoo net scripts):

An error appears that the driver is invalid:

```
 # hostapd -dd hostapd.conf

Configuration file: hostapd.conf

Line 2: invalid/unknown driver 'nl80211'

ctrl_interface_group=0

1 errors found in configuration file 'hostapd.conf'
```

and my kernel configuration is:

```
 # cat .config | grep -i 802

# CONFIG_VLAN_8021Q is not set

CONFIG_CFG80211=y

CONFIG_NL80211=y

CONFIG_MAC80211=y

CONFIG_MAC80211_RC_DEFAULT_PID=y

# CONFIG_MAC80211_RC_DEFAULT_SIMPLE is not set

# CONFIG_MAC80211_RC_DEFAULT_NONE is not set

# build the algorithm into mac80211.

CONFIG_MAC80211_RC_DEFAULT="pid"

CONFIG_MAC80211_RC_PID=y

# CONFIG_MAC80211_RC_SIMPLE is not set

# CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT is not set

# CONFIG_MAC80211_DEBUG is not set

# CONFIG_IEEE80211 is not set

# CONFIG_WLAN_PRE80211 is not set

CONFIG_WLAN_80211=y
```

After changing driver to 'wired' it outputs:

```
Configuration file: hostapd.conf

ctrl_interface_group=0

Opening raw packet socket for ifindex 5

BSS count 1, BSSID mask ff:ff:ff:ff:ff:ff (0 bits)

wlan0: IEEE 802.11 Fetching hardware channel/rate support not supported.

Flushing old station entries

Deauthenticate all stations

Mode: IEEE 802.11g  Channel: 1  Frequency: 0 MHz

Using interface wlan0 with hwaddr 00:22:15:2f:a4:8d and ssid 'test'

wlan0: Setup of interface done.

recv: Network is down
```

Just the same that I post earlier.

With wpa_supplicant started, the last line:

```
recv: Network is down
```

doesn't appear.

----------

## pappy_mcfae

Update to net-wireless/wpa_supplicant-0.6.4. It is still listed as ~arch, so you would have to either be running ~arch (which you're probably not), or you'd have to unmask it in your /etc/portage/package.keywords thusly:

```
echo "=net-wireless/wpa_supplicant-0.6.4 ~x86" >> /etc/portage/package.keywords
```

If you aren't running x86, substitute your arch in the above statement. Then emerge -av wpa_supplicant. It should update to the new version and stop the error message. 

Blessed be!

Pappy

----------

## IvanMajhen

You don't have libnl compiled for driver=nl80211. Recompile it and then remerge hostapd. You should see that it is enabled when portage is running configure. You should also have link linux pointing to your configured kernel. Kernel must have CONFIG_NL80211=y.

Which kernel are you using?

----------

## -=RaV=-

pappy_mcfae, so I have now wpa_supplicant-0.6.4 and the error message really doesn't appear but my net.wlan0 script is still inactive when I start it (it still doesn't attach anything to my wireless interface). So it didn't solve the problem.

IvanMajhen, I have libnl compiled in my kernel. I list my kernel configuration in post above. There is CONFIG_NL80211=y in it and I have link 'linux' in my /usr/src/

I'm using 2.6.25-hardened-r10 kernel.

----------

## pappy_mcfae

Then you aren't connecting. Do you have the firmware installed? Did you set up b43 as a module? If not, do so. Did you set up Silicon Sonics Backplane as a module as well? If not, do so. 

You can try dropping the encryption to get things going, then turn it back on. At least that will eliiminate wpa_supplicant as a potential problem.

Blessed be!

Pappy

----------

## IvanMajhen

You need package libnl from portage and CONFIG_NL80211 in kernel for hostap to support new mac80211 drivers, and after that recompile hostap. First try without wpa_supplicant so that you can be sure that your kernel/b43 works with hostap. 

I can confirm that b43 from linux-2.6.28-rc6-zen1, libnl-1.1-r1, hostapd-0.6.4 works great as AP.

Just ditch gentoo scripts so that you can first test it and debug it.

----------

## -=RaV=-

pappy_mcfae,

I've got firmware installed already, folowing this howto: http://linuxwireless.org/en/users/Drivers/b43#devicefirmware

I didn't have those drivers compiled as a modules, but now I have and it doesn't change anything.

IvanMajhen,

I've got libnl package and CONFIG_NL80211=y in my kernel already. And I even recompile hostapd again just to be sure. It still doesn't work.

Then I tried to run hostapd without wpa_supplicant (using iwconfig, with and without Gentoo init scripts) and it starts almost normally:

```
 # /etc/init.d/hostapd start

 * Starting wlan0

 *   Configuring wireless network for wlan0

Error for wireless request "Set Mode" (8B06) :

    SET failed on device wlan0 ; Invalid argument.

 *   wlan0 does not support setting the mode to "master"

 *     wlan0 connected to ESSID "test" at 00:00:00:00:00:00

 *     in managed mode on channel 6 (WEP disabled)

 *   Bringing up wlan0

 *     192.168.1.1                                                        [ ok ]

 * Starting hostapd ...

Configuration file: /etc/hostapd/hostapd.conf                             [ ok ]
```

In this case iwconfig can't set Master mode on my card, so I tried to do so manually and it prints the same error:

```
 # iwconfig wlan0 mode master

Error for wireless request "Set Mode" (8B06) :

    SET failed on device wlan0 ; Invalid argument.
```

hostapd is working but it can't controll my card if it's not in master mode.

I don't know what is going on. There shouldn't be any problems with this chipset, because it's widely and succesfully used in Linux as Acces Point.

----------

## pappy_mcfae

I'm not sure if it even works with or supports master mode. I've never tried. I find that the b43 module likes to reject iwconfig statements that tell the driver to do something other than operate in managed mode. 

Blessed be!

Pappy

----------

## IvanMajhen

Which version of libnl do you have?

Maybe you kernel is too old. You are on stable arch?

----------

## Audiossis

Hi all,

I'm having the same problem with b43 on a bcm4306(rev 3) based card. No matter what I do I cannot get the card to start in master mode.

I am using 2.6.28 kernel and headers.

I have tried the unmodified b43 kernel driver and I've also tried several patch methods I've seen googling around. Nothing seems to work.

Strangely enough though, when I start hostapd, I get:

~# hostapd -dd /etc/hostapd/hostapd.conf

Configuration file: /etc/hostapd/hostapd.conf

ctrl_interface_group=0

Opening raw packet socket for ifindex 0

BSS count 1, BSSID mask ff:ff:ff:ff:ff:ff (0 bits)

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

Allowed channel: mode=1 chan=1 freq=2412 MHz

Allowed channel: mode=1 chan=2 freq=2417 MHz

Allowed channel: mode=1 chan=3 freq=2422 MHz

Allowed channel: mode=1 chan=4 freq=2427 MHz

Allowed channel: mode=1 chan=5 freq=2432 MHz

Allowed channel: mode=1 chan=6 freq=2437 MHz

Allowed channel: mode=1 chan=7 freq=2442 MHz

Allowed channel: mode=1 chan=8 freq=2447 MHz

Allowed channel: mode=1 chan=9 freq=2452 MHz

Allowed channel: mode=1 chan=10 freq=2457 MHz

Allowed channel: mode=1 chan=11 freq=2462 MHz

Hardware does not support configured mode

wlan0: IEEE 802.11 Hardware does not support configured mode (0)

Could not select hw_mode and channel. (-1)

wlan0: Unable to setup interface.

rmdir[ctrl_interface]: No such file or directory

But if if run iwconfig immediately after that I get:

~# iwconfig

lo        no wireless extensions.

wmaster0  no wireless extensions.

wlan0     IEEE 802.11bg  Mode:Master  Frequency:2.412 GHz  Tx-Power=27 dBm

          Retry min limit:7   RTS thr:off   Fragment thr=2352 B

          Encryption key:off

          Power Management:off

          Link Quality:0  Signal level:0  Noise level:0

          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

Running iw list yeilds:

# iw list

Wiphy phy0

        Band 1:

                Frequencies:

                        * 2412 MHz [1] (27.0 dBm)

                        * 2417 MHz [2] (27.0 dBm)

                        * 2422 MHz [3] (27.0 dBm)

                        * 2427 MHz [4] (27.0 dBm)

                        * 2432 MHz [5] (27.0 dBm)

                        * 2437 MHz [6] (27.0 dBm)

                        * 2442 MHz [7] (27.0 dBm)

                        * 2447 MHz [8] (27.0 dBm)

                        * 2452 MHz [9] (27.0 dBm)

                        * 2457 MHz [10] (27.0 dBm)

                        * 2462 MHz [11] (27.0 dBm)

                        * 2467 MHz [12] (disabled)

                        * 2472 MHz [13] (disabled)

                        * 2484 MHz [14] (disabled)

                Bitrates:

                        * 1.0 Mbps

                        * 2.0 Mbps (short preamble supported)

                        * 5.5 Mbps (short preamble supported)

                        * 11.0 Mbps (short preamble supported)

                        * 6.0 Mbps

                        * 9.0 Mbps

                        * 12.0 Mbps

                        * 18.0 Mbps

                        * 24.0 Mbps

                        * 36.0 Mbps

                        * 48.0 Mbps

                        * 54.0 Mbps

        Supported interface modes:

                 * IBSS

                 * Station

                 * AP

                 * AP(VLAN)

                 * WDS

                 * Monitor

                 * mesh point

dmesg outputs:

~#dmesg

input: b43-phy0 as /class/input/input10

b43-phy0: Loading firmware version 410.2160 (2007-05-26 15:32:10)

b43-phy0 debug: Chip initialized

b43-phy0 debug: 30-bit DMA initialized

Registered led device: b43-phy0::tx

Registered led device: b43-phy0::rx

Registered led device: b43-phy0::radio

b43-phy0 debug: Wireless interface started

b43-phy0 debug: Adding Interface type 3

b43-phy0 debug: Removing Interface type 3

b43-phy0 debug: Wireless interface stopped

b43-phy0 debug: DMA-30 rx_ring: Used slots 0/64, Failed frames 0/0 = 0.0%, Average tries 0.00

b43-phy0 debug: DMA-30 tx_ring_AC_BK: Used slots 0/128, Failed frames 0/0 = 0.0%, Average tries 0.00

b43-phy0 debug: DMA-30 tx_ring_AC_BE: Used slots 0/128, Failed frames 0/0 = 0.0%, Average tries 0.00

b43-phy0 debug: DMA-30 tx_ring_AC_VI: Used slots 0/128, Failed frames 0/0 = 0.0%, Average tries 0.00

b43-phy0 debug: DMA-30 tx_ring_AC_VO: Used slots 0/128, Failed frames 0/0 = 0.0%, Average tries 0.00

b43-phy0 debug: DMA-30 tx_ring_mcast: Used slots 0/128, Failed frames 0/0 = 0.0%, Average tries 0.00

So iwconfig reports that the card IS in master mode but hostapd still doesn't start. I know that this card does support master mode because I salvaged it from a dead netcomm router. I can put the card in ad-hoc or managed mode and it works fine. I can even get it into monitor mode (aircrack) and it appears to work ok. I don't know what WDS or meshpoint modes are so I haven't tried them.

Any clues?

Thanks,

Ben

System:

3.0GHz P4

1GB RAM

Broadcom BCM4306 (rev 3) PCI

Kernel-2.6.28

Kernel-headers-2.6.28

libnl-1.1-r1

hostapd-0.6.6

crda-0.9.5

iw-0.9.7

compat-wireless-2009-01-11

wireless-regdb-20081117

References:

http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=blob_plain;f=hostapd/hostapd.conf

http://linuxwireless.org/en/users/Drivers/b43

http://en.gentoo-wiki.com/wiki/Wireless/Access_point#Find_and_enable_your_drivers

http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?style=printable&part=4&chap=4

http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=blob_plain;f=wpa_supplicant/wpa_supplicant.conf

http://wireless.erley.org/stable.html

http://wireless.erley.org/git.html

http://wireless.kernel.org/download/

http://www.gentoo-wiki.info/Broadcom_43xx

http://aircrack-ng.org/doku.php?id=mac80211&DokuWiki=69e6f53b393c06b0c18fafeec7a5f6da

http://johannes.sipsolutions.net/patches/kernel/all/LATEST/

http://linuxwireless.org/en/users/Drivers/b43/faq

http://www.myscienceisbetter.info/2008/04/configure-broadcom-wireless-using-compat-wireless.html

http://forum.openwrt.org/viewtopic.php?id=15443&p=3

----------

## Audiossis

** BUMP **

----------

## pappy_mcfae

Please post your kernel .config, the results of lspci -n, as well as your /etc/conf.d/net, etc/resolv.conf and etc/fstab files. I'll check out your kernel and all your other configuration stuff. 

I have the b43 working on two systems. That number is soon to dwindle since Broadcom finally released a real Linux module for some of their wireless devices. I downloaded it, but haven't had a chance to set it up. I'm going to do that tonight.

Blessed be!

Pappy

----------

## Audiossis

Thanks for the suggestion Pappy, but I'm not sure it'll work for me. I'm using a 4306(rev 3). The link you posted says that the driver is for 4311/2 and 4321/2 based cards.

I suppose it'll be worth trying though.

Kernel .config:

*** EDIT *** Sorry it seems I might have messed up when post this the first time!   :Embarassed: 

** EDIT *** there doesn't seem to be enough space. My kernel .config is about 85K and every time I post it here, the forum concatenates it.

*** EDIT ***My kernel .config is posted here: http://pastebin.com/m2689c23fLast edited by Audiossis on Wed Jan 21, 2009 9:21 am; edited 3 times in total

----------

## Audiossis

Sorry, It wouldn't let me post any more info....

here's the rest...

/etc/conf.d/net:

 *Quote:*   

> 
> 
> ######################### Wireless Interface ###################################
> 
> #modules=( "wpa_supplicant" )
> ...

 

/etc/resolv.conf:

 *Quote:*   

> 
> 
> nameserver 210.15.254.240
> 
> nameserver 210.15.254.241
> ...

 

I don't quite understand why you want /etc/fstab, but here it is:

 *Quote:*   

> 
> 
> # /etc/fstab: static file system information.
> 
> # <fs>			<mountpoint>	<type>		<opts>			<dump/pass>
> ...

 

output of lspci | grep Broadcom

 *Quote:*   

> 
> 
> lspci | grep Broadcom
> 
> 02:01.0 Network controller: Broadcom Corporation BCM4306 802.11b/g Wireless LAN Controller (rev 03)
> ...

 

and output of lspci -n

 *Quote:*   

> 
> 
> ~ # lspci -n
> 
> 00:00.0 0600: 8086:2570 (rev 02)
> ...

 

----------

## Audiossis

Update...

I just tried to build the driver from Broadcom and it failed for me.

I followed the instructions at http://www.broadcom.com/docs/linux_sta/README.txt, but the first time it it failed with:

 *Quote:*   

> 
> 
> # make -C /lib/modules/2.6.28-gentoo/build M='pwd'
> 
> make: Entering directory `/usr/src/linux-2.6.28-gentoo'
> ...

 

and doing just make ended with

 *Quote:*   

> 
> 
> ~ # make
> 
> make ** No Targets/  Stop.
> ...

 

The readme also says that they've included a pre-built binary but when I tried to load it:

 *Quote:*   

> 
> 
> ~ # insmod ./wlc_hybrid.o_shipped
> 
> insmod: error inserting './wlc_hybrid.o_shipped': -1 Invalid module format
> ...

 

Then I really looked at the first error message and realized that a crucial step had been obfuscated in the readme file. After extracting the downloaded tar.gz file, one must copy the extracted files to /usr/src/linux/pwd in order for it to compile.

I did that and then re-run:

 *Quote:*   

> 
> 
> # make -C /lib/modules/2.6.28-gentoo/build M='pwd'
> 
> make: Entering directory `/usr/src/linux-2.6.28-gentoo'
> ...

 

I'm not sure what the modpost warning is all about but it doesn't seem critical.

I then tried:

 *Quote:*   

> 
> 
> # insmod /usr/src/linux/pwd/wl.ko
> 
> insmod: error inserting '/usr/src/linux/pwd/wl.ko': -1 Unknown symbol in module
> ...

 

but unfortuneately it does not seem to like my hardware.

dmesg showed:

 *Quote:*   

> 
> 
> b43-pci-bridge 0000:02:01.0: PCI INT A disabled
> 
> No module found in object
> ...

 

It was worth a try though.

----------

## pappy_mcfae

Audiossis, 

I didn't get all of your .config. Please edit the message where you sent it, and resend the whole thing. I use etc/fstab to make sure your file system drivers are set properly. When I go through a kernel .config, I go through it, from top to bottom. I like to make sure it's as speedy, full featured, and yet as light as possible. It's my hobby within this hobby.

Experimentation is a good thing. Sometimes it yields unexpected results, and that's when things get interesting.  :Smile: 

Blessed be!

Pappy

----------

## Audiossis

I couldn't post the entire file. I tried three times but the file is just too big for this forum (85K) and it always wound up concatenated. It also seemed to play funny buggers with the thread It caused every post after the kernel post to display incorrectly (on my machine anyway). As soon as I removed it the display went back to normal.

Can I email it to you instead?

----------

## pappy_mcfae

Actually, if it's that big, post it at http://pastebin.com. Once you send it there, it will send you back a URL. Post the URL in the same message that already contains the truncated .config. That will save some space...not much, mind you, but some.

Blessed be!

Pappy

----------

## Audiossis

I've just noticed that the 2.6.28-r1 kernel has been released. I'm going to compile with my current settings and try it out.

----------

## pappy_mcfae

Ok, and while you do that, I'll go through your .config.

Blessed be!

Pappy

----------

## pappy_mcfae

Was your .config created with genkernel --all? It sure looked it.

I decided it was better for many reasons to start out with one of my seeds, and build from there. The only thing I'm iffy about is the RAID. I've never set one up. However, the kernel told me to say, "yes," to all the RAID settings, so I did. It should work. I know the rest of the devices are set properly according to your lspci -n

Click here for your new .config. Compile as is before making any modifications.

For the best results, please do the following:

1) Move your .config file out of your kernel source directory (2.6.28-gentoo).

2) Issue the command make mrproper. This is a destructive step. It returns the source to pristine condition. Unmoved .config files will be deleted!

3) Copy my .config into your source directory.

4) Issue the command make && make modules_install.

5) Install the kernel as you normally would, and reboot.

6) Once it boots, please post /var/log/dmesg so I can see how things loaded.

This last step is important. As the kernel is set, as long as it boots, b43 should load automatically. I need to see if this is actually loading. /var/log/dmesg will surely show me.

Blessed be!

Pappy

----------

## Audiossis

Yes, I almost always use genkernel --all. I know I had lots included in my kernel. Thats a result of experimentation with a lot of different things. Inevitably it resulted in a somewhat bloated kernel that I never got around to cleaning up, I figured, I'm not all that concerned with the size of the kernel on this machine just it's functionality. If it ain't broke don't fix it. Besides fine tuning a kernel is not my strong point.

I'm very glad you didn't mess with the RAID settings!!  I always keep backups of my data, but it's still a major pain when my RAID array breaks.

Thanks for that pappy, I'll try it out later tonight.

I've just finished compiling 2.6.28-r1 and I've updated to hostapd-0.6.7 from portage, but it seems to still be broken (for me).

emerge reported that the nl80211 module was enabled and built but when I try to start hostapd, it just segfaults.

 *Quote:*   

> 
> 
> # hostapd -dd /etc/hostapd/hostapd.conf
> 
> Configuration file: /etc/hostapd/hostapd.conf
> ...

 

dmesg doesn't show anything unusual except the segfault line at the bottom:

 *Quote:*   

> 
> 
> input: b43-phy0 as /class/input/input5
> 
> b43 ssb0:0: firmware: requesting b43/ucode5.fw
> ...

 

I tried to build it manually, including only nl80211 in the hostapd .config file, but it still just segfaults.

I'll try your kernel config next.

*** EDIT ***

Compile output looks OK, a few warnings but nothing too serious I don't think.

Rebooting.........

----------

## Audiossis

OK rebuilt 2.6.28-r1 kernel with your .config.

dmesg ouput is here: http://pastebin.com/m278ad09a

I must say that it did boot a bit quicker although some stuff did break. Mostly networking stuff like the bonding driver, tun/tap.....etc

Nvidia drivers and virtualbox modules also broke but I kind of expected that to happen.

It also broke my multiseat setup. Not because the nvidia drivers failed to load. Although it is installed, I'm not currently using the proprietary nvidia driver, but I'm instead using the open source nv driver. The cause is something deeper.

I wasn't able to get any info regarding the multiseat break, because as usual, when it happened the entire system crashed. I couldn't even ssh in from my laptop. The dmesg output I posted is everything up to the point where the X server and gdm are started, which is the very last action in the boot sequence. I used interactive boot to bypass the running of the local script thus stopping gdm and X from starting. I then logged in on the console as root and dumped the dmesg output to a file. Rebooted into my stable kernel and... well you know the rest.

Interesting that your configuration doesn't use an initram file system. I got used to using them when setting up my diskless machines. I used a home brew initramfs to do all the network initialization and mount the nfs root filesystem, because it was quicker and easier to modify for testing. Was good fun and after becoming familiar with it, I adopted the initramfs format as my own de-facto standard for all of my machines.

----------

## pappy_mcfae

I thought I set up intramfs. I must have missed that one in the melee that was kernel day. All the machines got kernel upgrades, so I was doing kernel work all day yesterday...kernel day.

I'm glad it's working better for you. Now that you're at this point, you can add the broken bits, and still wind up with a much more compact, sane kernel. Just don't enable CPU scheduling or grouping. It slows down systems, and as far as I know, it's still more or less plumbing in the kernel without the fixtures to make it useful. I have yet to read of any userspace apps to go with it.

I'm also really glad the RAID worked. I guess it's easier to set up a RAID than I thought. Well, now I have something else to think about building when I get the cash.

Blessed be!

Pappy

----------

## Audiossis

Well.....er...um... on closer inspection you did in fact set up an initramfs in the config...... I wonder why it didn't install then....   :Embarassed: 

I did:

 *Quote:*   

> 
> 
> # make mrproper
> 
> 

 

Then I copied the .config file to /usr/src/linux and did:

 *Quote:*   

> 
> 
> # make && make modules_install && make install
> 
> 

 

so I'm not sure why it didn't build/install the initramsfs. Not that it matters, with that config, because it still booted.

From a kernel point of view, setting up RAID is quite easy. It's partitioning your disks and remembering, or mapping, which partitions belong to which arrays, that is hard.

Especially when problems occur and you have to manually re-assemble the array in order to mount it.

My RAID array is nothing special, as a matter of fact, I've commited a cardinal sin and used two SATA and two PATA disks to create four arrays that each span all four disks. Many have reported instabilities with this type of arrangement, but mine has worked fine across two or three mainboard/CPU upgrades.

I'll have a play around with it today (I'm on an rostered day off) and see what I can come up with.... I might try building it with genkernel instead, just to see what it does.

----------

## pappy_mcfae

I keep a copy of all my finshed .configs, so if you need it again, let me know.

Blessed be!

Pappy

----------

## Audiossis

Well, spent the day compiling and re-compiling the kernel with your config file as a starting point. I had to make a few changes to get all my devices working.

See it here: http://pastebin.com/m16f1bb2e

It is lighter and it does run faster. I tried not to make too many changes, only what was required to work with my system. Sadly though hostapd still fails to start.

No matter what I do, ever since I changed to 2.6.28-r1, it seems even less likely to work. Now it just segfaults all the time. I can't even make it attempt to start wlan0.

----------

## pappy_mcfae

Drop hostapd. Since you're using the b43 module, just use the b43 module. As much as I don't like b43, it works just fine all by itself, without hostapd. What are you using hostapd for?

Blessed be!

Pappy

----------

## Audiossis

I was under the impression that hostapd was required as an authentication and connection management server........

Anyway, it still doesn't work, even without hostapd. Below is my /etc/conf.d/net:

 *Quote:*   

> 
> 
> ########################## Wireless Interface ###################################
> 
> modules=( "wpa_supplicant" )
> ...

 

The interface seems to start OK but, iwconfig reports that the card is is managed mode not master mode.

----------

## Audiossis

WOOO-HOOO!!!! Progress!!!

As it turns out, it seems that master mode is still not supported in the kernel.

I updated to compat-wireless-2009-01-23 and after re-compiling the kernel a few more time to get the required symbols, the patched b43, mac80211, ssb and nl80211 drivers installed with only minor warnings.

I then looked at my hostapd.conf file again. I set the country code to AU (for Australia), but when I tried to start hostapd it gave me the same error I had in the first post I made to this thread. This was a minor progression as I haven't gotten this far yet with the 2.6.28-r1 kernel.

 *Quote:*   

> 
> 
> # hostapd -dd /etc/hostapd/hostapd.conf
> 
> Configuration file: /etc/hostapd/hostapd.conf
> ...

 

So I reviewed hostapd.conf again. and noticed that the hw_mode option was set to hw_mode=a. Comparing this to the hostapd.conf file here: http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=blob_plain;f=hostapd/hostapd.conf

I realized that this isn't correct. It should be hw_mode=g.

I made the change and re-tried hostapd.

It still didn't start BUT, the error messages have changed and I feel that now it is just a configuration problem.

 *Quote:*   

> 
> 
> # hostapd -dd /etc/hostapd/hostapd.conf
> 
> Configuration file: /etc/hostapd/hostapd.conf
> ...

 

I'm all excited now!!!   :Very Happy: 

Will keep you posted of further developments!

*** EDIT ***

OK with the ssid correctly set, hostapd no longer exits with errors. Instead, starting it from the command line causes it to continuously issue messages! It seems to be running.

The access point is now visible to my laptop. I still can't ping between the AP and the laptop but I think that's being caused by differences in the encryption setup (or lack thereof) between the machines.

We're getting there!  :Laughing: 

----------

## pappy_mcfae

YAY, I love hearing of progress! Please keep me posted.

Blessed be!

Pappy

----------

## Audiossis

I'm having problems with association from the laptop. I can't figure out how to make hostapd default to IPv4 over IPv6. I'm playing with the laptop now and compiling in support for IPv6. It'll take a while.....

We are definitely going though, I can see the laptop trying to associate in the output of hostapd.

Will keep you posted.....

----------

## Audiossis

OK, after many days of trying, I have come to the conclusion that something I did to the kernel .config, has broken wpa_supplicant. I suspect it is a problem with the kernel because I used the same .config file you provided pappy, for both my desktop and laptop, and where wpa_supplicant has worked on both of these machines in the past, it now doesn't. For the laptop config, I changed only the required hardware drivers and cpu type.

This is also at the root of the hostapd issue. The symptoms are the same no matter what I do with hostapd or wpa_supplicant. I can associate with several access points from each machine but I get the error:

 *Quote:*   

> 
> 
> ioctl[SIOCGIFADDR]: Cannot assign requested address
> 
> 

 

I can also get the laptop to associate with my b43 based AP in the desktop, but again no IP address. I could get an IPv6 address on the desktop at one point but not on the laptop. I have since removed all support for IPv6 from the kernel on both machines.

It is worth noting at this point that I can get the adaptor in each machine to work with iwconfig in both open and encrypted modes (WEP). It is also worth noting that b43 is less likely to be the issue here because I'm using an Atheros 5523 USB wifi adaptor on the laptop with ndiswrapper and it has excactly the same symptoms. It's something deeper.

All my hardwired networks are running fine.

I've tried re-emerging wpa_supplicant, but it hasn't made any difference.

Pappy, what are your thoughts?

----------

## pappy_mcfae

Drop hostapd for the moment. Get the b43 module working without it. Once it works, then you can turn hostapd back on, and see if you still connect. 

I'm no expert on wireless, but to my mind, simple is always best. It's far simpler to run with just the needed module (b43) than to try to run things through hostapd as well. That's an added level of complexity that might be causing your problems. In the immortal words of Lt. Cmdr. Montgomery Scott, "The fancier you make the plumbing, the easier it is to stop up the drain."

Blessed be!

Pappy

----------

## Audiossis

Sorry it's been so long between posts.

I have made progress though. I finally got wpa_supplicant to work with the broadcom device in my desktop. I'm not sure which switch it was in the kernel .config, because I turned on a few things that I thought might be related. I suspect that it was the inclusion in support for b43_phy but I did re-include IPv6 support as well as a few other things.

My broadcom b43 device can now (once again) connect with full wpa encryption, to my D-Link G604T. It gets an IPv4 address now and I can ping the gateway etc...

See my new kernel .config for the desktop machine here: [url] http://pastebin.com/m16a095ff [/url]

Sadly though hostapd is still not confirmed working. I still cant get an IPv4 address on the laptop when connecting to the desktop, using the desktop as an AP.

I suspect that there are two problems 1> the laptop can only connect to the D-Link in unencrypted mode, meaning that it will probably only connect to the desktop unencrypted 2> hostap on the desktop still isn't configured correctly.

The laptop can associate with the desktop in both encrypted and unencrypted modes, but it only gets an IPv6 address.

Don't worry I'm not silly enough to try using both wpa_supplicant and hostap simultaneously.

I just thought of something though, I should have tried this earlier. I'll try booting the laptop on Windoze and see if it can connect to the desktop then!

Will keep you posted...  :Smile: 

----------

## pappy_mcfae

Please do.

Blessed be!

Pappy

----------

## Audiossis

GOT IT!!!

It turned out to be a bad netmask in the b43 interface that was preventing correct operation!

I didn't see it until a genius by the name of Pat Erley pointed out to me in an IRC chat. I had wlan0 configured with a netmask of 255.0.0.0 but it didn't like that.

When I changed it to 255.255.255.0 and then changed the client machine to use the same netmask, at Pats suggestion, it suddenly started working! I haven't set up WPA encryption yet but it works unencrypted now which is more than I could say earlier!

See Pats page here on wireless AP in Linux.....(he uses Gentoo as well): http://wireless.erley.org/stable.html

I've also noticed that I need to start wlan0 manually BEFORE starting hostapd, otherwise it doesn't get an IP address and of course it doesn't work!

The end result is, now I have a Broadcom bcm4306 WLAN card that works in ALL modes including monitor and master modes to run as an AP. I am using the patched b43 driver installed by compat-wireless.

See below for my working configuration files (NO ENCRYPTION):

hostapd.conf

 *Quote:*   

> 
> 
> interface=wlan0
> 
> #bridge=br0
> ...

 

/etc/conf.d/net

 *Quote:*   

> 
> 
> ########################## Wireless Interface ###################################
> 
> ## -c/etc/wpa_supplicant/wpa_supplicant.conf"
> ...

 

Testing client was a laptop booted with WinXP (yuk!) with an Atheros USB WLAN device.

Final software versions on the AP/host machine with the b43 device:

Kernel 2.6.28-r1

Kernel headers 2.6.28-r1

compat-wireless-2009-01-23

crda 1.0.1

wireless-regdb-20090115

libnl 1.1-r1

hostapd-0.6.7

iw-0.9.7

I'll continue to post with further, successful, configuration changes if you would like?

----------

## Audiossis

OK, more to report.

Getting wlan0 bridged with my normal local interface was trickier than I though it would be. This may have something to do with the complexity of my network configuration, or it may be a bug in hostapd, I'm not sure which.

I finally got it to work stable, although I had to do it in a non-standard way. I was hampered by the following problems.

1> No matter how I started wlan0, when I tried to start hostapd with the normal script, that is with:

 *Quote:*   

> 
> 
>  /etc/init.d/hostapd start
> 
> 

 

hostapd would always fail to start. But it started OK when run manually like:

 *Quote:*   

> 
> 
> /usr/sbin/hostapd -ddB /etc/hostapd/hostapd.conf
> 
> 

 

2> The above problem was made worse when wlan0 was added to the bridge. Even when hostapd was started manually, if wlan0 was bridged, the first attempt to start hostapd always failed. The second attempt, however, has not failed yet.

3> Hostapd would start, but any associated clients would not get an IP address from my DHCP server unless the bridge was started first and then wlan0 was added to the bridge afterward.

These issues made auto starting the interface at boot up a tricky proposition without writing a new script. I found this to be the simplest way around the issue.

I edited my /etc/conf.d/net configuration file as follows:

 *Quote:*   

> 
> 
> ########################## Wireless Interface ###################################
> 
> #modules=( "wpa_supplicant" )
> ...

 

I used the post_up function to allow the bridged interface to start before adding wlan0 to it. I also used the same post_up function to start hostapd without using the Gentoo script. The first attempt to start hostapd always fails when wlan0 is bridged, as I said before, but the second attempt is always successful. So, as you can see above, I redirected the output from the first attempt to start hostapd to /dev/null. That way, that error messages that always occur at that point don't clutter up the start up messages.

Only the second attempt to start hostapd is allowed to print it's output to the console at boot up.

I have tested this over and over at least two dozen times today and it has not failed once. The WinXP client (my laptop) has always been able to associate with my broadcom based AP, and has always obtained an IP from the DHCP server. I did it this way to prevent the over complication of my iptables scripts later on. They're bad enough as it is, they don't need any further complications.

Strange though, it this configuration, the netmask problem no longer seems to be an issue. I don't know why that is...... Changing the netmask doesn't seem to help hostapd start any more easily in this configuration.

I have not tried using wpa_supplicant with wlan0 started in this way. I would not be surprised if it failed.

Next step is to get WPA/WPA2 encryption working with hostapd.

Updates as they become available.......

----------

## pappy_mcfae

Cool. I'm glad you have things almost there. I just love Gentoo!

Blessed be!

Pappy

----------

## Audiossis

OK more progress.

I have wpa2 encryption working. The system has it's quirks and I couldn't yet consider it stable but it does work.

I have noticed during the course of getting wpa2 working, that a big part of getting the device to work correctly, is re-loading the firmware.

It seems to me that when you are changing settings or when something breaks reloading the firmware can get the device going again.

I had to break my WIFI setup 7 times to figure this out.

I came up with one simple rule and a script.

RULE 1> If it stops working, shut down all interfaces related to wlan0 and kill hostapd or wpa_supplicant (whichever you are using). Then re-load the firmware with this script. Do this BEFORE you start changing the hostapd/wpa_supplicant settings.

 *Quote:*   

> 
> 
> #!/bin/bash
> 
> # Stop all interfaces related to wlan0 including wlan0
> ...

 

I've also fine tuned my /etc/conf.d/net script to make the device start up a little more reliable.

***EDIT *** I just thought of another slightly different way. Remove the UDEV rule that starts wlan0 every time the b43 driver is loaded. That way we save 25 seconds in the execution of the above script as we would no longer have to kill wlan0 after re-loading the driver. I'll look deeper into that a bit later.

 *Quote:*   

> 
> 
> ########################## Wireless Interface ###################################
> 
> #modules=( "wpa_supplicant" )
> ...

 

In the earlier script, I had wlan0 starting when vbox0 started. That was the wrong event to trigger wlan0 into start up. I should have used br0 instead. Now the script waits until ALL other related interfaces are running before starting wlan0.

I also added a little sleep to make the script wait for wlan0 to start before running hostapd.

I think the key thing here is, re-load the firmware if it is not working and give the adaptor some time to start before you execute hostapd. A lot of configuration goes on when hostapd is started and wlan0 isn't fully initialized when that happens, I think, sometimes it corrupts the firmware in memory so it has to be reloaded. Same goes for wpa_supplicant.

I also get the feeling that this rule applies to many different types of WLAN adaptor on just about all platforms. I had the same issue at one point with the Athoeros WLAN adpator I use on the laptop to test the Broadcom AP I'm building. I had to force windows to shutdown the adaptor the unplug it from the usb port and replug it the start it up again before it would work.

Also it would say that it pays to use a network bridge when using the b43 driver as it seems to stabilize hostapd. It also simplifies the configuration of your DHCP server and your iptables scripts. I would say that a big part of the problem I have been having were related to the fact that I have tried not to change my DHCP server settings too much.

Still some stability testing and fine tuning to do but we learn as we go...

----------

## pappy_mcfae

This is why I love Gentoo. It's so cool to walk with someone down the path of discovery. And you're walking it well.

Blessed be!

Pappy

----------

## Audiossis

OK, after much experimenting and script writing I finally have a semi stable wireless access point with the b43 with full wpa2 encryption. There is only one issue remaining to be solved. How do I change the default behavior of udev?

At first I though the firmware needed to be re-loaded into the card. I got that impression because every time the b43 driver was loaded, udev would start the card in the background. This caused wlan0 to fail intermittently with a known working configuration. It wasn't very apparent at first as I was, during testing, regularly unloading and re-loading the driver and at the same time starting and stopping the wlan0 interface as well.

Doing this intensive sort of testing generates LOTS of messages in the log files. When that happens I find it very difficult to read the logs.

Does any one know how to change this behavior in udev correctly? 

[url] http://www.gentoo.org/doc/en/udev-guide.xml#doc_chap2 [/url] mentions a little about loading modules in the correct order but it doesn't say anything about preventing the adapter from starting when the module is loaded.

At the moment the b43 only works correctly when I manually edit /etc/udev/rules.d/90-network.rules so that it looks like:

 *Quote:*   

> 
> 
> # do not edit this file, it will be overwritten on update
> 
> # /etc/udev/rules/90-network.rules:  triggering network init-scripts
> ...

 

This is clearly the problem as it is causing wlan0 to start quietly in the background every time b43 is loaded.

Unfortunately though editing this file is not a permanent fix as udev will occasionally overwrite the file and break my set up.

If anyone else thinks that they might have the same problem, do this;

[quote]

~# modprobe -r ohci_hcd

~# modprobe -r b43

~# modprobe -r pcmcia_core

~# modprobe -r pcmcia

~# modprobe -r ssb

~# lsmod | grep ssb

[/quote|

b43 and ssb are the only two we are interested in. The other just needed to be removed before ssb could unload. If all the modules have been removed, the last command will return nothing.

Now wait 30 seconds and to this.

 *Quote:*   

> 
> 
> ~# lsmod | grep ssb
> 
> 

 

If you get an output, that means that udev has automatically reloaded the b43 module and if that has happened, then I'd be willing to bet that the interface has also been started in the background.

You can check that by doing:

 *Quote:*   

> 
> 
> /etc/init.d/net.wlan0 status
> 
> 

 

The solution is to completely disable the automatic starting of wlan0 when b43 is loaded.

The rest depends on how you have your network and hostapd configured. Here are my config files. They work constantly for me. Your mileage may vary.

/etc/init.d/net

 *Quote:*   

> 
> 
> modules=( "iwconfig" )
> 
> mode_wlan0="ad-hoc"
> ...

 

wlan0 is part of the bridge adapter br0, but is not a critical part of br0 so they can be started and stopped, more or less independently of each other.

/etc/hostapd/hostapd.conf

 *Quote:*   

> 
> 
> interface=wlan0
> 
> bridge=br0
> ...

 

----------

## Audiossis

I think I've got it sorted.

I doubt this is a permanent fix either but it'll be more long term than the previous solution.

Where I edited /etc/udev/rules.d/90-network.rules to prevent udev starting the interface whenever b43 was loaded, I've now restored the file to it's original state.

Instead I edited /lib/udev/net.sh. This is the script that is called by the rules written in /etc/udev/rules.d/90-network.rules. I noticed that line 15 lists ethernet interfaces  that will be ignored when this script is called. I simply added wlan0 to the end of this list.

I then once again added ssb and b43 to /etc/modules.autoload.d/kernel-2.6.

Rebooted and everything has been fine since.

Thanks pappy and thanks to Pat Erley if he's watching this thread, you've both been a great help.

 Regards,

Ben

See my edited version of /lib/udev/net.sh below:

 *Quote:*   

> 
> 
> #!/bin/sh
> 
> #
> ...

 

----------

## pappy_mcfae

I'm always glad to help.

Happy Gentooing.

Blessed be!

Pappy

----------

