diff --git a/CHANGES.html b/CHANGES.html
index 7b52daef4..57c9bc25a 100644
--- a/CHANGES.html
+++ b/CHANGES.html
@@ -111,6 +111,9 @@ us a note on ns-developers mailing list.
Changes to existing API:
+ - 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.
- 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.
diff --git a/RELEASE_NOTES b/RELEASE_NOTES
index c7471fad7..a06ccf56f 100644
--- a/RELEASE_NOTES
+++ b/RELEASE_NOTES
@@ -21,6 +21,10 @@ Supported platforms
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 @@ Bugs fixed
- 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
diff --git a/src/internet/model/ipv6-end-point.cc b/src/internet/model/ipv6-end-point.cc
index 33e8a1a40..c3840909b 100644
--- a/src/internet/model/ipv6-end-point.cc
+++ b/src/internet/model/ipv6-end-point.cc
@@ -96,7 +96,7 @@ void Ipv6EndPoint::SetPeer (Ipv6Address addr, uint16_t port)
m_peerPort = port;
}
-void Ipv6EndPoint::SetRxCallback (Callback, Ipv6Header, uint16_t> callback)
+void Ipv6EndPoint::SetRxCallback (Callback, Ipv6Header, uint16_t, Ptr > callback)
{
m_rxCallback = callback;
}
@@ -111,11 +111,12 @@ void Ipv6EndPoint::SetDestroyCallback (Callback callback)
m_destroyCallback = callback;
}
-void Ipv6EndPoint::ForwardUp (Ptr p, Ipv6Header header, uint16_t port)
+void Ipv6EndPoint::ForwardUp (Ptr p, Ipv6Header header, uint16_t port, Ptr 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::ForwardIcmp (Ipv6Address src, uint8_t ttl, uint8_t type,
}
}
-void Ipv6EndPoint::DoForwardUp (Ptr p, Ipv6Header header, uint16_t sport)
+void Ipv6EndPoint::DoForwardUp (Ptr p, Ipv6Header header, uint16_t sport, Ptr incomingInterface)
{
- m_rxCallback (p, header, sport);
+ m_rxCallback (p, header, sport, incomingInterface);
}
void Ipv6EndPoint::DoForwardIcmp (Ipv6Address src, uint8_t ttl, uint8_t type,
diff --git a/src/internet/model/ipv6-end-point.h b/src/internet/model/ipv6-end-point.h
index 3c97d66d4..2a3bd6870 100644
--- a/src/internet/model/ipv6-end-point.h
+++ b/src/internet/model/ipv6-end-point.h
@@ -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 @@ public:
* \brief Set the reception callback.
* \param callback callback function
*/
- void SetRxCallback (Callback, Ipv6Header, uint16_t> callback);
+ void SetRxCallback (Callback, Ipv6Header, uint16_t, Ptr > callback);
/**
* \brief Set the ICMP callback.
@@ -157,8 +158,9 @@ public:
* \param p the packet
* \param header the packet header
* \param port source port
+ * \param incomingInterface incoming interface
*/
- void ForwardUp (Ptr p, Ipv6Header header, uint16_t port);
+ void ForwardUp (Ptr p, Ipv6Header header, uint16_t port, Ptr incomingInterface);
/**
* \brief Forward the ICMP packet to the upper level.
@@ -181,8 +183,9 @@ private:
* \param p packet
* \param header the packet header
* \param sport source port
+ * \param incomingInterface incoming interface
*/
- void DoForwardUp (Ptr p, Ipv6Header header, uint16_t sport);
+ void DoForwardUp (Ptr p, Ipv6Header header, uint16_t sport, Ptr incomingInterface);
/**
* \brief ForwardIcmp wrapper.
@@ -223,7 +226,7 @@ private:
/**
* \brief The RX callback.
*/
- Callback, Ipv6Header, uint16_t> m_rxCallback;
+ Callback, Ipv6Header, uint16_t, Ptr > m_rxCallback;
/**
* \brief The ICMPv6 callback.
diff --git a/src/internet/model/tcp-l4-protocol.cc b/src/internet/model/tcp-l4-protocol.cc
index a71fb491e..3f8db5eb2 100644
--- a/src/internet/model/tcp-l4-protocol.cc
+++ b/src/internet/model/tcp-l4-protocol.cc
@@ -507,7 +507,7 @@ TcpL4Protocol::Receive (Ptr packet,
}
NS_ASSERT_MSG (endPoints.size () == 1, "Demux returned more than one endpoint");
NS_LOG_LOGIC ("TcpL4Protocol "<ForwardUp (packet, ipHeader, tcpHeader.GetSourcePort ());
+ (*endPoints.begin ())->ForwardUp (packet, ipHeader, tcpHeader.GetSourcePort (), interface);
return IpL4Protocol::RX_OK;
}
diff --git a/src/internet/model/tcp-socket-base.cc b/src/internet/model/tcp-socket-base.cc
index 8588750bc..4c55d4709 100644
--- a/src/internet/model/tcp-socket-base.cc
+++ b/src/internet/model/tcp-socket-base.cc
@@ -811,7 +811,7 @@ TcpSocketBase::ForwardUp (Ptr packet, Ipv4Header header, uint16_t port,
}
void
-TcpSocketBase::ForwardUp6 (Ptr packet, Ipv6Header header, uint16_t port)
+TcpSocketBase::ForwardUp6 (Ptr packet, Ipv6Header header, uint16_t port, Ptr incomingInterface)
{
DoForwardUp (packet, header, port);
}
diff --git a/src/internet/model/tcp-socket-base.h b/src/internet/model/tcp-socket-base.h
index 3e5daf064..086a1a57e 100644
--- a/src/internet/model/tcp-socket-base.h
+++ b/src/internet/model/tcp-socket-base.h
@@ -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 @@ protected:
* \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, Ipv6Header header, uint16_t port);
+ void ForwardUp6 (Ptr packet, Ipv6Header header, uint16_t port, Ptr incomingInterface);
/**
* \brief Called by TcpSocketBase::ForwardUp().
diff --git a/src/internet/model/udp-l4-protocol.cc b/src/internet/model/udp-l4-protocol.cc
index 98b7d9783..39d66f784 100644
--- a/src/internet/model/udp-l4-protocol.cc
+++ b/src/internet/model/udp-l4-protocol.cc
@@ -403,7 +403,7 @@ UdpL4Protocol::Receive (Ptr packet,
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;
}
diff --git a/src/internet/model/udp-socket-impl.cc b/src/internet/model/udp-socket-impl.cc
index 464a96d68..77bb7ef03 100644
--- a/src/internet/model/udp-socket-impl.cc
+++ b/src/internet/model/udp-socket-impl.cc
@@ -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 @@ UdpSocketImpl::ForwardUp (Ptr packet, Ipv4Header header, uint16_t port,
}
void
-UdpSocketImpl::ForwardUp6 (Ptr packet, Ipv6Header header, uint16_t port)
+UdpSocketImpl::ForwardUp6 (Ptr packet, Ipv6Header header, uint16_t port, Ptr incomingInterface)
{
NS_LOG_FUNCTION (this << packet << header.GetSourceAddress () << port);
@@ -974,6 +975,14 @@ UdpSocketImpl::ForwardUp6 (Ptr packet, Ipv6Header header, uint16_t port)
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 ())
diff --git a/src/internet/model/udp-socket-impl.h b/src/internet/model/udp-socket-impl.h
index 879c8c8e1..03c5a5710 100644
--- a/src/internet/model/udp-socket-impl.h
+++ b/src/internet/model/udp-socket-impl.h
@@ -136,8 +136,9 @@ private:
* \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, Ipv6Header header, uint16_t port);
+ void ForwardUp6 (Ptr packet, Ipv6Header header, uint16_t port, Ptr incomingInterface);
/**
* \brief Kill this socket by zeroing its attributes (IPv4)