--- a/src/internet/model/icmpv6-l4-protocol.cc Fri Jun 14 16:31:10 2013 -0700
+++ b/src/internet/model/icmpv6-l4-protocol.cc Sat Jun 15 10:56:55 2013 +0200
@@ -1083,7 +1083,7 @@
SendMessage (p, dst, header, 255);
}
-void Icmpv6L4Protocol::SendRedirection (Ptr<Packet> redirectedPacket, Ipv6Address dst, Ipv6Address redirTarget, Ipv6Address redirDestination, Address redirHardwareTarget)
+void Icmpv6L4Protocol::SendRedirection (Ptr<Packet> redirectedPacket, Ipv6Address src, Ipv6Address dst, Ipv6Address redirTarget, Ipv6Address redirDestination, Address redirHardwareTarget)
{
NS_LOG_FUNCTION (this << redirectedPacket << dst << redirTarget << redirDestination << redirHardwareTarget);
uint32_t llaSize = 0;
@@ -1128,7 +1128,10 @@
Icmpv6Redirection redirectionHeader;
redirectionHeader.SetTarget (redirTarget);
redirectionHeader.SetDestination (redirDestination);
- SendMessage (p, dst, redirectionHeader, 64);
+ redirectionHeader.CalculatePseudoHeaderChecksum (src, dst, p->GetSize () + redirectionHeader.GetSerializedSize (), PROT_NUMBER);
+ p->AddHeader (redirectionHeader);
+
+ SendMessage (p, src, dst, 64);
}
Ptr<Packet> Icmpv6L4Protocol::ForgeNA (Ipv6Address src, Ipv6Address dst, Address* hardwareAddress, uint8_t flags)
--- a/src/internet/model/icmpv6-l4-protocol.h Fri Jun 14 16:31:10 2013 -0700
+++ b/src/internet/model/icmpv6-l4-protocol.h Sat Jun 15 10:56:55 2013 +0200
@@ -274,12 +274,13 @@
/**
* \brief Send an ICMPv6 Redirection.
* \param redirectedPacket the redirected packet
- * \param dst destination IPv6 address
+ * \param src IPv6 address to send the redirect from
+ * \param dst IPv6 address to send the redirect to
* \param redirTarget IPv6 target address for Icmpv6Redirection
* \param redirDestination IPv6 destination address for Icmpv6Redirection
* \param redirHardwareTarget L2 target address for Icmpv6OptionRdirected
*/
- void SendRedirection (Ptr<Packet> redirectedPacket, Ipv6Address dst, Ipv6Address redirTarget, Ipv6Address redirDestination, Address redirHardwareTarget);
+ void SendRedirection (Ptr<Packet> redirectedPacket, Ipv6Address src, Ipv6Address dst, Ipv6Address redirTarget, Ipv6Address redirDestination, Address redirHardwareTarget);
/**
* \brief Forge a Neighbor Solicitation.
--- a/src/internet/model/ipv6-l3-protocol.cc Fri Jun 14 16:31:10 2013 -0700
+++ b/src/internet/model/ipv6-l3-protocol.cc Sat Jun 15 10:56:55 2013 +0200
@@ -938,14 +938,15 @@
}
copy->AddHeader (header);
+ Ipv6Address linkLocal = GetInterface (GetInterfaceForDevice (rtentry->GetOutputDevice ()))->GetLinkLocalAddress ().GetAddress ();
if (icmpv6->Lookup (target, rtentry->GetOutputDevice (), 0, &hardwareTarget))
{
- icmpv6->SendRedirection (copy, src, target, dst, hardwareTarget);
+ icmpv6->SendRedirection (copy, linkLocal, src, target, dst, hardwareTarget);
}
else
{
- icmpv6->SendRedirection (copy, src, target, dst, Address ());
+ icmpv6->SendRedirection (copy, linkLocal, src, target, dst, Address ());
}
}