Thursday, February 14, 2008

Madwifi Utility,wireless tool, wireless extension

Wireless Extension-- a API exposing driver to the user space configuration and statistics of Wireless LANs

Wireless Tools --
a set of tools to manipulate the Wireless Extensions

  • iwconfig manipulate the basic wireless parameters
  • iwlist scanning and list frequencies, bit-rates, encryption keys...
  • iwspy get per node link quality
  • iwpriv manipulate the Wireless Extensions specific to a driver (private)
  • ifrename rename interfaces based on various static criteria


1. athctrl --specify max distance of a sta or master to prevent unnecessary collision

(set CTS/retransmission timeouts and few other parameters based on distance)

athctrl -i ath0 -d 1000 #1000=1000m

2. athchans -i ath0 1-2 #restrict channel search to 1-2

3. 80211stats -i ath0 #display statistics of ath0 interface

1 rx from wrong bssid
12 rx discard due to it's a dup
19 rx discard mgt frames
163 rx element unknown
128 rx frame chan mismatch
15248 rx frame ssid mismatch
1 rx deauthentication
76 tx failed for no node
2 active scans started

4. athstats -i wifi0

36309 tx management frames
4264 tx failed due to too many retries
93995 long on-chip tx retries
76599 tx frames with no ack marked
375 tx frames with short preamble
2814 rx failed due to bad CRC
64 PHY errors
3 OFDM restart
61 CCK restart
618787 beacons transmitted
6604 periodic calibrations
rssi of last ack: 41
1 switched default/rx antenna
Antenna profile:
[1] tx 66658 rx 51961
[2] tx 41817 rx 26
5. cat /proc/sys/dev/wifi0

/proc/sys/dev/wifi0/ackrate /proc/sys/dev/wifi0/radar_print
/proc/sys/dev/wifi0/acktimeout /proc/sys/dev/wifi0/radar_print_all
/proc/sys/dev/wifi0/countrycode /proc/sys/dev/wifi0/regdomain
/proc/sys/dev/wifi0/ctstimeout /proc/sys/dev/wifi0/rp
/proc/sys/dev/wifi0/debug /proc/sys/dev/wifi0/rp_flush
/proc/sys/dev/wifi0/diversity /proc/sys/dev/wifi0/rp_ignored
/proc/sys/dev/wifi0/fftxqmin /proc/sys/dev/wifi0/rxantenna
/proc/sys/dev/wifi0/ledpin /proc/sys/dev/wifi0/slottime
/proc/sys/dev/wifi0/maxvaps /proc/sys/dev/wifi0/softled
/proc/sys/dev/wifi0/panic /proc/sys/dev/wifi0/txantenna
/proc/sys/dev/wifi0/radar_dump /proc/sys/dev/wifi0/txintrperiod
/proc/sys/dev/wifi0/radar_dump_all /proc/sys/dev/wifi0/xrpollcount
/proc/sys/dev/wifi0/radar_ignored /proc/sys/dev/wifi0/xrpollperiod

6. cat /proc/sys/dev/ath0

/proc/sys/dev/ath/calibrate /proc/sys/dev/ath/maxvaps
/proc/sys/dev/ath/countrycode /proc/sys/dev/ath/outdoor
/proc/sys/dev/ath/debug /proc/sys/dev/ath/xchanmode
/proc/sys/dev/ath/hal/


7. wlanconfig
Current Madwifi driver supports multiple APs and concurrent Ap/Station mode operation on the same device. Each instance of AP or station is called Virtual AP(VAP). VAPS share the same underlying phy layer, which is the base device (wifi0) when driver is loaded.

Creating or destroying VAPs are done wlanconfig
wlanconfig VAP create wlandev BaseDevice wlanmode mode [bssid] [-bssid] [nosbeacon]
wlanconfig VAP destroy
wlanconfig VAP list [active|ap|caps|chan|freq|keys|scan|sta|wme]

where mode=[sta|adhoc|ap|monitor |wds|ahdemo]
VAP=can be any name or ath or ath0,ath1,...
examples:

7.1. wlanconfig ath0 list ap|scan #scan nearby APs

SSID BSSID CHAN RATE S:N INT CAPS
FGT01 00:12:bf:14:fa:46 1 54M 18:0 100 EPS WME ATH
FGT-Guest1 06:12:bf:14:fa:46 1 54M 18:0 100 EPS WME ATH
foinet-apple 00:0d:88:e5:74:bf 11 54M 25:0 100 EPSs
FGiefingC 00:0d:88:e5:6f:b4 7 54M 7:0 100 EPSs
Fonet_Ex... 00:13:a6:20:27:10 2 11M 42:0 100 EPS
Foet_Ex... 00:13:a6:20:27:00 4 24M 37:0 100 EPs RSN WPA


7.2. wlanconfig ath0 list active|freq|chan #list active channel

Channel 1 : 2412 Mhz 11g Channel 48 : 5240 Mhz 11a Dynamic
Channel 2 : 2417 Mhz 11g Channel 50 : 5250* Mhz 11a Static
Channel 3 : 2422 Mhz 11g Channel 52 : 5260* Mhz 11a
Channel 4 : 2427 Mhz 11g Channel 56 : 5280* Mhz 11a Dynamic
Channel 5 : 2432 Mhz 11g Channel 58 : 5290* Mhz 11a Static
Channel 6 : 2437 Mhz 11g Dynamic Channel 60 : 5300* Mhz 11a
Channel 7 : 2442 Mhz 11g Channel 64 : 5320* Mhz 11a
Channel 8 : 2447 Mhz 11g Channel 149 : 5745 Mhz 11a
Channel 9 : 2452 Mhz 11g Channel 152 : 5760 Mhz 11a Static
Channel 10 : 2457 Mhz 11g Channel 153 : 5765 Mhz 11a Dynamic
Channel 11 : 2462 Mhz 11g Channel 157 : 5785 Mhz 11a
Channel 36 : 5180 Mhz 11a Channel 160 : 5800 Mhz 11a Static
Channel 40 : 5200 Mhz 11a Dynamic Channel 161 : 5805 Mhz 11a Dynamic
Channel 42 : 5210 Mhz 11a Static Channel 165 : 5825 Mhz 11a
Channel 44 : 5220 Mhz 11a


7.3. wlanconfig ath0 list caps # list base device capabilities

ath0=7782e40f
(WEP,TKIP,AES,AES_CCM,HOSTAP,TXPMGT,SHSLOT,SHPREAMBLE,TKIPMIC,WPA1,WPA2,BURST,WME)

7.4. wlanconfig ath0 list sta # list associated stations with current VAP: ath0


ADDR AID CHAN RATE RSSI DBM IDLE TXSEQ TXFRAG RXSEQ RXFRAG CAPS ACAPS ERP STATE MODE
00:18:e7:1a:e6:da 1 6 6M 57 -38 120 11 10 1358 0 EPSs 0 5 Normal


7.5. wlanconfig ath0 list wme #wifi multimedia


AC_BE cwmin 3 cwmax 10 aifs 2 txopLimit 2048
cwmin 3 cwmax 10 aifs 2 txopLimit 2048
AC_BK cwmin 4 cwmax 10 aifs 7 txopLimit 0
cwmin 4 cwmax 10 aifs 7 txopLimit 0
AC_VI cwmin 3 cwmax 4 aifs 1 txopLimit 3008
cwmin 3 cwmax 4 aifs 2 txopLimit 3008
AC_VO cwmin 2 cwmax 3 aifs 1 txopLimit 1504
cwmin 2 cwmax 3 aifs 2 txopLimit 1504

7.6 wlanconfig ath0 list keys # list key associated with VAP ath0

ath0 3 key sizes : 40, 104, 128bits
4 keys available :
[1]: 1234-5678-90 (40 bits)
[2]: off
[3]: off
[4]: off
Current Transmit Key: [1]
Security mode:restricted


8. iwconfig # used only after VAPs being created successful by wlanconfig command.

Usage: iwconfig [interface]
interface essid {NNN|any|on|off}
interface mode {managed|ad-hoc|master|...}
interface freq N.NNN[k|M|G]
interface channel N
interface bit {N[k|M|G]|auto|fixed}
interface rate {N[k|M|G]|auto|fixed}
interface enc {NNNN-NNNN|off}
interface key {NNNN-NNNN|off}
interface power {period N|timeout N|saving N|off}
interface nickname NNN
interface nwid {NN|on|off}
interface ap {N|off|auto}
interface txpower {NmW|NdBm|off|auto}
interface sens N
interface retry {limit N|lifetime N}
interface rts {N|auto|fixed|off}
interface frag {N|auto|fixed|off}
interface modulation {11g|11a|CCK|OFDMg|...} #
interface commit # force to apply changes done via wireless extension immediately

example

8.1 iwconfig ath0 essid hello #set VAP ath0 to essid name "hello"
8.2 iwconfig ath0





No comments: