Bug 1607 - OnOff Application over TCP with IPv6
OnOff Application over TCP with IPv6
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: applications
ns-3.16
All All
: P5 normal
Assigned To: George Riley
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-03-23 06:45 UTC by Sebastian Robitzsch
Modified: 2013-03-23 13:58 UTC (History)
1 user (show)

See Also:


Attachments
Enabling OnOff application to work with IPv6 ... sry ... not a proper patch (9.99 KB, text/plain)
2013-03-23 06:53 UTC, Sebastian Robitzsch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Robitzsch 2013-03-23 06:45:15 UTC
Dear all,

When using the OnOff application in combination with ns3::TcpSocketFactory and IPv6, the TCP session cannot be established at all. Right after the socket was created it got closed again without listening to any packet. The reason for this is when working with IPv6, the wrong binding function (m_socket->Bind() instead of m_socket->Bind6()) is called when binding the application to a previously created socket.

/*
 * File: src/applications/model/onoff-application.cc
*/
void OnOffApplication::StartApplication () // Called at time specified by Start
{
  NS_LOG_FUNCTION (this);

  // Create the socket if not already
  if (!m_socket)
    {
      m_socket = Socket::CreateSocket (GetNode (), m_tid);

+      if (Inet6SocketAddress::IsMatchingType (m_peer))
+    	  m_socket->Bind6 ();
+      else if (InetSocketAddress::IsMatchingType (m_peer))
+    	  m_socket->Bind ();

-     m_socket->Bind ();

      m_socket->Connect (m_peer);
      m_socket->SetAllowBroadcast (true);
      m_socket->ShutdownRecv ();

      m_socket->SetConnectCallback (
        MakeCallback (&OnOffApplication::ConnectionSucceeded, this),
        MakeCallback (&OnOffApplication::ConnectionFailed, this));
    }
  // Insure no pending event
  CancelEvents ();
  // If we are not yet connected, there is nothing to do here
  // The ConnectionComplete upcall will start timers at that time
  //if (!m_connected) return;
  ScheduleStartEvent ();
}


Rgds,
Sebastian
Comment 1 Sebastian Robitzsch 2013-03-23 06:53:02 UTC
Created attachment 1537 [details]
Enabling OnOff application to work with IPv6 ... sry ... not a proper patch
Comment 2 Tommaso Pecorella 2013-03-23 13:49:30 UTC
Actually the bug is in *all* the applications... ouch.
Comment 3 Tommaso Pecorella 2013-03-23 13:58:50 UTC
Fixed in changeset: 9268 - 21270128f7b6