nix-vector-routing: (fixes #2252) Nix needs StaticRouting to work.

NixVectorRouting doesn't need anymore to be used along with StaticRouting.
This commit is contained in:
Tommaso Pecorella
2016-02-03 21:35:37 +01:00
parent 75f98f9b27
commit 65056f8897
12 changed files with 39 additions and 103 deletions

View File

@@ -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

View File

@@ -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");

View File

@@ -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");

View File

@@ -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 ()
}

View File

@@ -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 ()
}

View File

@@ -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 ()
}

View File

@@ -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

View File

@@ -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;

View File

@@ -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

View File

@@ -619,6 +619,31 @@ Ipv4NixVectorRouting::RouteInput (Ptr<const Packet> 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<Ipv4Route> rtentry;
// Get the nix-vector from the packet

View File

@@ -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");

View File

@@ -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'