# ath9k and hostapd

## petteyg359

I'm trying to set up some small systems to act as 802.11n APs. I don't need routing or anything, I just need them to handle 802.11n connections, since there's no ad-hoc mode for 802.11n. I've installed hostapd, and configured it, but am having problems. If I configure it for WPA, the WPA IEs aren't in the broadcast, so clients think they're connecting to a WEP station, and fail to associate. If I remove WPA from the config, clients fail to associate altogether:

```
Jul 22 14:01:14 wurm NetworkManager[2321]: <info> Activation (wlan0) Stage 2 of 5 (Device Configure) starting...

Jul 22 14:01:14 wurm NetworkManager[2321]: <info> (wlan0): device state change: 4 -> 5 (reason 0)

Jul 22 14:01:14 wurm NetworkManager[2321]: <info> Activation (wlan0/wireless): connection 'testingnet' requires no security.  No secrets needed.

Jul 22 14:01:14 wurm NetworkManager[2321]: <info> Config: added 'ssid' value 'testingnet'

Jul 22 14:01:14 wurm NetworkManager[2321]: <info> Config: added 'scan_ssid' value '1'

Jul 22 14:01:14 wurm NetworkManager[2321]: <info> Config: added 'key_mgmt' value 'WPA-PSK'

Jul 22 14:01:14 wurm NetworkManager[2321]: <info> Config: added 'psk' value '<omitted>'

Jul 22 14:01:14 wurm NetworkManager[2321]: <info> Activation (wlan0) Stage 2 of 5 (Device Configure) complete.

Jul 22 14:01:14 wurm NetworkManager[2321]: <info> Config: set interface ap_scan to 1

Jul 22 14:01:14 wurm NetworkManager[2321]: <info> (wlan0): supplicant connection state:  inactive -> scanning

Jul 22 14:01:39 wurm NetworkManager[2321]: <warn> Activation (wlan0/wireless): association took too long, failing activation.

Jul 22 14:01:39 wurm NetworkManager[2321]: <info> (wlan0): device state change: 5 -> 9 (reason 11)

Jul 22 14:01:39 wurm NetworkManager[2321]: <warn> Activation (wlan0) failed for access point (swuresearch)

Jul 22 14:01:39 wurm NetworkManager[2321]: <info> Marking connection 'testingnet' invalid.

Jul 22 14:01:39 wurm NetworkManager[2321]: <warn> Activation (wlan0) failed.

Jul 22 14:01:39 wurm NetworkManager[2321]: <info> (wlan0): device state change: 9 -> 3 (reason 0)

Jul 22 14:01:39 wurm NetworkManager[2321]: <info> (wlan0): deactivating device (reason: 0).
```

No luck with wpa_supplicant or even iwconfig.

hostapd.conf:

```
ctrl_interface=/var/run/hostapd

ctrl_interface_group=0

interface=wlan0

driver=nl80211

hw_mode=g

ssid=testingnet

channel=6

auth_algs=1

wpa=0

#wpa_key_mgmt=WPA-PSK

#wpa_pairwise=TKIP

#rsn_pairwise=CCMP

#wpa_passphrase=testingnet

logger_stdout=-1

logger_stdout_level=2

logger_syslog=-1

logger_syslog_level=2

wmm_enabled=1

ieee80211n=1

ht_capab=[HT20][HT40-][HT40+][SHORT-GI-40][DSSS_CCK-40][TX-STBC][RX-STBC1]
```

Is there something obviously wrong with the configuration, or am I running into some obscure ath9k issue, or what?

----------

## rufnut

Hi, 

try some of my settings:

```

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=WLAN

country_code=AU

hw_mode=g

channel=5

beacon_int=100

dtim_period=2

max_num_sta=255

rts_threshold=2347

fragm_threshold=2346

macaddr_acl=0

auth_algs=3

ignore_broadcast_ssid=0

tx_queue_data3_aifs=7

tx_queue_data3_cwmin=15

tx_queue_data3_cwmax=1023

tx_queue_data3_burst=0

tx_queue_data2_aifs=3

tx_queue_data2_cwmin=15

tx_queue_data2_cwmax=63

tx_queue_data2_burst=0

tx_queue_data1_aifs=1

tx_queue_data1_cwmin=7

tx_queue_data1_cwmax=15

tx_queue_data1_burst=3.0

tx_queue_data0_aifs=1

tx_queue_data0_cwmin=3

tx_queue_data0_cwmax=7

tx_queue_data0_burst=1.5

tx_queue_after_beacon_aifs=2

tx_queue_after_beacon_cwmin=15

tx_queue_after_beacon_cwmax=1023

tx_queue_after_beacon_burst=0

tx_queue_beacon_aifs=2

tx_queue_beacon_cwmin=3

tx_queue_beacon_cwmax=7

tx_queue_beacon_burst=1.5

wmm_enabled=1

wmm_ac_bk_cwmin=4

wmm_ac_bk_cwmax=10

wmm_ac_bk_aifs=7

wmm_ac_bk_txop_limit=0

wmm_ac_bk_acm=0

wmm_ac_be_aifs=3

wmm_ac_be_cwmin=4

wmm_ac_be_cwmax=10

wmm_ac_be_txop_limit=0

wmm_ac_be_acm=0

wmm_ac_vi_aifs=2

wmm_ac_vi_cwmin=3

wmm_ac_vi_cwmax=4

wmm_ac_vi_txop_limit=94

wmm_ac_vi_acm=0

wmm_ac_vo_aifs=2

wmm_ac_vo_cwmin=2

wmm_ac_vo_cwmax=3

wmm_ac_vo_txop_limit=47

wmm_ac_vo_acm=0

ieee80211n=1

ht_capab=[HT40-][SHORT-GI-40][DSSS_CCK-40]

eapol_key_index_workaround=0

eap_server=0

own_ip_addr=127.0.0.1

wpa=11

wpa_passphrase=xxxxxxxxxxxxxxxxxxxxxxx

wpa_key_mgmt=WPA-PSK

wpa_pairwise=CCMP

rsn_pairwise=CCMP

```

It has been so long I cannot remember what they all do.

good luck   :Smile: 

----------

## petteyg359

I isolated the problem to the ht_capab line. Using the new line, it works. I removed the - from HT40, despite everything online and Gentoo's installed example config saying to use [HT40-] and/or [HT40+], it only works with [HT40].

ht_capab=[HT20][HT40][SHORT-GI-40][DSSS_CCK-40][TX-STBC][RX-STBC1]

relevant section of iw list:

```

                        HT20/HT40                                                                                                                                                             

                        SM Power Save disabled                                                                                                                                                

                        RX HT40 SGI                                                                                                                                                           

                        TX STBC                                                                                                                                                               

                        RX STBC 1-stream                                                                                                                                                      

                        Max AMSDU length: 3839 bytes                                                                                                                                          

                        DSSS/CCK HT40

```

----------

## rufnut

glad you found the problem.

 :Smile: 

----------

