2007-11-29 15:53:13

by Francesco Gringoli

[permalink] [raw]
Subject: ath5k: filter patch

Hello everybody,

I discovered that playing with iface promiscuity to capture traffic
(including control, promisc and all other stuff) is not working on
ath5k as rx_filters are never refreshed. To make things going I added
a single ath5k_hw_set_rx_filters(ah,rfilt) at the end of
ath5k_configure_filter(). I attach the simple patch. Now tcpdump
captures everything in monitor mode when iface is set to promisc.

By the way, has someone tried to put ath5k into using RTS/CTS procedure?

Regards,
FG



--- wireless-2.6.old/drivers/net/wireless/ath5k/base.c
2007-11-29 16:20:27.000000000 +0100
+++ wireless-2.6/drivers/net/wireless/ath5k/base.c 2007-11-29
16:21:24.000000000 +0100
@@ -2813,6 +2813,9 @@
rfilt |= AR5K_RX_FILTER_BEACON;
}
+ /* Set filters */
+ ath5k_hw_set_rx_filter(ah,rfilt);
+
/* Set multicast bits */
ath5k_hw_set_mcast_filter(ah, mfilt[0], mfilt[1]);
/* Set the cached hw filter flags, this will alter actually




2007-11-29 18:04:04

by Nick Kossifidis

[permalink] [raw]
Subject: Re: ath5k: filter patch

2007/11/29, Francesco Gringoli <[email protected]>:
> Hello everybody,
>
> I discovered that playing with iface promiscuity to capture traffic
> (including control, promisc and all other stuff) is not working on
> ath5k as rx_filters are never refreshed. To make things going I added
> a single ath5k_hw_set_rx_filters(ah,rfilt) at the end of
> ath5k_configure_filter(). I attach the simple patch. Now tcpdump
> captures everything in monitor mode when iface is set to promisc.
>
> By the way, has someone tried to put ath5k into using RTS/CTS procedure?
>
> Regards,
> FG
>
>
>
> --- wireless-2.6.old/drivers/net/wireless/ath5k/base.c
> 2007-11-29 16:20:27.000000000 +0100
> +++ wireless-2.6/drivers/net/wireless/ath5k/base.c 2007-11-29
> 16:21:24.000000000 +0100
> @@ -2813,6 +2813,9 @@
> rfilt |= AR5K_RX_FILTER_BEACON;
> }
> + /* Set filters */
> + ath5k_hw_set_rx_filter(ah,rfilt);
> +
> /* Set multicast bits */
> ath5k_hw_set_mcast_filter(ah, mfilt[0], mfilt[1]);
> /* Set the cached hw filter flags, this will alter actually
>
>

Thanx a lot for your patch !, plz check out
http://www.linuxwireless.org/en/developers/SubmittingPatches
on how to submit your patch on the list and resubmit so it can be included ;-)

--
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick

2007-11-30 07:18:28

by Francesco Gringoli

[permalink] [raw]
Subject: Re: ath5k: filter patch

Hello,

yes, the problem was there also with iface configured in monitor mode
to capture its own traffic and set to promisc to catch also ucast
traffic to other STAs (and their related control traffic). That
happened because rx filters were never set up (or changed) during
ioctls due to

ifconfig wlan0 promisc

or

iwconfig wlan0 mode monitor

Only mcast filters were set up by ath5k_configure_filters. Probably
sometime in the past the line to set up rx_filters in this function
disappeared from the code, I debugged all the base.c and hw.c to see
if there were other parts in the code to set up rx filters during
ioctls but there are not.

I repeat, this depends on the fact the there are no lines of code
supposed to change rx_filters during ioctls.

By the way, again, has someone noticed that ath5k driver is not
properly setting up rts procedure when asked?

Best regards,
FG

On Nov 29, 2007, at 22:38, Luis R. Rodriguez wrote:

> On Nov 29, 2007 10:53 AM, Francesco Gringoli
> <[email protected]> wrote:
>> Hello everybody,
>>
>> I discovered that playing with iface promiscuity to capture traffic
>> (including control, promisc and all other stuff) is not working on
>> ath5k as rx_filters are never refreshed. To make things going I added
>> a single ath5k_hw_set_rx_filters(ah,rfilt) at the end of
>> ath5k_configure_filter(). I attach the simple patch. Now tcpdump
>> captures everything in monitor mode when iface is set to promisc.
>
> Are you using monitor or promisc? Promiscous is just supposed to sniff
> what you would sniff as if you were on Ethernet -- stuff destined to
> your BSSID if STA. Monitor is 'catch it all'. Under this definition,
> is it still "misbehaving"? For now you can get a real "monitor"
> interface by using iw:
>
> http://git.sipsolutions.net/iw.git
>
> However this requires you to have libnl-1.0 pre8. The libnl URL is
> down, in fact Thomas's home dir is not even working right now.. hmm,
> CC'ing him. You can find pre8 here:
>
> git://git.kernel.org/pub/scm/libs/netlink/libnl.git
>
> Luis

%%%%%%%%%%%%%%%%%%%%%

Francesco Gringoli, PhD - Assistant Professor
Dept. of Electrical Engineering for Automation
University of Brescia
via Branze, 38
25123 Brescia
ITALY

Ph: ++39.030.3715843
FAX: ++39.030.380014
WWW: http://www.ing.unibs.it/~gringoli

%%%%%%%%%%%%%%%%%%%%%



2007-11-29 21:38:08

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: ath5k: filter patch

On Nov 29, 2007 10:53 AM, Francesco Gringoli
<[email protected]> wrote:
> Hello everybody,
>
> I discovered that playing with iface promiscuity to capture traffic
> (including control, promisc and all other stuff) is not working on
> ath5k as rx_filters are never refreshed. To make things going I added
> a single ath5k_hw_set_rx_filters(ah,rfilt) at the end of
> ath5k_configure_filter(). I attach the simple patch. Now tcpdump
> captures everything in monitor mode when iface is set to promisc.

Are you using monitor or promisc? Promiscous is just supposed to sniff
what you would sniff as if you were on Ethernet -- stuff destined to
your BSSID if STA. Monitor is 'catch it all'. Under this definition,
is it still "misbehaving"? For now you can get a real "monitor"
interface by using iw:

http://git.sipsolutions.net/iw.git

However this requires you to have libnl-1.0 pre8. The libnl URL is
down, in fact Thomas's home dir is not even working right now.. hmm,
CC'ing him. You can find pre8 here:

git://git.kernel.org/pub/scm/libs/netlink/libnl.git

Luis

2007-11-29 22:20:09

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: ath5k: filter patch

On Nov 29, 2007 4:38 PM, Luis R. Rodriguez <[email protected]> wrote:
> On Nov 29, 2007 10:53 AM, Francesco Gringoli
> <[email protected]> wrote:
> > Hello everybody,
> >
> > I discovered that playing with iface promiscuity to capture traffic
> > (including control, promisc and all other stuff) is not working on
> > ath5k as rx_filters are never refreshed. To make things going I added
> > a single ath5k_hw_set_rx_filters(ah,rfilt) at the end of
> > ath5k_configure_filter(). I attach the simple patch. Now tcpdump
> > captures everything in monitor mode when iface is set to promisc.
>
> Are you using monitor or promisc? Promiscous is just supposed to sniff
> what you would sniff as if you were on Ethernet -- stuff destined to
> your BSSID if STA. Monitor is 'catch it all'. Under this definition,
> is it still "misbehaving"? For now you can get a real "monitor"
> interface by using iw:
>
> http://git.sipsolutions.net/iw.git
>
> However this requires you to have libnl-1.0 pre8. The libnl URL is
> down, in fact Thomas's home dir is not even working right now.. hmm,
> CC'ing him. You can find pre8 here:
>
> git://git.kernel.org/pub/scm/libs/netlink/libnl.git

So I realize there isn't any documentation for iw, so I started it,
I'll try to add more when I have time, I invite other developers to
help expand that as we go:

http://linuxwireless.org/en/users/Documentation/iw

Luis