Jimmy's weblog

11/1/2004

Via-rhine and kernel 2.4.18 *grml*

Filed under: — jimmy @ 7:14 pm

Today I had to install a debian woody gateway. Everything was fine except the two network cards that use the via-rhine module. When modprobing via-rhine I always got error messages like this:

/lib/modules/2.4.18-1-686/kernel/drivers/net/via-rhine.o: init_module: No such device
Hint: insmod errors can be caused by incorrect module parameters, including invalid IO or IRQ parameters
/lib/modules/2.4.18-1-686/kernel/drivers/net/via-rhine.o: insmod /lib/modules/2.4.18-1-686/kernel/drivers/net/via-rhine.o failed
/lib/modules/2.4.18-1-686/kernel/drivers/net/via-rhine.o: insmod via-rhine failed

After a lot of googling I found out that this problem is related to the 2.4.18 kernel *grml*. Fortunately I was able to find a weblog entry describing the solution.
Nevertheless I want to sum up what has to be done. First, get the kernel-headers and the source of the via-rhine driver:

apt-get install kernel-headers-2.4.18-bf2.4
cd /usr/src
mkdir modules
cd modules
mkdir via-rhine
cd via-rhine
wget --passive ftp://ftp.scyld.com/pub/network/via-rhine.c
wget --passive ftp://ftp.scyld.com/pub/network/pci-scan.*
wget --passive ftp://ftp.scyld.com/pub/network/kern_compat.h
wget --passive ftp://ftp.scyld.com/pub/network/Makefile

To compile the driver we can also use the Makefile, we just have to add the variable for the kernel-headers and to tell make only to compile via-rhine and pci-scan:

make KERN_INCLUDE=/usr/src/kernel-headers-2.4.18-1-686/include/ 
KERNVER=`uname -r` via-rhine.o
make KERN_INCLUDE=/usr/src/kernel-headers-2.4.18-1-686/include/ 
KERNVER=`uname -r` pci-scan.o

Take care about the line breaks, sorry ’bout that.
Before we copy the new driver into the default location we try to load the module:

insmod mii
insmod pci-scan.o
insmod via-rhine.o

Note the .o after the last two modules! Don’t forget it, otherwise we will again load the original modules.
If everything is ok we can rename the original module and copy the new driver to the /lib/modules directory

cd /lib/modules/2.4.18-1-686/kernel/drivers/net/
mv via-rhine.o via-rhine.o.orig
cp /usr/src/modules/via-rhine/pci-scan.o .
cp /usr/src/modules/via-rhine/via-rhine.o .
rmmod via-rhine
rmmod pci-scan
depmod
modprobe via-rhine

Orinoco drivers and monitor mode

Filed under: — jimmy @ 1:32 pm

When testing security of wireless networks, you need to set your wireless card into monitor mode to capture packets. It works out of the box with linux-wlan-ng drivers, but it you want to use the orinoco driver which in included in the official kernel source, you are out of luck. It doesn’t support the monitor mode, but you can patch the orinoco source to get back the monitor mode.
First, download the patch (The patch is for version 0.13e which is included in the latest 2.6.x kernels).
Next, patch the kernel source:

devil:~# cd /usr/src/linux/drivers/net/wireless/
devil:/usr/src/linux/drivers/net/wireless# patch -p1 < monitor-0.13e.patch

Now recompile your kernel. In my case the drivers are compiled as modules, so I only had to run

devil:/usr/src/linux/drivers/net/wireless# cd /usr/src/linux/                     
devil:/usr/src/linux# make modules && make modules_install

iwpriv should now list the monitor mode.