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.
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.
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.
> 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)