Bugzilla – Bug 880
Node sending a packet to itself via 127.0.0.1 aborts
Last modified: 2010-04-16 18:30:56 UTC
This simple program included in a python unit test (utils/python-unit-tests.py, function testSocket): def testSocket(self): node = ns3.Node() internet = ns3.InternetStackHelper() internet.Install(node) self._received_packet = None def rx_callback(socket): assert self._received_packet is None self._received_packet = socket.Recv() sink = ns3.Socket.CreateSocket(node, ns3.TypeId.LookupByName("ns3::UdpSocketFactory")) sink.Bind(ns3.InetSocketAddress(ns3.Ipv4Address.GetAny(), 80)) sink.SetRecvCallback(rx_callback) source = ns3.Socket.CreateSocket(node, ns3.TypeId.LookupByName("ns3::UdpSocketFactory")) source.SendTo(ns3.Packet(19), 0, ns3.InetSocketAddress(ns3.Ipv4Address("127.0.0.1"), 80)) ## <<<<<<< crash here ns3.Simulator.Run() self.assert_(self._received_packet is not None) self.assertEqual(self._received_packet.GetSize(), 19) This aborts with: .......Received packet with erroneous context ; make sure the channels in use are correctly updating events context when transfering events from one node to another. Segmentation fault (core dumped) To reproduce, just run utils/python-unit-tests.py.
changeset: 7e8a5b802007