Tuesday, September 8, 2009

how to install madwifi driver for linux with and with out resend packets option.

Madwifi driver is basically written for Atheros chipsets and it supports most
It is a open source but depends on the proprietary Hardware Abstraction Layer (HAL).

Download and Check

$ wget http://ufpr.dl.sourceforge.net/sourceforge/madwifi/madwifi-0.9.4.tar.bz2
$ tar -zxvf madwifi-0.9.4.tar.bz2
$ cd madwifi-0.9.4/
$ cd scripts/
$ ./madwifi-unload.bash
$ ./find-madwifi-modules.sh $(uname -r)
$ cd ..

Build and comment

$ make

Checking requirements… ok.
Checking kernel configuration… ok.
make -C /lib/modules/2.6.18-92.1.13.el5/build SUBDIRS=/home/rafa/0_Down/1_Source/WireLess/madwifi-0.9.4 modules
make[1]: Entering directory `/usr/src/kernels/2.6.18-92.1.13.el5-i686′
CC [M] /home/rafa/0_Down/1_Source/WireLess/madwifi-0.9.4/ath/if_ath.o
In file included from :1:
/home/rafa/0_Down/1_Source/WireLess/madwifi-0.9.4/ath/../include/compat.h:140: error: redefinition of ’skb_end_pointer’
….
….
….
make[3]: *** [/home/rafa/0_Down/1_Source/WireLess/madwifi-0.9.4/ath/if_ath.o] Error 1
make[2]: *** [/home/rafa/0_Down/1_Source/WireLess/madwifi-0.9.4/ath Error 2
make[1]: *** [_module_/home/rafa/0_Down/1_Source/WireLess/madwifi-0.9.4] Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.18-92.1.13.el5-i686′
make: *** [modules] Error 2

$ cd include
$ cp compat.h compat.h.old
$ vim compat.h
$ diff -U 3 -dHrN -- compat.h compat.h.old
$cat compat.h.diff



— compat.h 2009-03-19 02:02:49.000000000 -0400
+++ compat.h.old 2009-03-18 19:09:37.000000000 -0400
@@ -134,7 +134,7 @@
#define IRQF_SHARED SA_SHIRQ
#endif
-/* #if LINUX_VERSION_CODE <>mac.raw = skb->data;
}
-#endif */
+#endif
#if LINUX_VERSION_CODE <>$ cd ../
$ make

Checking requirements… ok.
Checking kernel configuration… ok.
make -C /lib/modules/2.6.18-92.1.13.el5/build SUBDIRS=/home/rafa/0_Down/1_Source/WireLess/madwifi-0.9.4 modules
make[1]: Entering directory `/usr/src/kernels/2.6.18-92.1.13.el5-i686′
CC [M] /home/rafa/0_Down/1_Source/WireLess/madwifi-0.9.4/ath/if_ath.o



make[1]: Entering directory `/home/rafa/0_Down/1_Source/WireLess/madwifi-0.9.4/tools’
gcc -o athstats -g -O2 -Wall -I. -I../hal -I.. -I../ath athstats.c
gcc -o 80211stats -g -O2 -Wall -I. -I../hal -I.. 80211stats.c
gcc -o athkey -g -O2 -Wall -I. -I../hal -I.. athkey.c
gcc -o athchans -g -O2 -Wall -I. -I../hal -I.. athchans.c
gcc -o athctrl -g -O2 -Wall -I. -I../hal -I.. athctrl.c
gcc -o athdebug -g -O2 -Wall -I. -I../hal -I.. athdebug.c
gcc -o 80211debug -g -O2 -Wall -I. -I../hal -I.. 80211debug.c
gcc -o wlanconfig -g -O2 -Wall -I. -I../hal -I.. wlanconfig.c
gcc -o ath_info -g -O2 -Wall ath_info.c
make[1]: Leaving directory `/home/rafa/0_Down/1_Source/WireLess/madwifi-0.9.4/tools’

# make install

sh scripts/find-madwifi-modules.sh 2.6.18-92.1.13.el5
for i in ath/ ath_hal/ ath_rate/ net80211/; do \
make -C $i install || exit 1; \
done



install -d /usr/local/man/man8
install -m 0644 man/*.8 /usr/local/man/man8
make[1]: Leaving directory `/home/rafa/0_Down/1_Source/WireLess/madwifi-0.9.4/tools’

Configuration and re-boot

# modprob ath_pci
# iwconfig

lo no wireless extensions.

eth1 no wireless extensions.

eth2 no wireless extensions.

sit0 no wireless extensions.

wifi0 no wireless extensions.

ath0 IEEE 802.11b ESSID:”"

Mode:Managed Channel:0 Access Point: Not-Associated
Bit Rate:0 kb/s Tx-Power:0 dBm Sensitivity=1/1
Retry:off RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=0/70 Signal level=-256 dBm Noise level=-256 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

# ifconfig ath0 up
# wlanconfig ath0 list scan

show all available bssid's


--------------------------------------------------------------------------------------------------------------

If your doing protocol test and you want to have control how many packets are going from your wifi interface. You need to do simple two steps before compiling.

step 1:-

In madwifi-0.9.4/ath/if_athvar.h file change line '#define ATH_TXMAXTRY 11' to '#define ATH_TXMAXTRY 1'.

step 2:-

In madwifi-0.9.4/ath/if_ath.c file change line 'sc -> sc_mrretry = ath_hal_setupxtxdesc(ath, NULL, 0,0,0,0,0,0);' with 'sc-> sc_mrretry=0'.

In place of '0' you can write FALSE and add macro for it.


Now start compilation.

--------------------------------------------------------------------------------------------

No comments: