Bug 1701 - Ipv6StaticRouting: the source address should match the destination scope
authorTommaso Pecorella <tommaso.pecorella@unifi.it>
Sun, 16 Jun 2013 09:34:36 +0200
changeset 9836 d675eb43a62f
parent 9835 3efac978b3c9
child 9837 9981985e3b3b
Bug 1701 - Ipv6StaticRouting: the source address should match the destination scope
RELEASE_NOTES
src/internet/model/ipv6-static-routing.cc
--- a/RELEASE_NOTES	Sun Jun 16 08:58:39 2013 +0200
+++ b/RELEASE_NOTES	Sun Jun 16 09:34:36 2013 +0200
@@ -32,6 +32,7 @@
 - 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
 ------------
--- a/src/internet/model/ipv6-static-routing.cc	Sun Jun 16 08:58:39 2013 +0200
+++ b/src/internet/model/ipv6-static-routing.cc	Sun Jun 16 09:34:36 2013 +0200
@@ -302,7 +302,7 @@
                 }
               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 @@
       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 ();
         }