Bug 880

Summary: Node sending a packet to itself via 127.0.0.1 aborts
Product: ns-3 Reporter: Gustavo J. A. M. Carneiro <gjcarneiro>
Component: internetAssignee: ns-bugs <ns-bugs>
Status: RESOLVED FIXED    
Severity: major CC: tomh
Priority: P3    
Version: ns-3-dev   
Hardware: All   
OS: All   

Description Gustavo J. A. M. Carneiro 2010-04-16 10:24:04 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.
Comment 1 Tom Henderson 2010-04-16 18:30:56 UTC
changeset: 7e8a5b802007