bug 1646 - ICMPv6 Redirect are sent from global address instead of link-local
This commit is contained in:
@@ -1083,7 +1083,7 @@ void Icmpv6L4Protocol::SendErrorParameterError (Ptr<Packet> malformedPacket, Ipv
|
||||
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 @@ void Icmpv6L4Protocol::SendRedirection (Ptr<Packet> redirectedPacket, Ipv6Addres
|
||||
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)
|
||||
|
||||
@@ -274,12 +274,13 @@ public:
|
||||
/**
|
||||
* \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.
|
||||
|
||||
@@ -938,14 +938,15 @@ void Ipv6L3Protocol::IpForward (Ptr<Ipv6Route> rtentry, Ptr<const Packet> p, con
|
||||
}
|
||||
|
||||
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 ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user