[Ns-developers] questions about node address and socket implementation
Giuseppe Piro
peppe.piro at gmail.com
Mon Jun 28 00:36:08 PDT 2010
Dear all,
I have a lot of questions regarding both address node management and socket
implementation. All of these doubts are were born during the implementation
of LTE Net Device.
Hope that I will be able to describe in details my questions and that there
is somebody that can help me!
First of all, my questions are about the code developed into the ns-3-lte
branche (http://code.nsnam.org/giuseppepiro/ns-3-lte/) .
1 - Node Address.
It is not clear for me how it is possible to manage MAC address node in
ns-3. To all devices it is possible to assign IP address using
Ipv4AddressHelper::Assign () function, calling it directly into the main
program. The question is: where, who, and how the MAC address is defined for
a particular device ?
I will advance that this doubt was born as a consequence of the incorrect
behaviour of socket, as described in the following.
2 - Socket for Udp Client Server Application.
In NetDevice class, the function NetDevice::Send() has been defined in order
to deliver packet coming from the application layer to the device. The
correct implementation of this function for a particular device can be carry
out by the NewNetDevice::DoSend () (as have been done for LteNetDevice !).
When the NetDevice::Send() method will be called, the address of the
destination is already known. Why ? How the socket is able to obtain this
address starting from the IP address of the destination device ?
Starting from these considerations, I would describe some errors that I have
found when I run lte-device example (this scenario has been defined into
example/lte-device.cc for the ns-3-lte branche, for read output lines you
can run "./waf --run lte-device").
The scenario consists of two node (where a simple client server application
has been installed between them):
eNB (client, 10.0.0.2) ----> sends packets to UE (server, 10.0.0.1).
When the client generates a packet, it will be delivered by the socket to
the device using the NetDevice::Send () method, overloaded into
LteNetDevice::Send () . Now, the destination address passed to the Send
Function, and in the following steps to the SendFrom and DoSend functions,
is incorrect (running lte-device example it is possible to obtain the
following lines):
LteNetDevice:Send(0x9aa17f8, 04-06-ff:ff:ff:ff:ff:ff, 2048)
LteNetDevice:SendFrom(0x9aa17f8, 04-06-00:00:00:00:00:02,
04-06-ff:ff:ff:ff:ff:ff, 2048)
EnbNetDevice:DoSend(0x9a9d258, 00:00:00:00:00:02, ff:ff:ff:ff:ff:ff, 2048)
Why the destination address is equal to ff:ff:ff:ff:ff:ff:, instead
00:00:00:00:00:01 ?
Where is the problem ? Have I done some configuration errors ?
Obviously, since the destination address is incorrect, the destination
device cannot forward the received packet to the upper layers
LteSpectrumPhy:EndRx(1)
0x9a9aa40 calling m_phyMacRxEndOkCallback
LteNetDevice:Receive(0x9a9b980)
UeNetDevice:DoReceive(0x9a9b980)
LteNetDevice:GetAddress(0x9a9b980)
packet 00:00:00:00:00:02 --> ff:ff:ff:ff:ff:ff (here: 00:00:00:00:00:01)
Finally, supposing the the destination address is right, the packet should
be forwarded to the upper layer. I have enforced this behaviour, also in the
case in which the destination address is incorrect.
void
UeNetDevice::DoReceive (Ptr<Packet> p)
{
NS_LOG_FUNCTION (this);
Ptr<Packet> packet = p->Copy ();
LteMacHeader header;
packet->RemoveHeader (header);
NS_LOG_LOGIC ("packet " << header.GetSource () << " --> " <<
header.GetDestination () <<
" (here: " << Mac48Address::ConvertFrom(GetAddress ()) << ")");
if (header.GetDestination () == GetAddress ())
{
ForwardUp (p->Copy ());
}
else
{
ForwardUp (p->Copy ());
//not for me
}
}
however, forwarding the packet to the upper layer, appears another error:
LteNetDevice:ForwardUp(0x9a9b980)
packet 00:00:00:00:00:02 --> ff:ff:ff:ff:ff:ff (here: 00:00:00:00:00:01)
Received packet with erroneous context ; make sure the channels in use are
correctly updating events context when transfering events from one node to
another.
Is this error related to the incorrect address ? How I can revolve it ?
Sorry for my very long mail. I'm waiting for your suggestions.
Best Regards
Giuseppe Piro
More information about the Ns-developers
mailing list