2019-09-27 01:55:53

by Ramon Fontes

[permalink] [raw]
Subject: mac80211_hwsim: packets being transmitted through the monitor interface

Hello,

I've noticed that packets transmitted between two clients connected to
a hostapd AP are also transmitted (injected) through the monitor
interface. Is this expected behavior? I can easily modify such
behavior by changing mac80211_hwsim, but it works only with hwsim0. On
the other hand, if I create a monitor interface via iw it doesn't
work.

--
Ramon Fontes


2019-09-27 12:18:07

by Johannes Berg

[permalink] [raw]
Subject: Re: mac80211_hwsim: packets being transmitted through the monitor interface

On Thu, 2019-09-26 at 22:54 -0300, Ramon Fontes wrote:
> Hello,
>
> I've noticed that packets transmitted between two clients connected to
> a hostapd AP are also transmitted (injected) through the monitor
> interface. Is this expected behavior?

You mean on 'hwsim0'? That interface is just for monitoring what's
happening on the 'virtual air', so yes.

> I can easily modify such
> behavior by changing mac80211_hwsim, but it works only with hwsim0. On
> the other hand, if I create a monitor interface via iw it doesn't
> work.

The two are completely different/unrelated things.

johannes

2019-09-27 12:31:19

by Ramon Fontes

[permalink] [raw]
Subject: Re: mac80211_hwsim: packets being transmitted through the monitor interface

Yes, I agree that they are different things, but I can also see the
packets through the monitor interface created via iw. Is this expected
too?

On Fri, Sep 27, 2019 at 9:16 AM Johannes Berg <[email protected]> wrote:
>
> On Thu, 2019-09-26 at 22:54 -0300, Ramon Fontes wrote:
> > Hello,
> >
> > I've noticed that packets transmitted between two clients connected to
> > a hostapd AP are also transmitted (injected) through the monitor
> > interface. Is this expected behavior?
>
> You mean on 'hwsim0'? That interface is just for monitoring what's
> happening on the 'virtual air', so yes.
>
> > I can easily modify such
> > behavior by changing mac80211_hwsim, but it works only with hwsim0. On
> > the other hand, if I create a monitor interface via iw it doesn't
> > work.
>
> The two are completely different/unrelated things.
>
> johannes
>

2019-09-27 12:35:40

by Johannes Berg

[permalink] [raw]
Subject: Re: mac80211_hwsim: packets being transmitted through the monitor interface

[please quote properly]

On Fri, 2019-09-27 at 09:30 -0300, Ramon Fontes wrote:
> Yes, I agree that they are different things, but I can also see the
> packets through the monitor interface created via iw. Is this expected
> too?

The hwsim0 interface shows *all* packets on the virtual air.

A monitor interface created on one of the (hwsim or other!) wiphys shows
all packets seen by that device.

johannes

2019-09-27 13:05:07

by Ramon Fontes

[permalink] [raw]
Subject: Re: mac80211_hwsim: packets being transmitted through the monitor interface

> A monitor interface created on one of the (hwsim or other!) wiphys shows
> all packets seen by that device.

Weird. When I try to reproduce the same with a physical network
interface, I can see no packets. It only shows the 802.11 protocol.
With mac80211_hwsim, in turn, I can see, for example, TCP packets and
their headers include the 802.11 header.

--
Ramon

2019-09-27 14:01:59

by Johannes Berg

[permalink] [raw]
Subject: Re: mac80211_hwsim: packets being transmitted through the monitor interface

On Fri, 2019-09-27 at 10:01 -0300, Ramon Fontes wrote:
> > A monitor interface created on one of the (hwsim or other!) wiphys shows
> > all packets seen by that device.
>
> Weird. When I try to reproduce the same with a physical network
> interface, I can see no packets. It only shows the 802.11 protocol.
> With mac80211_hwsim, in turn, I can see, for example, TCP packets and
> their headers include the 802.11 header.

At least with mac80211 drivers that should work everywhere, though you
may get encrypted packets if software crypto is used, or crypto headers
if hardware crypto is used etc.

johannes