Bug 800 - Erroneous packet sender while using aloha or cw mac in uan module
Erroneous packet sender while using aloha or cw mac in uan module
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: devices
pre-release
PC Linux
: P5 normal
Assigned To: Leonard Tracy
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-01-30 16:18 UTC by Andrea Sacco
Modified: 2010-07-16 00:13 UTC (History)
2 users (show)

See Also:


Attachments
fixed uan-mac-aloha.cc (3.31 KB, application/octet-stream)
2010-01-30 16:20 UTC, Andrea Sacco
Details
fixed uan-mac-cw.cc (9.11 KB, application/octet-stream)
2010-01-30 16:21 UTC, Andrea Sacco
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrea Sacco 2010-01-30 16:18:41 UTC
Overview:
Retrieving the sender address of a packet while using UanMacAloha or UanMacCw will results in the receiver address

Steps to Reproduce:
Set up two uan nodes with either UanMacAloha or UanMacCw.
Set a receive callback to the netdevice of the receiving node.
From a node send a packet to the other.
In the receiving node try to print out the Address of the sender:

ReceivePacketCallback (Ptr<NetDevice> dev, Ptr<const Packet> pkt, uint16_t mode, const Address &sender){
  NS_LOG_DEBUG("Receiving packet from " << sender);
}

or if you are using sockets (like PacketSocket)

ReceivePacketCallback (Ptr<Socket> socket)
{
  Ptr<Packet> packet;
  Address from;
  while (packet = socket->RecvFrom(from)) {
    PacketSocketAddress address = PacketSocketAddress::ConvertFrom(from);
    NS_LOG_DEBUG ("Received packet from: " << address.GetPhysicalAddress());
  }
}

Actual Results:
The address of the sender retrieved is the address of the receiver

Expected Results:
The address of the sender retrieved should be the address of the sender

Build Date & Platform:
Build 2010-01-30 on Ubuntu 9.10 kernel 2.6.31-17-generic

Solving:
In uan-mac-aloha.cc:121 change

m_forUpCb (pkt, header.GetDest ());

with the following:

m_forUpCb (pkt, header.GetSrc ());

In uan-mac-cw.cc:3125 change

m_forwardUpCb (packet, m_address);

with the following:

m_forwardUpCb (packet, header.GetSrc());

I've also attached a corrected version of the two files
Comment 1 Andrea Sacco 2010-01-30 16:20:10 UTC
Created attachment 742 [details]
fixed uan-mac-aloha.cc
Comment 2 Andrea Sacco 2010-01-30 16:21:30 UTC
Created attachment 743 [details]
fixed uan-mac-cw.cc
Comment 3 Tom Henderson 2010-07-16 00:13:11 UTC
Leonard remarks that this was fixed along the way.