[Ns-developers] Receive packet using Raw/Udp socket via loopback device

Hajime Tazaki tazaki at sfc.wide.ad.jp
Tue Mar 30 08:50:05 PDT 2010


Hi all (especially to Guillaume Seguin),

I'd like to ask one thing about the receiving packet using
Raw/Udp socket via loopback device.

In src/node/node.cc, we have the following check in the head,

 bool
 Node::ReceiveFromDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol,
                          const Address &from, const Address &to, NetDevice::PacketType packetType, bool promiscuous)
 {
   NS_ASSERT_MSG (Simulator::GetContext () == GetId (), "Received packet with erroneous context ; " <<
                  "make sure the channels in use are correctly updating events context " <<
                  "when transfering events from one node to another.");

however if we send packet to INADDR_LOOPBACK (127.0.0.1) by
Ipv4RawSocket (for example), it will discard at this point,
because Sender context and received context is same.

In TcpSocket, we never face this problem since TcpSocket switch
the context before sending packet.

I check the changeset of this,

http://code.nsnam.org/ns-3-dev/rev/498dddb76e73

but didn't get the point of this modification.

Will it be problem if I remove this code?
Or should we switch the context before sending to loopback
address (in IpvXL3Protocol)?

I'd like to ask your opinion.

 
regards,
hajime



More information about the Ns-developers mailing list