Add comments about the choice of default route in a two (or more) IPv6 prefixes link.
authorSebastien Vincent <vincent@clarinet.u-strasbg.fr>
Tue, 08 Sep 2009 07:07:58 +0200
changeset 4766 0a74df84902f
parent 4765 150f48a226c3
child 4767 7433d307ed51
child 5179 5791fa40e7b1
child 5209 4f5eb479554c
Add comments about the choice of default route in a two (or more) IPv6 prefixes link.
examples/radvd-two-prefix.cc
src/routing/static-routing/ipv6-static-routing.cc
--- a/examples/radvd-two-prefix.cc	Tue Sep 08 06:37:37 2009 +0200
+++ b/examples/radvd-two-prefix.cc	Tue Sep 08 07:07:58 2009 +0200
@@ -159,8 +159,8 @@
   iic2.Add (iicr2);
 
   /* radvd configuration */
-  Ipv6Address prefix ("2001:1::0"); /* create the prefix */
-  Ipv6Address prefixBis ("2001:ABCD::0"); /* create the prefix */
+  Ipv6Address prefix ("2001:ABCD::0"); /* create the prefix */
+  Ipv6Address prefixBis ("2001:1::0"); /* create the prefix */
   Ipv6Address prefix2 ("2001:2::0"); /* create the prefix */
   uint32_t indexRouter = iic1.GetInterfaceIndex (1); /* R interface (n0 - R) */
   uint32_t indexRouter2 = iic2.GetInterfaceIndex (1); /* R interface (R - n1) */
--- a/src/routing/static-routing/ipv6-static-routing.cc	Tue Sep 08 06:37:37 2009 +0200
+++ b/src/routing/static-routing/ipv6-static-routing.cc	Tue Sep 08 07:07:58 2009 +0200
@@ -274,7 +274,6 @@
         uint32_t interfaceIdx = route->GetInterface ();
         rtentry = Create<Ipv6Route> ();
 
-
         if (route->GetGateway ().IsAny ())
         {
           rtentry->SetSource (SourceAddressSelection (interfaceIdx, route->GetDest ()));
@@ -295,7 +294,10 @@
     }
   }
 
-  NS_LOG_LOGIC ("Matching route via " << rtentry->GetDestination () << " (throught " << rtentry->GetGateway () << ") at the end");
+  if(rtentry)
+  {
+    NS_LOG_LOGIC ("Matching route via " << rtentry->GetDestination () << " (throught " << rtentry->GetGateway () << ") at the end");
+  }
   return rtentry;
 }
 
@@ -653,6 +655,11 @@
     /* this case is mainly used by configuring default route following RA processing,
      * in case of multipe prefix in RA, the first will configured default route
      */
+
+    /* for the moment, all default route has the same metric
+     * so according to the longest prefix algorithm,
+     * the default route choosen will be the last added
+     */
     SetDefaultRoute (nextHop, interface, prefixToUse);
   }
 }