* [PATCH] rt2x00: TO_DS filter depends on intf_ap_count
@ 2008-03-31 13:24 Ivo van Doorn
2008-03-31 18:23 ` Bas Hulsken
0 siblings, 1 reply; 4+ messages in thread
From: Ivo van Doorn @ 2008-03-31 13:24 UTC (permalink / raw)
To: John W. Linville; +Cc: rt2400-devel, linux-wireless, Bas Hulsken
The TO_DS filter does not only depend on the FIF_PROMISC_IN_BSS flag
provided by mac80211, but also on the intf_ap_count count.
This makes sense, since when Master mode is active, we should all frames
that are send to the active AP (the device itself).
This means that when an interface is added we should force the
packet filter to be updated during the next mac80211 call of
configure_filter() to make sure the intf_ap_count field is checked.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
drivers/net/wireless/rt2x00/rt2400pci.c | 3 ++-
drivers/net/wireless/rt2x00/rt2500pci.c | 3 ++-
drivers/net/wireless/rt2x00/rt2500usb.c | 3 ++-
drivers/net/wireless/rt2x00/rt2x00mac.c | 7 +++++++
drivers/net/wireless/rt2x00/rt61pci.c | 3 ++-
drivers/net/wireless/rt2x00/rt73usb.c | 3 ++-
6 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index a6e9c89..9abdfb8 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -290,7 +290,8 @@ static void rt2400pci_config_filter(struct rt2x00_dev *rt2x00dev,
rt2x00_set_field32(®, RXCSR0_DROP_NOT_TO_ME,
!(filter_flags & FIF_PROMISC_IN_BSS));
rt2x00_set_field32(®, RXCSR0_DROP_TODS,
- !(filter_flags & FIF_PROMISC_IN_BSS));
+ !(filter_flags & FIF_PROMISC_IN_BSS) &&
+ !rt2x00dev->intf_ap_count);
rt2x00_set_field32(®, RXCSR0_DROP_VERSION_ERROR, 1);
rt2x00pci_register_write(rt2x00dev, RXCSR0, reg);
}
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index 1bdb873..54c9a75 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -291,7 +291,8 @@ static void rt2500pci_config_filter(struct rt2x00_dev *rt2x00dev,
rt2x00_set_field32(®, RXCSR0_DROP_NOT_TO_ME,
!(filter_flags & FIF_PROMISC_IN_BSS));
rt2x00_set_field32(®, RXCSR0_DROP_TODS,
- !(filter_flags & FIF_PROMISC_IN_BSS));
+ !(filter_flags & FIF_PROMISC_IN_BSS) &&
+ !rt2x00dev->intf_ap_count);
rt2x00_set_field32(®, RXCSR0_DROP_VERSION_ERROR, 1);
rt2x00_set_field32(®, RXCSR0_DROP_MCAST,
!(filter_flags & FIF_ALLMULTI));
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index f5c18f0..28fdf19 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -337,7 +337,8 @@ static void rt2500usb_config_filter(struct rt2x00_dev *rt2x00dev,
rt2x00_set_field16(®, TXRX_CSR2_DROP_NOT_TO_ME,
!(filter_flags & FIF_PROMISC_IN_BSS));
rt2x00_set_field16(®, TXRX_CSR2_DROP_TODS,
- !(filter_flags & FIF_PROMISC_IN_BSS));
+ !(filter_flags & FIF_PROMISC_IN_BSS) &&
+ !rt2x00dev->intf_ap_count);
rt2x00_set_field16(®, TXRX_CSR2_DROP_VERSION_ERROR, 1);
rt2x00_set_field16(®, TXRX_CSR2_DROP_MULTICAST,
!(filter_flags & FIF_ALLMULTI));
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index a0adf5a..dc70e7a 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -253,6 +253,13 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw,
*/
rt2x00lib_config_intf(rt2x00dev, intf, conf->type, intf->mac, NULL);
+ /*
+ * Some filters depend on the current working mode. We can force
+ * an update during the next configure_filter() run by mac80211 by
+ * resetting the current packet_filter state.
+ */
+ rt2x00dev->packet_filter = 0;
+
return 0;
}
EXPORT_SYMBOL_GPL(rt2x00mac_add_interface);
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 0d2e6f7..c5c6251 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -342,7 +342,8 @@ static void rt61pci_config_filter(struct rt2x00_dev *rt2x00dev,
rt2x00_set_field32(®, TXRX_CSR0_DROP_NOT_TO_ME,
!(filter_flags & FIF_PROMISC_IN_BSS));
rt2x00_set_field32(®, TXRX_CSR0_DROP_TO_DS,
- !(filter_flags & FIF_PROMISC_IN_BSS));
+ !(filter_flags & FIF_PROMISC_IN_BSS) &&
+ !rt2x00dev->intf_ap_count);
rt2x00_set_field32(®, TXRX_CSR0_DROP_VERSION_ERROR, 1);
rt2x00_set_field32(®, TXRX_CSR0_DROP_MULTICAST,
!(filter_flags & FIF_ALLMULTI));
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index b3c8462..796cf29 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -354,7 +354,8 @@ static void rt73usb_config_filter(struct rt2x00_dev *rt2x00dev,
rt2x00_set_field32(®, TXRX_CSR0_DROP_NOT_TO_ME,
!(filter_flags & FIF_PROMISC_IN_BSS));
rt2x00_set_field32(®, TXRX_CSR0_DROP_TO_DS,
- !(filter_flags & FIF_PROMISC_IN_BSS));
+ !(filter_flags & FIF_PROMISC_IN_BSS) &&
+ !rt2x00dev->intf_ap_count);
rt2x00_set_field32(®, TXRX_CSR0_DROP_VERSION_ERROR, 1);
rt2x00_set_field32(®, TXRX_CSR0_DROP_MULTICAST,
!(filter_flags & FIF_ALLMULTI));
--
1.5.4.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] rt2x00: TO_DS filter depends on intf_ap_count
2008-03-31 13:24 [PATCH] rt2x00: TO_DS filter depends on intf_ap_count Ivo van Doorn
@ 2008-03-31 18:23 ` Bas Hulsken
2008-04-01 12:10 ` Johannes Berg
0 siblings, 1 reply; 4+ messages in thread
From: Bas Hulsken @ 2008-03-31 18:23 UTC (permalink / raw)
To: Ivo van Doorn; +Cc: rt2400-devel, linux-wireless, Johannes Berg
On Mon, 2008-03-31 at 15:24 +0200, Ivo van Doorn wrote:
> The TO_DS filter does not only depend on the FIF_PROMISC_IN_BSS flag
> provided by mac80211, but also on the intf_ap_count count.
> This makes sense, since when Master mode is active, we should all frames
> that are send to the active AP (the device itself).
>
> This means that when an interface is added we should force the
> packet filter to be updated during the next mac80211 call of
> configure_filter() to make sure the intf_ap_count field is checked.
I can confirm that this solves the problem that causes hostapd (running
on rt2500pci) to fail to receive EAPOL key frames from a client that
tries to connect. So you can scratch this one from your todo list,
Johannes.
many thanks, Ivo and Johannes!
unfortunately I still don't have a working AP, since hostapd crashes
when receiving the EAPOL key from the client. I'm still trying to find
out what exactly happens, I'll post more info in a new thread. I'm
inclined to think that the problem lies on the driver side, since this
used to work at the 31st of January this year, with hostapd-0.6.2, which
is the version I've tested with now.
best regards,
Bas Hulsken
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rt2x00: TO_DS filter depends on intf_ap_count
2008-03-31 18:23 ` Bas Hulsken
@ 2008-04-01 12:10 ` Johannes Berg
2008-04-01 12:57 ` Bas Hulsken
0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2008-04-01 12:10 UTC (permalink / raw)
To: Bas Hulsken; +Cc: Ivo van Doorn, rt2400-devel, linux-wireless
[-- Attachment #1: Type: text/plain, Size: 498 bytes --]
> unfortunately I still don't have a working AP, since hostapd crashes
> when receiving the EAPOL key from the client. I'm still trying to find
> out what exactly happens, I'll post more info in a new thread. I'm
> inclined to think that the problem lies on the driver side, since this
> used to work at the 31st of January this year, with hostapd-0.6.2, which
> is the version I've tested with now.
What exactly happens? I guess you have my (single) hostapd patch
applied?
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rt2x00: TO_DS filter depends on intf_ap_count
2008-04-01 12:10 ` Johannes Berg
@ 2008-04-01 12:57 ` Bas Hulsken
0 siblings, 0 replies; 4+ messages in thread
From: Bas Hulsken @ 2008-04-01 12:57 UTC (permalink / raw)
To: Ivo van Doorn, rt2400-devel, linux-wireless
[-- Attachment #1: Type: text/plain, Size: 1912 bytes --]
On Tue, 2008-04-01 at 14:10 +0200, Johannes Berg wrote:
> > unfortunately I still don't have a working AP, since hostapd crashes
> > when receiving the EAPOL key from the client. I'm still trying to find
> > out what exactly happens, I'll post more info in a new thread. I'm
> > inclined to think that the problem lies on the driver side, since this
> > used to work at the 31st of January this year, with hostapd-0.6.2, which
> > is the version I've tested with now.
>
> What exactly happens? I guess you have my (single) hostapd patch
> applied?
I'm still not sure, I decided to investigate a bit more, before I bother
you with a stupid mistake on my side. I'm reasonably sure I applied your
hostapd patch (001-beacon-int-hack.patch, right?), but I'll check again
tonight, when I have direct access to the machine. Next to that, I've
also had to patch hostapd a bit further, else it wouldn't compile. I've
renamed all NL80211_STA_STAT_* to NL80211_STA_INFO_* in
driver_nl80211.c, see attached patch. Was that ok? It seemed trivial.
What seems to happen, is that wlan1 receives exactly one frame from the
laptop, and then hostapd hangs, and no further frames are sent from
hostapd, although beacon frames are still being sent, and the interface
still receives frames as well. This happens immediately after rt2500pci
receives the EAPOL key from the laptop, so I guess it is in fact the
EAPOL key that is the single frame that wlan1 receives. As I've
mentioned before, only ctrl-c can kill hostapd, and after that the
driver is in an unusable state (at least for hostapd) rmmod rt2500pci,
followed by insmod rt2500pci returns stuff to a usable state.
well, I'll look into it a bit more, I've attached the hostapd output
(hostapd.log), and a capture of all frames on rt2500pci (dump.pcap)
together with hostapd.conf and ifcfg-wlan1, perhaps you can see
something obvious.
thanks for your help,
Bas Hulsken
[-- Attachment #2: convertSTA_STATtoSTA_INFO.diff --]
[-- Type: text/x-patch, Size: 2137 bytes --]
--- hostap/hostapd/driver_nl80211.c 2008-03-18 13:53:20.000000000 +0100
+++ ./driver_nl80211.c 2008-03-22 17:28:39.000000000 +0100
@@ -598,11 +598,11 @@
struct nlattr *tb[NL80211_ATTR_MAX + 1];
struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
struct hostap_sta_driver_data *data = arg;
- struct nlattr *stats[NL80211_STA_STAT_MAX + 1];
- static struct nla_policy stats_policy[NL80211_STA_STAT_MAX + 1] = {
- [NL80211_STA_STAT_INACTIVE_TIME] = { .type = NLA_U32 },
- [NL80211_STA_STAT_RX_BYTES] = { .type = NLA_U32 },
- [NL80211_STA_STAT_TX_BYTES] = { .type = NLA_U32 },
+ struct nlattr *stats[NL80211_STA_INFO_MAX + 1];
+ static struct nla_policy stats_policy[NL80211_STA_INFO_MAX + 1] = {
+ [NL80211_STA_INFO_INACTIVE_TIME] = { .type = NLA_U32 },
+ [NL80211_STA_INFO_RX_BYTES] = { .type = NLA_U32 },
+ [NL80211_STA_INFO_TX_BYTES] = { .type = NLA_U32 },
};
nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
@@ -614,24 +614,24 @@
* the kernel starts sending station notifications.
*/
- if (!tb[NL80211_ATTR_STA_STATS]) {
+ if (!tb[NL80211_ATTR_STA_INFO]) {
wpa_printf(MSG_DEBUG, "sta stats missing!");
return NL_SKIP;
}
- if (nla_parse_nested(stats, NL80211_STA_STAT_MAX,
- tb[NL80211_ATTR_STA_STATS],
+ if (nla_parse_nested(stats, NL80211_STA_INFO_MAX,
+ tb[NL80211_ATTR_STA_INFO],
stats_policy)) {
wpa_printf(MSG_DEBUG, "failed to parse nested attributes!");
return NL_SKIP;
}
- if (stats[NL80211_STA_STAT_INACTIVE_TIME])
+ if (stats[NL80211_STA_INFO_INACTIVE_TIME])
data->inactive_msec =
- nla_get_u32(stats[NL80211_STA_STAT_INACTIVE_TIME]);
- if (stats[NL80211_STA_STAT_RX_BYTES])
- data->rx_bytes = nla_get_u32(stats[NL80211_STA_STAT_RX_BYTES]);
- if (stats[NL80211_STA_STAT_TX_BYTES])
- data->rx_bytes = nla_get_u32(stats[NL80211_STA_STAT_TX_BYTES]);
+ nla_get_u32(stats[NL80211_STA_INFO_INACTIVE_TIME]);
+ if (stats[NL80211_STA_INFO_RX_BYTES])
+ data->rx_bytes = nla_get_u32(stats[NL80211_STA_INFO_RX_BYTES]);
+ if (stats[NL80211_STA_INFO_TX_BYTES])
+ data->rx_bytes = nla_get_u32(stats[NL80211_STA_INFO_TX_BYTES]);
return NL_SKIP;
}
[-- Attachment #3: hostapd_try3.tar.bz2 --]
[-- Type: application/x-bzip-compressed-tar, Size: 99476 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-04-01 12:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-31 13:24 [PATCH] rt2x00: TO_DS filter depends on intf_ap_count Ivo van Doorn
2008-03-31 18:23 ` Bas Hulsken
2008-04-01 12:10 ` Johannes Berg
2008-04-01 12:57 ` Bas Hulsken
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).