Bug 1796 - Ipv6PacketInfoTag is not filled by UdpSocketImpl::ForwardUp6.
--- a/CHANGES.html Sun Dec 15 09:00:57 2013 +0100
+++ b/CHANGES.html Sun Dec 15 09:26:02 2013 +0100
@@ -111,6 +111,9 @@
<h2>Changes to existing API:</h2>
<ul>
+ <li> It is now possible to use Ipv6PacketInfoTag from UDP applications in the
+ very same way as Ipv4PacketInfoTag. See Doxygen fo current limitations in
+ using Ipv[4,6]PacketInfoTag to set IP properties.</li>
<li> A change in Ipv[4,6]Interface enforces the correct behaviour of IP
when a device do not support the minimum MTU requirements.
This is set to 68 and 1280 octects respectively.
--- a/RELEASE_NOTES Sun Dec 15 09:00:57 2013 +0100
+++ b/RELEASE_NOTES Sun Dec 15 09:26:02 2013 +0100
@@ -21,6 +21,10 @@
New user-visible features
-------------------------
+- It is now possible to use Ipv6PacketInfoTag from UDP applications in the
+ very same way as Ipv4PacketInfoTag. See Doxygen fo current limitations in
+ using Ipv[4,6]PacketInfoTag to set IP properties.
+
- Ipv[4,6]Interfaces not respecting the minimum MTU requirements (68 octects
for IPv4 and 1280 octects for IPv6) will be automatically set as Down.
Warning: this might break some simulations (which hadn't to work anyway).
@@ -79,6 +83,7 @@
- Bug 1776 - Improve CRC performance for CsmaNetDevice in emulation modes
- Bug 1788 - unused private field warning
- Bug 1789 - missing test condition for sigma in buildings-shadowing-test
+- Bug 1796 - Ipv6PacketInfoTag is not filled by UdpSocketImpl::ForwardUp6
- Bug 1798 - Changing the rate of onOffApplication might stop transmission
- Bug 1802 - FlowMon header deserialization problem with IPv4 fragments
- Bug 1803 - Lookup /NodeList/4/DeviceList/0/LteEnbRrc/UeMap/0 got no matches
--- a/src/internet/model/ipv6-end-point.cc Sun Dec 15 09:00:57 2013 +0100
+++ b/src/internet/model/ipv6-end-point.cc Sun Dec 15 09:26:02 2013 +0100
@@ -96,7 +96,7 @@
m_peerPort = port;
}
-void Ipv6EndPoint::SetRxCallback (Callback<void, Ptr<Packet>, Ipv6Header, uint16_t> callback)
+void Ipv6EndPoint::SetRxCallback (Callback<void, Ptr<Packet>, Ipv6Header, uint16_t, Ptr<Ipv6Interface> > callback)
{
m_rxCallback = callback;
}
@@ -111,11 +111,12 @@
m_destroyCallback = callback;
}
-void Ipv6EndPoint::ForwardUp (Ptr<Packet> p, Ipv6Header header, uint16_t port)
+void Ipv6EndPoint::ForwardUp (Ptr<Packet> p, Ipv6Header header, uint16_t port, Ptr<Ipv6Interface> incomingInterface)
{
if (!m_rxCallback.IsNull ())
{
- m_rxCallback (p, header, port);
+ Simulator::ScheduleNow (&Ipv6EndPoint::DoForwardUp, this, p, header, port,
+ incomingInterface);
}
}
@@ -129,9 +130,9 @@
}
}
-void Ipv6EndPoint::DoForwardUp (Ptr<Packet> p, Ipv6Header header, uint16_t sport)
+void Ipv6EndPoint::DoForwardUp (Ptr<Packet> p, Ipv6Header header, uint16_t sport, Ptr<Ipv6Interface> incomingInterface)
{
- m_rxCallback (p, header, sport);
+ m_rxCallback (p, header, sport, incomingInterface);
}
void Ipv6EndPoint::DoForwardIcmp (Ipv6Address src, uint8_t ttl, uint8_t type,
--- a/src/internet/model/ipv6-end-point.h Sun Dec 15 09:00:57 2013 +0100
+++ b/src/internet/model/ipv6-end-point.h Sun Dec 15 09:26:02 2013 +0100
@@ -27,6 +27,7 @@
#include "ns3/callback.h"
#include "ns3/ipv6-header.h"
#include "ns3/net-device.h"
+#include "ns3/ipv6-interface.h"
namespace ns3
{
@@ -134,7 +135,7 @@
* \brief Set the reception callback.
* \param callback callback function
*/
- void SetRxCallback (Callback<void, Ptr<Packet>, Ipv6Header, uint16_t> callback);
+ void SetRxCallback (Callback<void, Ptr<Packet>, Ipv6Header, uint16_t, Ptr<Ipv6Interface> > callback);
/**
* \brief Set the ICMP callback.
@@ -157,8 +158,9 @@
* \param p the packet
* \param header the packet header
* \param port source port
+ * \param incomingInterface incoming interface
*/
- void ForwardUp (Ptr<Packet> p, Ipv6Header header, uint16_t port);
+ void ForwardUp (Ptr<Packet> p, Ipv6Header header, uint16_t port, Ptr<Ipv6Interface> incomingInterface);
/**
* \brief Forward the ICMP packet to the upper level.
@@ -181,8 +183,9 @@
* \param p packet
* \param header the packet header
* \param sport source port
+ * \param incomingInterface incoming interface
*/
- void DoForwardUp (Ptr<Packet> p, Ipv6Header header, uint16_t sport);
+ void DoForwardUp (Ptr<Packet> p, Ipv6Header header, uint16_t sport, Ptr<Ipv6Interface> incomingInterface);
/**
* \brief ForwardIcmp wrapper.
@@ -223,7 +226,7 @@
/**
* \brief The RX callback.
*/
- Callback<void, Ptr<Packet>, Ipv6Header, uint16_t> m_rxCallback;
+ Callback<void, Ptr<Packet>, Ipv6Header, uint16_t, Ptr<Ipv6Interface> > m_rxCallback;
/**
* \brief The ICMPv6 callback.
--- a/src/internet/model/tcp-l4-protocol.cc Sun Dec 15 09:00:57 2013 +0100
+++ b/src/internet/model/tcp-l4-protocol.cc Sun Dec 15 09:26:02 2013 +0100
@@ -507,7 +507,7 @@
}
NS_ASSERT_MSG (endPoints.size () == 1, "Demux returned more than one endpoint");
NS_LOG_LOGIC ("TcpL4Protocol "<<this<<" forwarding up to endpoint/socket");
- (*endPoints.begin ())->ForwardUp (packet, ipHeader, tcpHeader.GetSourcePort ());
+ (*endPoints.begin ())->ForwardUp (packet, ipHeader, tcpHeader.GetSourcePort (), interface);
return IpL4Protocol::RX_OK;
}
--- a/src/internet/model/tcp-socket-base.cc Sun Dec 15 09:00:57 2013 +0100
+++ b/src/internet/model/tcp-socket-base.cc Sun Dec 15 09:26:02 2013 +0100
@@ -811,7 +811,7 @@
}
void
-TcpSocketBase::ForwardUp6 (Ptr<Packet> packet, Ipv6Header header, uint16_t port)
+TcpSocketBase::ForwardUp6 (Ptr<Packet> packet, Ipv6Header header, uint16_t port, Ptr<Ipv6Interface> incomingInterface)
{
DoForwardUp (packet, header, port);
}
--- a/src/internet/model/tcp-socket-base.h Sun Dec 15 09:00:57 2013 +0100
+++ b/src/internet/model/tcp-socket-base.h Sun Dec 15 09:26:02 2013 +0100
@@ -31,6 +31,7 @@
#include "ns3/ipv4-header.h"
#include "ns3/ipv4-interface.h"
#include "ns3/ipv6-header.h"
+#include "ns3/ipv6-interface.h"
#include "ns3/event-id.h"
#include "tcp-tx-buffer.h"
#include "tcp-rx-buffer.h"
@@ -221,8 +222,9 @@
* \param packet the incoming packet
* \param header the packet's IPv6 header
* \param port the incoming port
+ * \param incomingInterface the incoming interface
*/
- void ForwardUp6 (Ptr<Packet> packet, Ipv6Header header, uint16_t port);
+ void ForwardUp6 (Ptr<Packet> packet, Ipv6Header header, uint16_t port, Ptr<Ipv6Interface> incomingInterface);
/**
* \brief Called by TcpSocketBase::ForwardUp().
--- a/src/internet/model/udp-l4-protocol.cc Sun Dec 15 09:00:57 2013 +0100
+++ b/src/internet/model/udp-l4-protocol.cc Sun Dec 15 09:26:02 2013 +0100
@@ -403,7 +403,7 @@
for (Ipv6EndPointDemux::EndPointsI endPoint = endPoints.begin ();
endPoint != endPoints.end (); endPoint++)
{
- (*endPoint)->ForwardUp (packet->Copy (), header, udpHeader.GetSourcePort ());
+ (*endPoint)->ForwardUp (packet->Copy (), header, udpHeader.GetSourcePort (), interface);
}
return IpL4Protocol::RX_OK;
}
--- a/src/internet/model/udp-socket-impl.cc Sun Dec 15 09:00:57 2013 +0100
+++ b/src/internet/model/udp-socket-impl.cc Sun Dec 15 09:26:02 2013 +0100
@@ -32,6 +32,7 @@
#include "ns3/udp-socket-factory.h"
#include "ns3/trace-source-accessor.h"
#include "ns3/ipv4-packet-info-tag.h"
+#include "ns3/ipv6-packet-info-tag.h"
#include "udp-socket-impl.h"
#include "udp-l4-protocol.h"
#include "ipv4-end-point.h"
@@ -965,7 +966,7 @@
}
void
-UdpSocketImpl::ForwardUp6 (Ptr<Packet> packet, Ipv6Header header, uint16_t port)
+UdpSocketImpl::ForwardUp6 (Ptr<Packet> packet, Ipv6Header header, uint16_t port, Ptr<Ipv6Interface> incomingInterface)
{
NS_LOG_FUNCTION (this << packet << header.GetSourceAddress () << port);
@@ -974,6 +975,14 @@
return;
}
+ // Should check via getsockopt ()..
+ if (IsRecvPktInfo ())
+ {
+ Ipv6PacketInfoTag tag;
+ packet->RemovePacketTag (tag);
+ tag.SetRecvIf (incomingInterface->GetDevice ()->GetIfIndex ());
+ packet->AddPacketTag (tag);
+ }
//Check only version 6 options
if (IsIpv6RecvTclass ())
--- a/src/internet/model/udp-socket-impl.h Sun Dec 15 09:00:57 2013 +0100
+++ b/src/internet/model/udp-socket-impl.h Sun Dec 15 09:26:02 2013 +0100
@@ -136,8 +136,9 @@
* \param packet the incoming packet
* \param header the packet's IPv6 header
* \param port the incoming port
+ * \param incomingInterface the incoming interface
*/
- void ForwardUp6 (Ptr<Packet> packet, Ipv6Header header, uint16_t port);
+ void ForwardUp6 (Ptr<Packet> packet, Ipv6Header header, uint16_t port, Ptr<Ipv6Interface> incomingInterface);
/**
* \brief Kill this socket by zeroing its attributes (IPv4)