rt2x00.serialmonkey.com
http://rt2x00.serialmonkey.com/phpBB/

rt2x00 master mode HOWTO
http://rt2x00.serialmonkey.com/phpBB/viewtopic.php?f=5&t=4963
Page 2 of 4

Author:  tompl [ Wed Dec 31, 2008 1:19 am ]
Post subject:  Re: rt2x00 master mode HOWTO

Kanamara wrote:
Quote:
help deal with the problem:
Code:
# hostapd -dd hostapd.conf
Configuration file: hostapd.conf
ctrl_interface_group=0
Opening raw packet socket for ifindex -1208310116
BSS count 1, BSSID mask ff:ff:ff:ff:ff:ff (0 bits)
SIOCGIWRANGE: WE(compiled)=22 WE(source)=21 enc_capa=0xf
wlan0: IEEE 802.11 Configured channel (8) not found from the channel list of current mode (1) IEEE 802.11g
wlan0: IEEE 802.11 Hardware does not support configured channel
Could not select hw_mode and channel. (-1)
wlan0: Unable to setup interface.
rmdir[ctrl_interface]: No such file or directory

do u compile rt2x00 kernel? i tried before to compile the latest kernel from kernel.org with wireless-next and ap/vlan patch without success (got the same errors)u need to:

Code:
1. GIT
wget http://www.kernel.org/pub/software/scm/git/git-1.5.0.5.tar.gz
tar zxf git-1.5.0.5.tar.gz
cd git-1.5.0.5
make; make prefix=/usr/local install

2. RT2x00 CVS
git clone git://git.kernel.org/pub/scm/linux/kernel/git/ivd/rt2x00.git/
cp rt2x00 /usr/src/
ln -s /usr/src/rt2x00 /usr/src/linux

3. kernel
cd /usr/src/linux
make menuconfig
make all
make modules_install
cp /usr/src/linux/arch/x86/boot/bzImage /boot/

4. lilo
mcedit /etc/lilo.conf
lilo

5. LIBNL
wget http://people.suug.ch/~tgr/libnl/files/libnl-1.1.tar.gz
tar zxf libnl-1.1.tar.gz
cd libnl-1.1
cp libnl-1.1 /usr/src/libnl
./configure
make
make install

5. HOSTAPD
git clone git://w1.fi/srv/git/hostap.git
cd hostap/hostapd/
cp defconfig .config

CONFIG_DRIVER_NL80211=y
LIBNL=/usr/src/libnl
CFLAGS += -I$(LIBNL)/include
LIBS += -L$(LIBNL)/lib
make && make install
touch /etc/hostapd/hostapd.conf
hostapd -Bdd /etc/hostapd/hostapd.conf

its my personal notes.

Author:  hotbelgo [ Wed Dec 31, 2008 1:34 pm ]
Post subject:  Re: rt2x00 master mode HOWTO

I have a spare D-Link Airplus G DWL G510 wireless pci, which reports containing a RaLink RT2561/RT61 rev B 802.11gchip.

I first thought this could be done using iwconfig:

iwconfig wlan0 essid thuisnet mode master

but that resulted in:

Error for wireless request "Set Mode" (8B06) :
SET failed on device wlan0 ; Invalid argument.

It seems as though rt2x000 drivers for my card are under development, but that a howto exists.

Configuring the hostapd that comes with Mandriva 2009 to use nl80211 (which I presume is necessary given that you need specifically to compile it) led to
Line 17: invalid/unknown driver 'nl80211'

So it looks as though I need to recompile the code with nl80211 included. Mandriva comes with libnl 1.1, which seems to be the latest. The latest development code (Hostap 0.6.6) compiled OK, but the git code did not.

Running as a user gives
ioctl[SIOCSIFFLAGS]: Permission denied

While as root
# ./hostapd -dd /etc/hostapd/hostapd.conf
Configuration file: /etc/hostapd/hostapd.conf
ctrl_interface_group=0
Failed to set interface wlan0 to master mode.
nl80211 driver initialization failed.
wlan0: Unable to setup interface.
rmdir[ctrl_interface]: No such file or directory
ELOOP: remaining socket: sock=5 eloop_data=0x84a3848 user_data=(nil) handler=0x8079420

Si it seems to be the master mode issue again. I really don't want to have to recompile a kernel if at all possible.
Any advice?
HB

Author:  tompl [ Wed Dec 31, 2008 2:01 pm ]
Post subject:  Re: rt2x00 master mode HOWTO

U cant use IWCONFIG to set the master mode.... u have to use hostapd instead.
paste source of net/mac80211/cfg.c and uname -a.
Its a diffrence between mac80211 and accepting master mode. Since kernel 2.6.24 all kernels have subsystem mac80211(http://liquidat.wordpress.com/2007/03/0 ... rnel-tree/). But to use master mode on rt61 u need to compile with ap/vlan patch that for new kernels 2.6.28 doesnt work.

Read this topic from beginning. In my post before u have all steps to make ur wifi working in master mode.

Author:  hotbelgo [ Wed Dec 31, 2008 2:22 pm ]
Post subject:  Re: rt2x00 master mode HOWTO

Here you go:

I didn't follow all that you said, but I might be capable of compiling a module or two if needed.


Linux 2.6.27.7-desktop586-1mnb #1 SMP Thu Dec 11 16:32:08 EST 2008 i686 Intel(R) Celeron(R) CPU 2.26GHz GNU/Linux
Code:

/*
* mac80211 configuration hooks for cfg80211
*
* Copyright 2006, 2007   Johannes Berg <johannes@sipsolutions.net>
*
* This file is GPLv2 as found in COPYING.
*/

#include <linux/ieee80211.h>
#include <linux/nl80211.h>
#include <linux/rtnetlink.h>
#include <net/net_namespace.h>
#include <linux/rcupdate.h>
#include <net/cfg80211.h>
#include "ieee80211_i.h"
#include "cfg.h"
#include "rate.h"
#include "mesh.h"

static enum ieee80211_if_types
nl80211_type_to_mac80211_type(enum nl80211_iftype type)
{
   switch (type) {
   case NL80211_IFTYPE_UNSPECIFIED:
      return IEEE80211_IF_TYPE_STA;
   case NL80211_IFTYPE_ADHOC:
      return IEEE80211_IF_TYPE_IBSS;
   case NL80211_IFTYPE_STATION:
      return IEEE80211_IF_TYPE_STA;
   case NL80211_IFTYPE_MONITOR:
      return IEEE80211_IF_TYPE_MNTR;
#ifdef CONFIG_MAC80211_MESH
   case NL80211_IFTYPE_MESH_POINT:
      return IEEE80211_IF_TYPE_MESH_POINT;
#endif
   case NL80211_IFTYPE_WDS:
      return IEEE80211_IF_TYPE_WDS;
   default:
      return IEEE80211_IF_TYPE_INVALID;
   }
}

Author:  tompl [ Wed Dec 31, 2008 3:31 pm ]
Post subject:  Re: rt2x00 master mode HOWTO

u didnt apply ap/vlan patch, u need to manual edit that file and change one function:
Code:
static enum ieee80211_if_types
nl80211_type_to_mac80211_type(enum nl80211_iftype type)
{
   switch (type) {
   case NL80211_IFTYPE_UNSPECIFIED:
      return IEEE80211_IF_TYPE_STA;
   case NL80211_IFTYPE_ADHOC:
      return IEEE80211_IF_TYPE_IBSS;
   case NL80211_IFTYPE_STATION:
      return IEEE80211_IF_TYPE_STA;
   case NL80211_IFTYPE_MONITOR:
      return IEEE80211_IF_TYPE_MNTR;
#ifdef CONFIG_MAC80211_MESH
   case NL80211_IFTYPE_MESH_POINT:
      return IEEE80211_IF_TYPE_MESH_POINT;
#endif
       case NL80211_IFTYPE_AP:
               return IEEE80211_IF_TYPE_AP;
       case NL80211_IFTYPE_AP_VLAN:
               return IEEE80211_IF_TYPE_VLAN;
        case NL80211_IFTYPE_WDS:
                return IEEE80211_IF_TYPE_WDS;
   default:
      return IEEE80211_IF_TYPE_INVALID;
   }
}


or apply patch from command line:
do it in ur kernel source folder
patch -p1 < /path/to/009-allow-ap-vlan-modes.patch


http://johannes.sipsolutions.net/patche ... odes.patch

Author:  hotbelgo [ Thu Jan 01, 2009 4:21 pm ]
Post subject:  Re: rt2x00 master mode HOWTO

I recompiled the mac80211 module with the patch and replaced the existing mac80211.ko.gz in /lib/modules but modprobe is failing

WARNING: Error inserting mac80211 (/lib/modules/2.6.27.7-desktop586-1mnb/kernel/net/mac80211/mac80211.ko.gz): Invalid module format

This is because I am having trouble getting the module to be the right format

mac80211: version magic '2.6.27.7-1mnbcustom SMP mod_unload 586 ' should be '2.6.27.7-desktop586-1mnb SMP mod_unload 586 '

But I can't find the right file is /usr/src/linux to fix this

Author:  tompl [ Fri Jan 02, 2009 4:27 pm ]
Post subject:  Re: rt2x00 master mode HOWTO

hotbelgo wrote:
I recompiled the mac80211 module with the patch and replaced the existing mac80211.ko.gz in /lib/modules but modprobe is failing

WARNING: Error inserting mac80211 (/lib/modules/2.6.27.7-desktop586-1mnb/kernel/net/mac80211/mac80211.ko.gz): Invalid module format

This is because I am having trouble getting the module to be the right format

mac80211: version magic '2.6.27.7-1mnbcustom SMP mod_unload 586 ' should be '2.6.27.7-desktop586-1mnb SMP mod_unload 586 '

But I can't find the right file is /usr/src/linux to fix this

Did u compile kernel with mac80211 as a module(M) or built-in(*)

Author:  hotbelgo [ Sat Jan 03, 2009 7:56 am ]
Post subject:  Re: rt2x00 master mode HOWTO

WOW - it works ... sort of! Thanks!
I can now follow the instructions on the sitre and get a result. But I can't start hostapd in daemon mode ( -B ) as that always leads to errors:

./hostapd -B ./hostapd.conf
Configuration file: ./hostapd.conf
Failed to update rate sets in kernel module
Mode: IEEE 802.11g Channel: 8 Frequency: 2447 MHz
Failed to set CTS protect in kernel driver
Failed to set Short Slot Time option in kernel driver
Could not set preamble for kernel driver
Using interface wlan0 with hwaddr 00:19:5b:8a:46:f7 and ssid 'test'
Failed to set CTS protect in kernel driver
Failed to set Short Slot Time option in kernel driver
Could not set preamble for kernel driver

Any ideas

Author:  IvD [ Sat Jan 03, 2009 9:51 am ]
Post subject:  Re: rt2x00 master mode HOWTO

Did you use the latest version of hostapd (the .git version) and did you enable nl80211?

Author:  hotbelgo [ Sat Jan 03, 2009 3:36 pm ]
Post subject:  Re: rt2x00 master mode HOWTO

I'm using the latest development (not git) version, but automagically it now all works (all i think i changed was to set the country code to my country). If you find yourself driving down a particular suburban street in western Europe and see a hotspot called "free wifi" it might just be mine!

Author:  eludias [ Mon Jan 05, 2009 2:07 pm ]
Post subject:  Re: rt2x00 master mode HOWTO

I still cannot get the rt61pci to get into host ap mode.

Things learned in the process, mostly Debian Sid related, all together in one place:

Code:
apt-get install git-core
will install git. Needed.

Code:
008-allow-ap-vlan-modes.patch
which enables host ap mode is in linux kernel 2.6.28 onwards.

Debian has 2.6.26 in unstable, 2.6.27 in experimental so you need a custom kernel.

Code:
apt-get install firmware-ralink
will install needed firmware for Debian.

Debian has an too old hostapd which does not contain needed driver. However, it also contains usefull manual pages and infrastructure. So do install the old version with
Code:
apt-get install hostapd


Get hostapd with '
Code:
git clone git://w1.fi/srv/git/hostap.git
'. All dependencies are in Debian packages (
Code:
apt-get install libnl-dev
)

hostapd needs to be configured to use driver 80211nl. This needs to be compiled in manually (don't know why not enabled by default), copy hostapd/defconfig to hostapd/.config and set
Code:
CONFIG_DRIVER_NL80211=y
. Run make. Copy hostapd to /usr/sbin over the old version in Debian.

Edit /etc/hostapd/hostapd.conf

Add to /etc/network/interfaces:
Quote:
auto wlan0
iface wlan0 inet manual
hostapd /etc/hostapd/hostapd.conf

This should bring up wlan0 on boot, and run hostapd.

Test configuration with '
Code:
hostapd -dd /etc/hostapd/hostapd.conf
'. Also look in dmesg for clues.

....but...

This doesn't work for me, while I've got the feeling that it should.

Code:
latti:~# hostapd -dd /etc/hostapd/hostapd.conf
Configuration file: /etc/hostapd/hostapd.conf
ctrl_interface_group=0
Failed to set interface wlan0 to master mode.
nl80211 driver initialization failed.
wlan0: Unable to setup interface.
rmdir[ctrl_interface]: No such file or directory
ELOOP: remaining socket: sock=5 eloop_data=0x8d6e840 user_data=(nil) handler=0x807bc00


Ok, so could not set master mode. That's the same error as when patch is not applied, but this is 2.6.28 which should work out-of-the-box.

More output:

Code:
latti:~# uname -a
Linux latti 2.6.28 #4 Mon Jan 5 12:18:15 CET 2009 i686 GNU/Linux

latti:~# hostapd -v
hostapd v0.6.6
User space daemon for IEEE 802.11 AP management,
IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
Copyright (c) 2002-2008, Jouni Malinen <j@w1.fi> and contributors

latti:~# iwconfig wlan0
wlan0     IEEE 802.11bg  ESSID:"" 
          Mode:Managed  Frequency:2.412 GHz  Access Point: Not-Associated   
          Tx-Power=19 dBm   
          Retry min limit:7   RTS thr:off   Fragment thr=2352 B   
          Encryption key:off
          Power Management:off
          Link Quality:0  Signal level:0  Noise level:0
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

latti:~# iwconfig wlan0 mode master
Error for wireless request "Set Mode" (8B06) :
    SET failed on device wlan0 ; Invalid argument.


The only worrisome part from dmesg is:

Code:
[   22.909172] cfg80211: Calling CRDA for country: US


...and I'm in .nl and don't know how to set the crda and don't know whether it matters.

Anyone any idea?

Thanks,
Rutger.

Author:  cengique [ Mon Jan 05, 2009 3:49 pm ]
Post subject:  Re: rt2x00 master mode HOWTO

eludias wrote:
I still cannot get the rt61pci to get into host ap mode.

Debian has 2.6.26 in unstable, 2.6.27 in experimental so you need a custom kernel.

...

All dependencies are in Debian packages (
Code:
apt-get install libnl-dev
)



Since you're already compiling a custom kernel, why don't you try the rt2x00-kernel? I got it to work with that. Also, you may need to compile libnl from source, too. See the post above with step-by-step instructions to get these from GIT repositories.

Author:  hotbelgo [ Mon Jan 05, 2009 7:15 pm ]
Post subject:  Re: rt2x00 master mode HOWTO

Did you recompile the mac80211 kernel module? That's what I needed to do after applying the patch: http://linux-tinkering.blogspot.com/
HB

Author:  eludias [ Mon Jan 05, 2009 7:55 pm ]
Post subject:  Re: rt2x00 master mode HOWTO

Yes, I compiled the whole kernel (2.6.28), which should be less error prone than one module.

...and now compiling whole new kernel again, but rt2x00 branch this time. Should be done in 1.5 hours (slow PC)...

This rt2x00 branch seems to be based upon a lot of other trees: it contains about 9000(!) changesets not in mainline.

Author:  eludias [ Mon Jan 05, 2009 9:05 pm ]
Post subject:  Re: rt2x00 master mode HOWTO

Ok, I'm somewhat further now. I've got a new git kernel freshly taken from git tree rt2x00 :)

'bridge_packets' may not be set in hostapd.conf, otherwise you'll get a 'Failed to set bridge_packets for kernel driver'.

In short:
- 2.6.28 is not good enough as kernel
- no security mode works (== can connect from Windows XP)
- WEP mode also works
- WPA (wpa=1): I can give in a key in Windows, but I don't know which (it expects 5 or 10 ASCII, or 13 or 26 hex while I have a passphrase).
- WPA2 mode (wpa=2) does not work at all. Cannot get to enter passphrase

O well, at least I've got WEP working. That's something.

Page 2 of 4 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/