Bug 1689 - IPv6 shouldn't add a default gateway without checking the Router lifetime

This commit is contained in:
Tommaso Pecorella
2013-05-25 21:36:10 +02:00
parent c0e64dac61
commit d7e61e2f49
3 changed files with 12 additions and 2 deletions

View File

@@ -29,6 +29,7 @@ Bugs fixed
- Bug 1678 - C++11 compliance problem with std::pair"
- Bug 1683 - IPv6 autoconfigured don't use *infinite* lifetimes
- Bug 1669 - ns-3 should support binding two and three (possibly more) arguments
- Bug 1689 - IPv6 shouldn't add a default gateway without checking the Router lifetime
Known issues
------------

View File

@@ -292,9 +292,15 @@ void Icmpv6L4Protocol::HandleRA (Ptr<Packet> packet, Ipv6Address const &src, Ipv
bool next = true;
bool hasLla = false;
bool hasMtu = false;
Ipv6Address defaultRouter = Ipv6Address::GetZero ();
p->RemoveHeader (raHeader);
if (raHeader.GetLifeTime())
{
defaultRouter = src;
}
while (next == true)
{
uint8_t type = 0;
@@ -305,7 +311,7 @@ void Icmpv6L4Protocol::HandleRA (Ptr<Packet> packet, Ipv6Address const &src, Ipv
case Icmpv6Header::ICMPV6_OPT_PREFIX:
p->RemoveHeader (prefixHdr);
ipv6->AddAutoconfiguredAddress (ipv6->GetInterfaceForDevice (interface->GetDevice ()), prefixHdr.GetPrefix (), prefixHdr.GetPrefixLength (),
prefixHdr.GetFlags (), prefixHdr.GetValidTime (), prefixHdr.GetPreferredTime (), src);
prefixHdr.GetFlags (), prefixHdr.GetValidTime (), prefixHdr.GetPreferredTime (), defaultRouter);
break;
case Icmpv6Header::ICMPV6_OPT_MTU:
/* take in account the first MTU option */

View File

@@ -293,7 +293,10 @@ void Ipv6L3Protocol::AddAutoconfiguredAddress (uint32_t interface, Ipv6Address n
/* add default router
* if a previous default route exists, the new ones is simply added
*/
GetRoutingProtocol ()->NotifyAddRoute (Ipv6Address::GetAny (), Ipv6Prefix ((uint8_t)0), defaultRouter, interface, network);
if (!defaultRouter.IsAny())
{
GetRoutingProtocol ()->NotifyAddRoute (Ipv6Address::GetAny (), Ipv6Prefix ((uint8_t)0), defaultRouter, interface, network);
}
Ptr<Ipv6AutoconfiguredPrefix> aPrefix = CreateObject<Ipv6AutoconfiguredPrefix> (m_node, interface, network, mask, preferredTime, validTime, defaultRouter);
aPrefix->StartPreferredTimer ();