# HG changeset patch # User Tommaso Pecorella # Date 1369510570 -7200 # Node ID cfb7c304cf2d4d22482a08d2986a65fd873f16ec # Parent e86da132e7e965dd43a174d777fff39c34590fb3 Bug 1689 - IPv6 shouldn't add a default gateway without checking the Router lifetime diff -r e86da132e7e9 -r cfb7c304cf2d RELEASE_NOTES --- a/RELEASE_NOTES Sat May 25 18:18:00 2013 +0200 +++ b/RELEASE_NOTES Sat May 25 21:36:10 2013 +0200 @@ -29,6 +29,7 @@ - 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 ------------ diff -r e86da132e7e9 -r cfb7c304cf2d src/internet/model/icmpv6-l4-protocol.cc --- a/src/internet/model/icmpv6-l4-protocol.cc Sat May 25 18:18:00 2013 +0200 +++ b/src/internet/model/icmpv6-l4-protocol.cc Sat May 25 21:36:10 2013 +0200 @@ -292,9 +292,15 @@ 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 @@ 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 */ diff -r e86da132e7e9 -r cfb7c304cf2d src/internet/model/ipv6-l3-protocol.cc --- a/src/internet/model/ipv6-l3-protocol.cc Sat May 25 18:18:00 2013 +0200 +++ b/src/internet/model/ipv6-l3-protocol.cc Sat May 25 21:36:10 2013 +0200 @@ -293,7 +293,10 @@ /* 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 aPrefix = CreateObject (m_node, interface, network, mask, preferredTime, validTime, defaultRouter); aPrefix->StartPreferredTimer ();