Ath9k in Master Mode
by admin on Oct.15, 2010, under Hacking, Linux, Networking, Tools
Mi sono spesso imbattuto, in rete, in richieste di aiuto provenienti da utenti in difficoltà nell’impostare le loro interfacce wireless Atheros in AP mode.
Se infatti si tenta di farlo utilizzando iwconfig, l’operazione fallisce:
# iwconfig wlan0 mode master
Error for wireless request "Set Mode" (8B06) :
SET failed on device wlan0 ; Invalid argument.
Il fallimento dell’operazione è un fatto di design.
Lo stack mac80211 non contiene i componenti necessari per operare in master mode autonomamente.
Piuttosto che consentire agli utenti di impostare l’interfaccia in master mode e questa non funzioni, preferisce affermare che l’ operazione non è supportata.
Questo comportamento, per la verità, si verificava anche con i drivers madwifi, ma in tal caso era a disposizione un tool (wlanconfig) per risolvere il problema. Ora che il driver non viene più attivamente sviluppato e sta venendo progressivamente sostituito da ath9k, il problema si è riproposto.
Si potrebbe effettuare qualcosa di simile:
# iw phy phy0 interface add wlan0 type __ap
ed ottenere qualcosa di più simile ad un Access Point, sebbene inutilizzabile.
# iwconfig
lo no wireless extensions.
eth0 no wireless extensions.
pan0 no wireless extensions.
wlan0 IEEE 802.11bgn ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm
Retry long limit:7 RTS thr=2347 B Fragment thr=2346 B
Encryption key:off
Power Management:on
wlan_rename IEEE 802.11bgn Mode:Master Frequency:2.462 GHz Tx-Power=20 dBm
Retry long limit:7 RTS thr=2347 B Fragment thr=2346 B
Power Management:off
Con mac80211 infatti, è necessario hostapd per implementare qualsiasi tipo di access point funzionale.
È necessario innanzitutto aggiornare il kernel alla versione 2.6.30 o superiore. Versioni più datate del driver ath9k presenti in kernels precedenti non sono funzionali in master mode, o risultano operativamente inaffidabili (il 2.6.29 funziona, ma la connessione cade ogni 5 minuti circa).
Occorre inoltre assicurarsi di avere una recente versione di hostapd installata.
Occorre ancora aver installato i wireless-tools e iw in modo che la wireless card possa venire configurata da hostapd e dal sotto-sistema di networking.
Un esempio di file hostapd.conf:
interface=wlan0
driver=nl80211
ssid=my_wireless_ap
channel=11
hw_mode=g
auth_algs=3
wpa=3
wpa_passphrase=digitoergosum
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP
i111180211n=1
ht_capab=[HT40-][SHORT-GI-40][DSSS_CCK-40]
ed il riscontro da parte di hostapd eseguito in foreground:
# hostapd -dd /etc/hostapd/hostapd.conf
Configuration file: /etc/hostapd/hostapd.conf
ctrl_interface_group=0
Opening raw packet socket for ifindex 4464628
BSS count 1, BSSID mask ff:ff:ff:ff:ff:ff (0 bits)
SIOCGIWRANGE: WE(compiled)=22 WE(source)=21 enc_capa=0xf
nl80211: Added 802.11b mode based on 802.11g information
Allowed channel: mode=1 chan=1 freq=2412 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=2 freq=2417 MHz max_tx_power=20 dBm
Allowed channel: mode=1 chan=3 freq=2422 MHz max_tx_power=20 dBm
[...]
Flushing old station entries
Deauthenticate all stations
Mode: IEEE 802.11g Channel: 11 Frequency: 2462 MHz
Using interface wlan0 with hwaddr 78:dd:08:e4:99:86 and ssid 'my_wireless_ap'
SSID - hexdump_ascii(len=14):
6d 79 5f 77 69 72 65 6c 65 73 73 5f 61 70 my_wireless_ap
PSK (ASCII passphrase) - hexdump_ascii(len=13):
64 69 67 69 74 6f 65 72 67 6f 73 75 6d digitoergosum
PSK (from passphrase) - hexdump(len=32): 9f cc ad 15 0c c0 ec 78 f9 91 68 3b 32 a7 72 e6 be 83 91 f3 7f fe 76 a3 4a 6d 04 e5 32 c2 0f 3b
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.

