Bug 880 - Node sending a packet to itself via 127.0.0.1 aborts
Node sending a packet to itself via 127.0.0.1 aborts
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: internet
ns-3-dev
All All
: P3 major
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-04-16 10:24 EDT by Gustavo J. A. M. Carneiro
Modified: 2010-04-16 18:30 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gustavo J. A. M. Carneiro 2010-04-16 10:24:04 EDT
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 EDT
changeset: 7e8a5b802007