Bug 800

Summary: Erroneous packet sender while using aloha or cw mac in uan module
Product: ns-3 Reporter: Andrea Sacco <andrea.sacco85>
Component: devicesAssignee: Leonard Tracy <lentracy>
Status: RESOLVED FIXED    
Severity: normal CC: ns-bugs, tomh
Priority: P5    
Version: pre-release   
Hardware: PC   
OS: Linux   
Attachments: fixed uan-mac-aloha.cc
fixed uan-mac-cw.cc

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.