2012-11-25 19:10:17

by Petr Štetiar

[permalink] [raw]
Subject: Multi-bss operation issue with rt2x00 and hostapd on rt305x platform

Hi,

first of all, I apologize for cross posting. Please kindly keep me in the Cc
loop as I'm not subscribed to the mailing lists.

For the past week I'm trying to get multi-bss working on ramips platform, it's
a Carambola(from 8Devices) board with rt3050 SOC, which use rt2x00 driver for
wireless. I use OpenWRT, which currently have 3.3.8 kernel and compat-wireless
from 2012-09-07. On top of this I've applied following patches (otherwise it's
not even possible to create the wlan0-1 and wlan0-2 interfaces):

3e4c4151e56ff367fb1487ea79134eea7410407 [PATCH] rt2x00: Deprecate max_sta_intf field of struct rt2x00_ops
55d2e9da744ba11eae900b4bfc2da72eace3c1e1 [PATCH] rt2x00: Replace open coded interface checking with interface combinations

It's kind of working now, but not completly. I've setup with 3 VAPs:

wlan0: SSID "wlan0-bad"
wlan0-1: SSID "wlan01-ok"
wlan0-2: SSID "wlan02-ok"

just basic configuration and no encryption, attached is complete hostapd's
config file. As you can guess from the SSID names, the first one always
doesn't work, client assoc ends with the following error:

hostapd: wlan0: STA <STA_MAC> IEEE 802.11: did not acknowledge authentication response

but the next two SSIDs works just fine. The wireless stack is quite complex, so
before I'll dive deeper, any hints what should cause this issue? I simply don't
believe, that it's caused by the hostapd, since the same hostapd config works
fine on AR7240 chipset.

I'm attaching debug logs from hostapd and pcaps also. What I've observed so far
is, that in working case(wlan1-ok, wlan2-ok) the frame flow is different:

...
mgmt::auth
authentication: STA=78:d6:f0:09:a2:27 auth_alg=0 auth_transaction=1 status_code=0 wep=0
New STA
ap_sta_add: register ap_handle_timer timeout for 78:d6:f0:09:a2:27 (300 seconds - ap_max_inactivity)
authentication reply: STA=78:d6:f0:09:a2:27 auth_alg=0 auth_transaction=2 resp=0 (IE len=0)
nl80211: CMD_FRAME freq=2457 wait=0 no_cck=0 no_ack=0 offchanok=0
nl80211: Frame TX command accepted; cookie 0x81937c00
Add randomness: count=39 entropy=38
nl80211: Event message available
--> nl80211: MLME event 60 (NL80211_CMD_REGISTER_FRAME)
mgmt::auth cb
wlan0-1: STA 78:d6:f0:09:a2:27 IEEE 802.11: authenticated
...

and this is for non-working case (wlan0-bad)

...
mgmt::auth
authentication: STA=78:d6:f0:09:a2:27 auth_alg=0 auth_transaction=1 status_code=0 wep=0
New STA
ap_sta_add: register ap_handle_timer timeout for 78:d6:f0:09:a2:27 (300 seconds - ap_max_inactivity)
authentication reply: STA=78:d6:f0:09:a2:27 auth_alg=0 auth_transaction=2 resp=0 (IE len=0)
nl80211: CMD_FRAME freq=2457 wait=0 no_cck=0 no_ack=0 offchanok=0
nl80211: Frame TX command accepted; cookie 0x81a089c0
Add randomness: count=12 entropy=11
nl80211: Event message available
--> nl80211: MLME event 59 (NL80211_CMD_SET_TX_BITRATE_MASK)
mgmt::auth
...

I've also observed in the pcaps, that in the working case there's
Authentication sent before Association request and in the non-working case
there's Association request going first and then Authentication request. Any
clue what could cause this? Thank you for any pointers.

As I've seen on the Google, this issue is hanging there for some time already
so I would really like to help and get it fixed finally. Thanks.

-- ynezz


Attachments:
(No filename) (3.25 kB)
hostapd-phy0.conf (1.49 kB)
wlan02-ok.hostapd.txt (2.18 kB)
wlan02-ok.pcap (1.30 kB)
wlan02-ok.txt (100.89 kB)
wlan0-bad.hostapd.txt (3.24 kB)
wlan0-bad.pcap (1.39 kB)
wlan0-bad.txt (148.88 kB)
Download all attachments

2012-11-25 19:39:16

by Petr Štetiar

[permalink] [raw]
Subject: Re: Multi-bss operation issue with rt2x00 and hostapd on rt305x platform

Johannes Berg <[email protected]> [2012-11-25 20:16:58]:

> On Sun, 2012-11-25 at 20:00 +0100, Petr ?tetiar wrote:
>
> > nl80211: CMD_FRAME freq=2457 wait=0 no_cck=0 no_ack=0 offchanok=0
> > nl80211: Frame TX command accepted; cookie 0x81937c00
> > Add randomness: count=39 entropy=38
> > nl80211: Event message available
> > --> nl80211: MLME event 60 (NL80211_CMD_REGISTER_FRAME)
>
> That command string is wrong. 60 really is NL80211_CMD_FRAME_TX_STATUS.
> How did you print that string? The other one, 59, is NL80211_CMD_FRAME,
> not NL80211_CMD_SET_TX_BITRATE_MASK.
>
> It seems to me that you've messed up the nl80211.h header in either
> hostapd or the kernel.

Sorry, my bad. I've created small helper function and messed the enum -> txt
conversion macro in Vim which simply didn't handled the following assign case:

NL80211_CMD_NEW_BEACON = NL80211_CMD_START_AP

I've compared the headers in the hostapd/kernel and here's the diff:

--- nl_hostapd.h 2012-11-25 20:35:47.733001929 +0100
+++ nl_linux.h 2012-11-25 20:36:04.997001488 +0100
@@ -138,6 +138,11 @@

NL80211_CMD_CH_SWITCH_NOTIFY,

+ NL80211_CMD_START_P2P_DEVICE,
+ NL80211_CMD_STOP_P2P_DEVICE,
+
+ NL80211_CMD_CONN_FAILED,
+
/* add new commands above here */

/* used to define NL80211_CMD_MAX below */

So I hope it should be ok. Thanks.

-- ynezz

--- driver_nl80211.c.orig 2012-11-25 17:19:40.609302795 +0100
+++ driver_nl80211.c
2012-11-25 16:58:03.929335949 +0100
@@ -1444,6 +1444,107 @@
wpa_supplicant_event(drv->ctx, type, &event);
}

+static const char* cmd_txt(int cmd)
+{
+ const char *tmp[] = {
+ "NL80211_CMD_UNSPEC",

...snipped...

+ "NL80211_CMD_CH_SWITCH_NOTIFY",
+ };
+
+ return tmp[cmd];
+}

static void mlme_event(struct wpa_driver_nl80211_data *drv,
enum nl80211_commands cmd, struct nlattr *frame,
@@ -1462,8 +1563,8 @@
return;
}

- wpa_printf(MSG_DEBUG, "nl80211: MLME event %d", cmd);
+ wpa_printf(MSG_DEBUG, "nl80211: MLME event %d (%s)", cmd, cmd_txt(cmd));

switch (cmd) {


2012-11-25 19:16:39

by Johannes Berg

[permalink] [raw]
Subject: Re: Multi-bss operation issue with rt2x00 and hostapd on rt305x platform

On Sun, 2012-11-25 at 20:00 +0100, Petr Štetiar wrote:

> nl80211: CMD_FRAME freq=2457 wait=0 no_cck=0 no_ack=0 offchanok=0
> nl80211: Frame TX command accepted; cookie 0x81937c00
> Add randomness: count=39 entropy=38
> nl80211: Event message available
> --> nl80211: MLME event 60 (NL80211_CMD_REGISTER_FRAME)

That command string is wrong. 60 really is NL80211_CMD_FRAME_TX_STATUS.
How did you print that string? The other one, 59, is NL80211_CMD_FRAME,
not NL80211_CMD_SET_TX_BITRATE_MASK.

It seems to me that you've messed up the nl80211.h header in either
hostapd or the kernel.

johannes