ath9k + hostapd = 5 GHz Access Point
Форум — Linux-hardware
Относительно недавно достал несколько железок под Mini PCI-Express, умеющих 5 GHz:
06:00.0 Network controller [0280]: Atheros Communications Inc. AR5008 Wireless Network Adapter [168c:0024] (rev 01)
$ sudo hostapd -dd hostapd.conf
Configuration file: hostapd.conf
ctrl_interface_group=10 (from group name 'wheel')
nl80211: Add own interface ifindex 3
nl80211: New interface mon.wlan0 created: ifindex=9
nl80211: Add own interface ifindex 9
BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)
nl80211: Added 802.11b mode based on 802.11g information
Allowed channel: mode=1 chan=1 freq=2412 MHz max_tx_power=17 dBm
Allowed channel: mode=1 chan=2 freq=2417 MHz max_tx_power=17 dBm
Allowed channel: mode=1 chan=3 freq=2422 MHz max_tx_power=17 dBm
Allowed channel: mode=1 chan=4 freq=2427 MHz max_tx_power=17 dBm
Allowed channel: mode=1 chan=5 freq=2432 MHz max_tx_power=17 dBm
Allowed channel: mode=1 chan=6 freq=2437 MHz max_tx_power=17 dBm
Allowed channel: mode=1 chan=7 freq=2442 MHz max_tx_power=17 dBm
Allowed channel: mode=1 chan=8 freq=2447 MHz max_tx_power=17 dBm
Allowed channel: mode=1 chan=9 freq=2452 MHz max_tx_power=17 dBm
Allowed channel: mode=1 chan=10 freq=2457 MHz max_tx_power=17 dBm
Allowed channel: mode=1 chan=11 freq=2462 MHz max_tx_power=17 dBm
Allowed channel: mode=0 chan=1 freq=2412 MHz max_tx_power=17 dBm
Allowed channel: mode=0 chan=2 freq=2417 MHz max_tx_power=17 dBm
Allowed channel: mode=0 chan=3 freq=2422 MHz max_tx_power=17 dBm
Allowed channel: mode=0 chan=4 freq=2427 MHz max_tx_power=17 dBm
Allowed channel: mode=0 chan=5 freq=2432 MHz max_tx_power=17 dBm
Allowed channel: mode=0 chan=6 freq=2437 MHz max_tx_power=17 dBm
Allowed channel: mode=0 chan=7 freq=2442 MHz max_tx_power=17 dBm
Allowed channel: mode=0 chan=8 freq=2447 MHz max_tx_power=17 dBm
Allowed channel: mode=0 chan=9 freq=2452 MHz max_tx_power=17 dBm
Allowed channel: mode=0 chan=10 freq=2457 MHz max_tx_power=17 dBm
Allowed channel: mode=0 chan=11 freq=2462 MHz max_tx_power=17 dBm
wlan0: IEEE 802.11 Configured channel (44) not found from the channel list of current mode (2) IEEE 802.11a
wlan0: IEEE 802.11 Hardware does not support configured channel
Could not select hw_mode and channel. (-1)
wlan0: Unable to setup interface.
Flushing old station entries
Deauthenticate all stations
rmdir[ctrl_interface]: No such file or directory
nl80211: Remove interface ifindex=9
netlink: Operstate: linkmode=0, operstate=6
$ iw phy phy0 info
Wiphy phy0
...
Band 2:
...
Frequencies:
* 5180 MHz [36] (13.0 dBm) (passive scanning, no IBSS)
* 5200 MHz [40] (17.0 dBm) (passive scanning, no IBSS)
* 5220 MHz [44] (17.0 dBm) (passive scanning, no IBSS)
* 5240 MHz [48] (17.0 dBm) (passive scanning, no IBSS)
* 5260 MHz [52] (17.0 dBm) (passive scanning, no IBSS, radar detection)
* 5280 MHz [56] (17.0 dBm) (passive scanning, no IBSS, radar detection)
* 5300 MHz [60] (17.0 dBm) (passive scanning, no IBSS, radar detection)
* 5320 MHz [64] (17.0 dBm) (passive scanning, no IBSS, radar detection)
* 5500 MHz [100] (20.0 dBm) (passive scanning, no IBSS, radar detection)
* 5520 MHz [104] (20.0 dBm) (passive scanning, no IBSS, radar detection)
* 5540 MHz [108] (20.0 dBm) (passive scanning, no IBSS, radar detection)
* 5560 MHz [112] (20.0 dBm) (passive scanning, no IBSS, radar detection)
* 5580 MHz [116] (20.0 dBm) (passive scanning, no IBSS, radar detection)
* 5600 MHz [120] (20.0 dBm) (passive scanning, no IBSS, radar detection)
* 5620 MHz [124] (20.0 dBm) (passive scanning, no IBSS, radar detection)
* 5640 MHz [128] (20.0 dBm) (passive scanning, no IBSS, radar detection)
* 5660 MHz [132] (20.0 dBm) (passive scanning, no IBSS, radar detection)
* 5680 MHz [136] (20.0 dBm) (passive scanning, no IBSS, radar detection)
* 5700 MHz [140] (20.0 dBm) (passive scanning, no IBSS, radar detection)
* 5745 MHz [149] (20.0 dBm) (passive scanning, no IBSS)
* 5765 MHz [153] (20.0 dBm) (passive scanning, no IBSS)
* 5785 MHz [157] (20.0 dBm) (passive scanning, no IBSS)
* 5805 MHz [161] (20.0 dBm) (passive scanning, no IBSS)
* 5825 MHz [165] (20.0 dBm) (passive scanning, no IBSS)
...
- «passive scanning» - режим точки доступа вообще запрещён;
- «no IBSS» - запрещён режим «ad-hoc» (этот флаг нам не важен);
- «radar detection» - требуется определение пульсаций радаров, которые могут работать на той же частоте (в драйвере ath9k это начали реализовывать недавно и оно толком не поддерживается).
За назначение свойств каналам отвечает regulatory domain, который зависит от страны. Данные берутся из базы данных в юзерспейсе при помощи утилиты crda. По идее сменить страну можно командой «iw reg set $КОД_СТРАНЫ», но в случае с устройствами от atheros из коробки этот метод не работает, так как у атеросов regulatory domain зашит в EEPROM и линуксовый драйвер читает именно его, игнорируя настойки системы. К счастью, у нас тут opensource и мы можем наложить несложный патч:
ath9k-ignore-eeprom-regdomain.patch
diff -ru linux-3.3/drivers/net/wireless/ath/regd.c linux-3.3.new/drivers/net/wireless/ath/regd.c --- linux-3.3/drivers/net/wireless/ath/regd.c 2012-03-19 05:15:34.000000000 +0600 +++ linux-3.3.new/drivers/net/wireless/ath/regd.c 2012-06-05 20:47:03.906526443 +0600 @@ -196,6 +196,8 @@ u32 bandwidth = 0; int r; + return; + for (band = 0; band < IEEE80211_NUM_BANDS; band++) { if (!wiphy->bands[band]) @@ -255,6 +257,8 @@ u32 bandwidth = 0; int r; + return; + sband = wiphy->bands[IEEE80211_BAND_2GHZ]; if (!sband) return; @@ -304,6 +308,8 @@ struct ieee80211_channel *ch; unsigned int i; + return; + if (!wiphy->bands[IEEE80211_BAND_5GHZ]) return; @@ -510,6 +516,8 @@ { const struct ieee80211_regdomain *regd; + return 0; + wiphy->reg_notifier = reg_notifier; wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY;
Далее пробуем:
# iw reg set GB
# iw phy
Wiphy phy0
...
Band 2:
...
Frequencies:
* 5180 MHz [36] (13.0 dBm)
* 5200 MHz [40] (17.0 dBm)
* 5220 MHz [44] (17.0 dBm)
* 5240 MHz [48] (17.0 dBm)
* 5260 MHz [52] (17.0 dBm) (radar detection)
* 5280 MHz [56] (17.0 dBm) (radar detection)
* 5300 MHz [60] (17.0 dBm) (radar detection)
* 5320 MHz [64] (17.0 dBm) (radar detection)
* 5500 MHz [100] (20.0 dBm) (radar detection)
* 5520 MHz [104] (20.0 dBm) (radar detection)
* 5540 MHz [108] (20.0 dBm) (radar detection)
* 5560 MHz [112] (20.0 dBm) (radar detection)
* 5580 MHz [116] (20.0 dBm) (radar detection)
* 5600 MHz [120] (20.0 dBm) (radar detection)
* 5620 MHz [124] (20.0 dBm) (radar detection)
* 5640 MHz [128] (20.0 dBm) (radar detection)
* 5660 MHz [132] (20.0 dBm) (radar detection)
* 5680 MHz [136] (20.0 dBm) (radar detection)
* 5700 MHz [140] (20.0 dBm) (radar detection)
* 5745 MHz [149] (disabled)
* 5765 MHz [153] (disabled)
* 5785 MHz [157] (disabled)
* 5805 MHz [161] (disabled)
* 5825 MHz [165] (disabled)
...
ctrl_interface=/var/run/hostapd
ctrl_interface_group=wheel
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
wpa_passphrase=test123test123
driver=nl80211
interface=wlan0
hw_mode=a
channel=44
ssid=test
country_code=GB
wmm_enabled=1
ieee80211n=1
ht_capab=[HT40+]
Дополнительная информация:
- Посмотреть характеристики каналов в разных странах для выбора подходящих настроек можно при помощи
regdbdump /usr/lib/crda/regulatory.bin
- На клиентские машины (которые будут коннектиться к точке доступа) патч накладывать не нужно. Кроме случаев, когда интересные вам каналы вообще отключены настройками EEPROM'а.
- Можно сменить код в EEPROM'е устройства, тогда необходимость в патче отпадает. Но судя по всему утилита только под винду. И есть риск закирпичивания.
- Оригинальный патч из openwrt: https://dev.openwrt.org/browser/tags/backfire_10.03.1/package/mac80211/patches/404-ath_regd_optional.patch.
Deleted
()
()