diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 2db54fe37..c4394e418 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -81,6 +81,7 @@ Bugs fixed - Bug 2243 - TCP Socket Fork() fails to copy some parameters, causing connections to close prematurely on retransmit - Bug 2246 - Some DSR LogComponents and classes are not defined in a unique way. - Bug 2247 - Disabled Fast retransmit after an RTO +- Bug 2252 - Nix needs StaticRouting to work - Bug 2254 - Ipv[4,6]RawSocket can return the wrong number of bytes sent. - Bug 2255 - Ipv6RawSocket does not call data sent callbacks. - Bug 2257 - Ipv[4,6]InterfaceContainer::Add are not consistent diff --git a/src/brite/examples/brite-MPI-example.cc b/src/brite/examples/brite-MPI-example.cc index 9b13e7926..cdc33adc3 100644 --- a/src/brite/examples/brite-MPI-example.cc +++ b/src/brite/examples/brite-MPI-example.cc @@ -79,25 +79,14 @@ main (int argc, char *argv[]) PointToPointHelper p2p; - Ipv4StaticRoutingHelper staticRouting; - Ipv4GlobalRoutingHelper globalRouting; - Ipv4ListRoutingHelper listRouting; - Ipv4NixVectorHelper nixRouting; InternetStackHelper stack; if (nix) { - listRouting.Add (staticRouting, 0); - listRouting.Add (nixRouting, 10); + Ipv4NixVectorHelper nixRouting; + stack.SetRoutingHelper (nixRouting); } - else - { - listRouting.Add (staticRouting, 0); - listRouting.Add (globalRouting, 10); - } - - stack.SetRoutingHelper (listRouting); Ipv4AddressHelper address; address.SetBase ("10.0.0.0", "255.255.255.252"); diff --git a/src/brite/examples/brite-generic-example.cc b/src/brite/examples/brite-generic-example.cc index d6d60b1b2..f3bb37861 100644 --- a/src/brite/examples/brite-generic-example.cc +++ b/src/brite/examples/brite-generic-example.cc @@ -63,25 +63,14 @@ main (int argc, char *argv[]) PointToPointHelper p2p; - Ipv4StaticRoutingHelper staticRouting; - Ipv4GlobalRoutingHelper globalRouting; - Ipv4ListRoutingHelper listRouting; - Ipv4NixVectorHelper nixRouting; InternetStackHelper stack; if (nix) { - listRouting.Add (staticRouting, 0); - listRouting.Add (nixRouting, 10); + Ipv4NixVectorHelper nixRouting; + stack.SetRoutingHelper (nixRouting); } - else - { - listRouting.Add (staticRouting, 0); - listRouting.Add (globalRouting, 10); - } - - stack.SetRoutingHelper (listRouting); Ipv4AddressHelper address; address.SetBase ("10.0.0.0", "255.255.255.252"); diff --git a/src/mpi/examples/nms-p2p-nix-distributed.cc b/src/mpi/examples/nms-p2p-nix-distributed.cc index eff89831d..d5f5f9e6d 100644 --- a/src/mpi/examples/nms-p2p-nix-distributed.cc +++ b/src/mpi/examples/nms-p2p-nix-distributed.cc @@ -46,8 +46,6 @@ #include "ns3/packet-sink-helper.h" #include "ns3/point-to-point-helper.h" #include "ns3/mpi-interface.h" -#include "ns3/ipv4-static-routing-helper.h" -#include "ns3/ipv4-list-routing-helper.h" #include "ns3/ipv4-nix-vector-helper.h" using namespace ns3; @@ -148,15 +146,9 @@ main (int argc, char *argv[]) p2p_100mb1ms.SetDeviceAttribute ("DataRate", StringValue ("100Mbps")); p2p_100mb1ms.SetChannelAttribute ("Delay", StringValue ("1ms")); - Ipv4NixVectorHelper nixRouting; - Ipv4StaticRoutingHelper staticRouting; - - Ipv4ListRoutingHelper list; - list.Add (staticRouting, 0); - list.Add (nixRouting, 10); - if (nix) { + Ipv4NixVectorHelper nixRouting; stack.SetRoutingHelper (list); // has effect on the next Install () } diff --git a/src/mpi/examples/simple-distributed-empty-node.cc b/src/mpi/examples/simple-distributed-empty-node.cc index 6e11b6275..778364cd5 100644 --- a/src/mpi/examples/simple-distributed-empty-node.cc +++ b/src/mpi/examples/simple-distributed-empty-node.cc @@ -60,8 +60,6 @@ #include "ns3/network-module.h" #include "ns3/mpi-interface.h" #include "ns3/ipv4-global-routing-helper.h" -#include "ns3/ipv4-static-routing-helper.h" -#include "ns3/ipv4-list-routing-helper.h" #include "ns3/point-to-point-helper.h" #include "ns3/internet-stack-helper.h" #include "ns3/ipv4-nix-vector-helper.h" @@ -185,15 +183,9 @@ main (int argc, char *argv[]) } InternetStackHelper stack; - Ipv4NixVectorHelper nixRouting; - Ipv4StaticRoutingHelper staticRouting; - - Ipv4ListRoutingHelper list; - list.Add (staticRouting, 0); - list.Add (nixRouting, 10); - if (nix) { + Ipv4NixVectorHelper nixRouting; stack.SetRoutingHelper (list); // has effect on the next Install () } diff --git a/src/mpi/examples/simple-distributed.cc b/src/mpi/examples/simple-distributed.cc index 071a9a8b9..761a6b054 100644 --- a/src/mpi/examples/simple-distributed.cc +++ b/src/mpi/examples/simple-distributed.cc @@ -45,8 +45,6 @@ #include "ns3/network-module.h" #include "ns3/mpi-interface.h" #include "ns3/ipv4-global-routing-helper.h" -#include "ns3/ipv4-static-routing-helper.h" -#include "ns3/ipv4-list-routing-helper.h" #include "ns3/point-to-point-helper.h" #include "ns3/internet-stack-helper.h" #include "ns3/ipv4-nix-vector-helper.h" @@ -161,15 +159,9 @@ main (int argc, char *argv[]) } InternetStackHelper stack; - Ipv4NixVectorHelper nixRouting; - Ipv4StaticRoutingHelper staticRouting; - - Ipv4ListRoutingHelper list; - list.Add (staticRouting, 0); - list.Add (nixRouting, 10); - if (nix) { + Ipv4NixVectorHelper nixRouting; stack.SetRoutingHelper (list); // has effect on the next Install () } diff --git a/src/nix-vector-routing/doc/nix-vector-routing.h b/src/nix-vector-routing/doc/nix-vector-routing.h index 980f23096..f3fca4e15 100644 --- a/src/nix-vector-routing/doc/nix-vector-routing.h +++ b/src/nix-vector-routing/doc/nix-vector-routing.h @@ -34,28 +34,6 @@ * efficient adaptation to link failures. It simply flushes all nix-vector * routing caches. Finally, IPv6 is not supported. * - * \section api API and Usage - * - * The Nix-vector routing protocol at the moment does not handle local - * delivery. As a consequence, it must be used along with another routing - * protocol, with the obvious candidate being Ipv4StaticRouting. - * Moreover, Ipv4StaticRouting must have a higher precedence than - * Nix-vector routing. - * - * Example: - * \code - Ipv4NixVectorHelper nixRouting; - Ipv4StaticRoutingHelper staticRouting; - - Ipv4ListRoutingHelper list; - list.Add (staticRouting, 0); - list.Add (nixRouting, 10); - - InternetStackHelper stack; - stack.SetRoutingHelper (list); - stack.Install (allNodes); - * \endcode - * * \section impl Implementation * * ns-3 nix-vector-routing performs on-demand route computation using diff --git a/src/nix-vector-routing/examples/nix-simple.cc b/src/nix-vector-routing/examples/nix-simple.cc index e56f0013e..b3398ecb5 100644 --- a/src/nix-vector-routing/examples/nix-simple.cc +++ b/src/nix-vector-routing/examples/nix-simple.cc @@ -68,14 +68,8 @@ main (int argc, char *argv[]) // NixHelper to install nix-vector routing // on all nodes Ipv4NixVectorHelper nixRouting; - Ipv4StaticRoutingHelper staticRouting; - - Ipv4ListRoutingHelper list; - list.Add (staticRouting, 0); - list.Add (nixRouting, 10); - InternetStackHelper stack; - stack.SetRoutingHelper (list); // has effect on the next Install () + stack.SetRoutingHelper (nixRouting); // has effect on the next Install () stack.Install (allNodes); NetDeviceContainer devices12; diff --git a/src/nix-vector-routing/examples/nms-p2p-nix.cc b/src/nix-vector-routing/examples/nms-p2p-nix.cc index 1ebc56603..ead1a3b19 100644 --- a/src/nix-vector-routing/examples/nms-p2p-nix.cc +++ b/src/nix-vector-routing/examples/nms-p2p-nix.cc @@ -44,8 +44,6 @@ #include "ns3/onoff-application.h" #include "ns3/packet-sink.h" #include "ns3/simulator.h" -#include "ns3/ipv4-static-routing-helper.h" -#include "ns3/ipv4-list-routing-helper.h" #include "ns3/ipv4-nix-vector-helper.h" using namespace ns3; @@ -126,7 +124,7 @@ main (int argc, char *argv[]) TIMER_TYPE t0, t1, t2; TIMER_NOW (t0); std::cout << " ==== DARPA NMS CAMPUS NETWORK SIMULATION ====" << std::endl; - LogComponentEnable ("OnOffApplication", LOG_LEVEL_INFO); + // LogComponentEnable ("OnOffApplication", LOG_LEVEL_INFO); int nCN = 2, nLANClients = 42; bool nix = true; @@ -174,16 +172,10 @@ main (int argc, char *argv[]) p2p_100mb1ms.SetChannelAttribute ("Delay", StringValue ("1ms")); // Setup NixVector Routing - Ipv4NixVectorHelper nixRouting; - Ipv4StaticRoutingHelper staticRouting; - - Ipv4ListRoutingHelper list; - list.Add (staticRouting, 0); - list.Add (nixRouting, 10); - if (nix) { - stack.SetRoutingHelper (list); // has effect on the next Install () + Ipv4NixVectorHelper nixRouting; + stack.SetRoutingHelper (nixRouting); // has effect on the next Install () } // Create Campus Networks diff --git a/src/nix-vector-routing/model/ipv4-nix-vector-routing.cc b/src/nix-vector-routing/model/ipv4-nix-vector-routing.cc index 062cfe87e..9d9fd1ce8 100644 --- a/src/nix-vector-routing/model/ipv4-nix-vector-routing.cc +++ b/src/nix-vector-routing/model/ipv4-nix-vector-routing.cc @@ -619,6 +619,31 @@ Ipv4NixVectorRouting::RouteInput (Ptr p, const Ipv4Header &header, CheckCacheStateAndFlush (); + NS_ASSERT (m_ipv4 != 0); + // Check if input device supports IP + NS_ASSERT (m_ipv4->GetInterfaceForDevice (idev) >= 0); + uint32_t iif = m_ipv4->GetInterfaceForDevice (idev); + + // Local delivery + if (m_ipv4->IsDestinationAddress (header.GetDestination (), iif)) + { + if (!lcb.IsNull ()) + { + NS_LOG_LOGIC ("Local delivery to " << header.GetDestination ()); + lcb (p, header, iif); + return true; + } + else + { + // The local delivery callback is null. This may be a multicast + // or broadcast packet, so return false so that another + // multicast routing protocol can handle it. It should be possible + // to extend this to explicitly check whether it is a unicast + // packet, and invoke the error callback if so + return false; + } + } + Ptr rtentry; // Get the nix-vector from the packet diff --git a/src/topology-read/examples/topology-example-sim.cc b/src/topology-read/examples/topology-example-sim.cc index 8938168e6..03f57bbe3 100644 --- a/src/topology-read/examples/topology-example-sim.cc +++ b/src/topology-read/examples/topology-example-sim.cc @@ -31,8 +31,6 @@ #include "ns3/internet-module.h" #include "ns3/point-to-point-module.h" #include "ns3/applications-module.h" -#include "ns3/ipv4-static-routing-helper.h" -#include "ns3/ipv4-list-routing-helper.h" #include "ns3/ipv4-nix-vector-helper.h" #include "ns3/topology-read-module.h" @@ -101,13 +99,7 @@ int main (int argc, char *argv[]) // Setup NixVector Routing Ipv4NixVectorHelper nixRouting; - Ipv4StaticRoutingHelper staticRouting; - - Ipv4ListRoutingHelper listRH; - listRH.Add (staticRouting, 0); - listRH.Add (nixRouting, 10); - - stack.SetRoutingHelper (listRH); // has effect on the next Install () + stack.SetRoutingHelper (nixRouting); // has effect on the next Install () stack.Install (nodes); NS_LOG_INFO ("creating ip4 addresses"); diff --git a/src/topology-read/examples/wscript b/src/topology-read/examples/wscript index 1ce9b8a71..77ea06120 100644 --- a/src/topology-read/examples/wscript +++ b/src/topology-read/examples/wscript @@ -1,5 +1,5 @@ ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- def build(bld): - obj = bld.create_ns3_program('topology-read', ['topology-read', 'internet', 'nix-vector-routing', 'point-to-point', 'applications']) + obj = bld.create_ns3_program('topology-example-sim', ['topology-read', 'internet', 'nix-vector-routing', 'point-to-point', 'applications']) obj.source = 'topology-example-sim.cc'