WifiNetDevice::Rx trace: why overheard frames?

31 views
Skip to first unread message

francesco

unread,
Feb 17, 2009, 1:54:16 PM2/17/09
to ns-3-users
Hi,

I have noticed that the Rx trace source of WifiNetDevice is called
whenever _any_ frame is received, including overheard ones -- i.e.
directed to some other host.
Is this "by design"? If so, I feel:
* it should be stated clearly in the documentation -- to me, "Received
payload from the MAC layer." suggests that the MAC layer has also
checked that the frame is really for the host;
* users of the trace should be given a fast way to detect whether the
frame is being overheard or not - e.g. passing the destination address
along with the source one.

Francesco

Mathieu Lacage

unread,
Feb 18, 2009, 6:33:49 AM2/18/09
to ns-3-...@googlegroups.com
On Tue, 2009-02-17 at 10:54 -0800, francesco wrote:

> I have noticed that the Rx trace source of WifiNetDevice is called
> whenever _any_ frame is received, including overheard ones -- i.e.
> directed to some other host.

Can you be a bit more specific here ?


francesco

unread,
Feb 19, 2009, 2:05:01 AM2/19/09
to ns-3-users
> Can you be a bit more specific here ?

src/devices/wifi/wifi-net-device.cc, lines 283-314

void
WifiNetDevice::ForwardUp (Ptr<Packet> packet, Mac48Address from,
Mac48Address to)
{
m_rxLogger (packet, from);
LlcSnapHeader llc;
packet->RemoveHeader (llc);
enum NetDevice::PacketType type;
if (to.IsBroadcast ())
{
type = NetDevice::PACKET_BROADCAST;
}
else if (to.IsGroup ())
{
type = NetDevice::PACKET_MULTICAST;
}
else if (to == m_mac->GetAddress ())
{
type = NetDevice::PACKET_HOST;
}
else
{
type = NetDevice::PACKET_OTHERHOST;
}
if (type != NetDevice::PACKET_OTHERHOST)
{
m_forwardUp (this, packet, llc.GetType (), from);
}
if (!m_promiscRx.IsNull ())
{
m_promiscRx (this, packet, llc.GetType (), from, to, type);
}
}

As far as I could understand, this code checks whether the received L2
payload should be passed to upper layers (i.e. it is either broadcast,
multicast or unicast directed to the current host) or not (case
PACKET_OTHERHOST). In the latter case, it is only passed to upper
layers if the promiscuous mode is activated.
Nevertheless, m_rxLogger is called before the switch statement, i.e.
in _all_ the above cases, including the one in which the frame is
directed to another host.

I think naming this event "Rx" can be misleading. I feel it would be
more correct to move the m_rxLogger call inside the "if (type !=
NetDevice::PACKET_OTHERHOST)" branch, and possibly add a distinct
trace source, say "FrameSeen", where Rx currently is. Anyway, I would
suggest to state more explicitly the exact semantics of Rx in the
documentation.

Francesco

Mathieu Lacage

unread,
Feb 19, 2009, 2:17:32 AM2/19/09
to ns-3-...@googlegroups.com
On Wed, 2009-02-18 at 23:05 -0800, francesco wrote:
> > Can you be a bit more specific here ?
>
> src/devices/wifi/wifi-net-device.cc, lines 283-314
>
> void
> WifiNetDevice::ForwardUp (Ptr<Packet> packet, Mac48Address from,
> Mac48Address to)

[snip]

> As far as I could understand, this code checks whether the received L2
> payload should be passed to upper layers (i.e. it is either broadcast,
> multicast or unicast directed to the current host) or not (case
> PACKET_OTHERHOST). In the latter case, it is only passed to upper
> layers if the promiscuous mode is activated.
> Nevertheless, m_rxLogger is called before the switch statement, i.e.
> in _all_ the above cases, including the one in which the frame is
> directed to another host.

Ok, I understand your concern better now. Would you mind file a bug to
keep track of this issue ? (if you have not done so yet)

regards,
Mathieu


francesco

unread,
Feb 19, 2009, 7:19:02 AM2/19/09
to ns-3-users
> Ok, I understand your concern better now. Would you mind file a bug to
> keep track of this issue ? (if you have not done so yet)

Sure (I was unsure whether this could be considered a bug):
http://www.nsnam.org/bugzilla/show_bug.cgi?id=505
Reply all
Reply to author
Forward
0 new messages