今天在設定 hostapd 給 ath9k 的網卡使用時,遇到了這樣的問題:
無法在 AP mode 設定 channel 為 120, 124, 132
首先出現的是 DFS start_dfs_cac() failed, -1
,照著這篇 mail 安裝 wireless-regdb 以及 crda 就不會出現問題。
接著出現了這樣的訊息:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
➜ hostapd git:(master) ✗ sudo ./hostapd nems.conf Configuration file: nems.conf wlp0s20f0u5: interface state UNINITIALIZED->COUNTRY_UPDATE Channel 120 (primary) not allowed for AP mode wlp0s20f0u5: IEEE 802.11 Configured channel (120) not found from the channel list of current mode (2) IEEE 802.11a wlp0s20f0u5: IEEE 802.11 Hardware does not support configured channel Could not select hw_mode and channel. (–3) wlp0s20f0u5: interface state COUNTRY_UPDATE->DISABLED wlp0s20f0u5: AP–DISABLED wlp0s20f0u5: interface state DISABLED->DISABLED wlp0s20f0u5: AP–DISABLED wlp0s20f0u5: CTRL–EVENT–TERMINATING hostapd_free_hapd_data: Interface wlp0s20f0u5 wasn‘t started nl80211: deinit ifname=wlp0s20f0u5 disabled_11b_rates=0 |
搜尋之後,有說確認 iw list
的 frequencies 是否有支援的,我這邊看是有:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
Frequencies: * 5170 MHz [34] (disabled) * 5180 MHz [36] (23.0 dBm) * 5190 MHz [38] (23.0 dBm) * 5200 MHz [40] (23.0 dBm) * 5210 MHz [42] (23.0 dBm) * 5220 MHz [44] (23.0 dBm) * 5230 MHz [46] (23.0 dBm) * 5240 MHz [48] (23.0 dBm) * 5260 MHz [52] (23.0 dBm) (radar detection) * 5280 MHz [56] (23.0 dBm) (radar detection) * 5290 MHz [58] (23.0 dBm) (radar detection) * 5300 MHz [60] (23.0 dBm) (radar detection) * 5310 MHz [62] (23.0 dBm) (radar detection) * 5320 MHz [64] (23.0 dBm) (radar detection) * 5500 MHz [100] (23.0 dBm) (radar detection) * 5520 MHz [104] (23.0 dBm) (radar detection) * 5540 MHz [108] (23.0 dBm) (radar detection) * 5560 MHz [112] (23.0 dBm) (radar detection) * 5580 MHz [116] (23.0 dBm) (radar detection) * 5600 MHz [120] (23.0 dBm) (radar detection) * 5620 MHz [124] (23.0 dBm) (radar detection) * 5640 MHz [128] (23.0 dBm) (radar detection) * 5660 MHz [132] (23.0 dBm) (radar detection) * 5680 MHz [136] (23.0 dBm) (radar detection) * 5700 MHz [140] (23.0 dBm) (radar detection) * 5720 MHz [144] (23.0 dBm) (radar detection) * 5745 MHz [149] (30.0 dBm) * 5765 MHz [153] (30.0 dBm) * 5785 MHz [157] (30.0 dBm) * 5805 MHz [161] (30.0 dBm) * 5825 MHz [165] (30.0 dBm) * 5845 MHz [169] (disabled) * 5920 MHz [184] (disabled) * 5940 MHz [188] (disabled) * 5960 MHz [192] (disabled) * 5980 MHz [196] (disabled) * 6000 MHz [200] (disabled) * 6020 MHz [204] (disabled) * 6040 MHz [208] (disabled) * 6060 MHz [212] (disabled) * 6080 MHz [216] (disabled) |
重新嘗試一遍還是出現相同的問題,換 country code 為 JP 或是 TW 依然不行。
繼續搜尋,看到 iw reg get
,可以看到目前的 country code 有關頻譜的設定/規定:
1 2 3 4 5 6 7 8 9 |
➜ hostapd git:(master) ✗ iw reg get global country US: DFS–FCC (2402 – 2472 @ 40), (N/A, 30), (N/A) (5170 – 5250 @ 80), (N/A, 23), (N/A), AUTO–BW (5250 – 5330 @ 80), (N/A, 23), (0 ms), DFS, AUTO–BW (5490 – 5730 @ 160), (N/A, 23), (0 ms), DFS (5735 – 5835 @ 80), (N/A, 30), (N/A) (57240 – 63720 @ 2160), (N/A, 40), (N/A) |
我疑惑的點在於,iw list
的 frequencies 已經沒有出現 no IR 的字眼了,應該就要能夠使用於 AP mode,但找一找看到這篇 mail 之後,發現我前面的假設是錯誤的:
You can also use “iw reg get” to get list of bands allowed, all the bands marked with passive-scan are not allowed in AP mode unless we implement full DFS functionality (CAC) and make the channel usable.
原來,原因是,只要被標記 DFS 的頻段,除非 driver 有實做完整的 DFS 功能,要不然是不能用的。
解法
我不當台灣人啦,跳到另一個對於 channel 124 沒有管制的 country code 即可,我選擇了 南非 (ZA),以下是南非的 iw reg get
的狀況:
1 2 3 4 5 6 7 |
➜ hostapd git:(master) ✗ iw reg get global country ZA: DFS–ETSI (2402 – 2482 @ 40), (N/A, 20), (N/A) (5170 – 5250 @ 80), (N/A, 20), (N/A), AUTO–BW (5250 – 5330 @ 80), (N/A, 20), (0 ms), DFS, AUTO–BW (5490 – 5710 @ 160), (N/A, 30), (N/A) |
南非 iw list
frequencies 的部份:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
* 5170 MHz [34] (disabled) * 5180 MHz [36] (20.0 dBm) * 5190 MHz [38] (20.0 dBm) * 5200 MHz [40] (20.0 dBm) * 5210 MHz [42] (20.0 dBm) * 5220 MHz [44] (20.0 dBm) * 5230 MHz [46] (20.0 dBm) * 5240 MHz [48] (20.0 dBm) * 5260 MHz [52] (20.0 dBm) (radar detection) * 5280 MHz [56] (20.0 dBm) (radar detection) * 5290 MHz [58] (20.0 dBm) (radar detection) * 5300 MHz [60] (20.0 dBm) (radar detection) * 5310 MHz [62] (20.0 dBm) (radar detection) * 5320 MHz [64] (20.0 dBm) (radar detection) * 5500 MHz [100] (30.0 dBm) * 5520 MHz [104] (30.0 dBm) * 5540 MHz [108] (30.0 dBm) * 5560 MHz [112] (30.0 dBm) * 5580 MHz [116] (30.0 dBm) * 5600 MHz [120] (30.0 dBm) * 5620 MHz [124] (30.0 dBm) * 5640 MHz [128] (30.0 dBm) * 5660 MHz [132] (30.0 dBm) * 5680 MHz [136] (30.0 dBm) * 5700 MHz [140] (30.0 dBm) * 5720 MHz [144] (disabled) * 5745 MHz [149] (disabled) * 5765 MHz [153] (disabled) * 5785 MHz [157] (disabled) * 5805 MHz [161] (disabled) * 5825 MHz [165] (disabled) * 5845 MHz [169] (disabled) * 5920 MHz [184] (disabled) * 5940 MHz [188] (disabled) * 5960 MHz [192] (disabled) * 5980 MHz [196] (disabled) * 6000 MHz [200] (disabled) * 6020 MHz [204] (disabled) * 6040 MHz [208] (disabled) * 6060 MHz [212] (disabled) * 6080 MHz [216] (disabled) |
除了 nintendo eShop 要當南非人,連 wireless 也要當南非人呢。
事情不是憨人想的這麼簡單的…… ath 這個 driver,除了遵照 iw reg 所設定的地區外,更會嚴格遵守寫死在 EEPROM 的地區…
1 2 3 4 |
[ 18.062620] ath: EEPROM regdomain: 0x6a [ 18.062620] ath: EEPROM indicates we should expect a direct regpair map [ 18.062621] ath: Country alpha2 being used: 00 [ 18.062622] ath: Regpair used: 0x6a |
幸好,我們可以從 driver 這邊繞過去。
作法是,重新編譯 kernel 以及 ath9k driver,透過 patch 繞過去,重新啟動後就能夠使用了
1 2 3 4 5 |
$ make –j8 $ sudo cp –v arch/x86_64/boot/bzImage /boot/vmlinuz–linux419 $ sudo make modules_install –j8 $ sudo mkinitcpio –p linux419 $ reboot |
Leave a Reply