Bug 1701 - Ipv6StaticRouting: the source address should match the destination scope

This commit is contained in:
Tommaso Pecorella
2013-06-16 09:34:36 +02:00
parent 8fcd718f03
commit 7f9ede9841
2 changed files with 5 additions and 3 deletions

View File

@@ -32,6 +32,7 @@ Bugs fixed
- 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
- Bug 1700 - Ipv6RawSocket does not honor the bound address when sending packets
- Bug 1701 - Ipv6StaticRouting: the source address should match the destination scope
Known issues
------------

View File

@@ -302,7 +302,7 @@ Ptr<Ipv6Route> Ipv6StaticRouting::LookupStatic (Ipv6Address dst, Ptr<NetDevice>
}
else if (route->GetDest ().IsAny ()) /* default route */
{
rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetPrefixToUse ().IsAny () ? route->GetGateway () : route->GetPrefixToUse ()));
rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetPrefixToUse ().IsAny () ? dst : route->GetPrefixToUse ()));
}
else
{
@@ -761,13 +761,14 @@ Ipv6Address Ipv6StaticRouting::SourceAddressSelection (uint32_t interface, Ipv6A
return ret;
}
/* useally IPv6 interfaces have one link-local address and one global address */
/* usually IPv6 interfaces have one link-local address and one global address */
for (uint32_t i = 1; i < m_ipv6->GetNAddresses (interface); i++)
{
Ipv6InterfaceAddress test = m_ipv6->GetAddress (interface, i);
Ipv6InterfaceAddress dst(dest);
if (test.GetAddress ().CombinePrefix (test.GetPrefix ()) == dest.CombinePrefix (test.GetPrefix ()))
if (test.GetScope() == dst.GetScope())
{
return test.GetAddress ();
}