examples/simple-p2p.cc
changeset 540 507eababb124
parent 535 fb6735f93868
child 541 4dab7168be35
--- a/examples/simple-p2p.cc	Fri May 11 22:28:12 2007 -0700
+++ b/examples/simple-p2p.cc	Sat May 12 15:31:40 2007 -0700
@@ -122,16 +122,25 @@
   PointToPointTopology::AddIpv4Addresses (
       channel0, n0, Ipv4Address("10.1.1.1"),
       n2, Ipv4Address("10.1.1.2"));
-  channel0->Unref ();
   
   PointToPointTopology::AddIpv4Addresses (
       channel1, n1, Ipv4Address("10.1.2.1"),
       n2, Ipv4Address("10.1.2.2"));
-  channel1->Unref ();
   
   PointToPointTopology::AddIpv4Addresses (
       channel2, n2, Ipv4Address("10.1.3.1"),
       n3, Ipv4Address("10.1.3.2"));
+
+  // Finally, we add static routes.  These three steps (Channel and
+  // NetDevice creation, IP Address assignment, and routing) are 
+  // separated because there may be a need to postpone IP Address
+  // assignment (emulation) or modify to use dynamic routing
+  PointToPointTopology::AddIpv4Routes(n0, n2, channel0);
+  PointToPointTopology::AddIpv4Routes(n1, n2, channel1);
+  PointToPointTopology::AddIpv4Routes(n2, n3, channel2);
+
+  channel0->Unref ();
+  channel1->Unref ();
   channel2->Unref ();
 
   // Create the OnOff application to send UDP datagrams of size