Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix MR74, workaround for s4u-network-ns3-wifi
authorBruno Donassolo <bruno.donassolo@inria.fr>
Wed, 5 Jan 2022 14:32:04 +0000 (15:32 +0100)
committerBruno Donassolo <bruno.donassolo@inria.fr>
Wed, 5 Jan 2022 14:32:04 +0000 (15:32 +0100)
Fix error in NS3 introduced at merge request #74.

Rebuild the routing table at each netzone seal.
In theory, this could be done once at the seal of the platform.
However, our current platform_created signal is called when the XML
parsing has finished. The seal occurs only later at the Engine::run.

src/surf/network_ns3.cpp

index 2943511..900518a 100644 (file)
@@ -20,6 +20,7 @@
 #include <ns3/global-route-manager.h>
 #include <ns3/internet-stack-helper.h>
 #include <ns3/ipv4-address-helper.h>
+#include <ns3/ipv4-global-routing-helper.h>
 #include <ns3/packet-sink-helper.h>
 #include <ns3/point-to-point-helper.h>
 
@@ -170,7 +171,6 @@ static void zoneCreation_cb(simgrid::s4u::NetZone const& zone)
 
   mobility.SetPositionAllocator(positionAllocS);
   mobility.Install(nodes);
-
   ns3::Ipv4AddressHelper address;
   std::string addr = simgrid::xbt::string_printf("%d.%d.0.0", number_of_networks, number_of_links);
   address.SetBase(addr.c_str(), "255.255.0.0");
@@ -187,6 +187,9 @@ static void zoneCreation_cb(simgrid::s4u::NetZone const& zone)
   } else {
     number_of_links++;
   }
+  /* in theory we can compute the routing table only only once at the platform seal
+   *  however put it here since or platform_created signal is called before the seal right now */
+  ns3::Ipv4GlobalRoutingHelper::RecomputeRoutingTables();
 }
 
 static void clusterCreation_cb(simgrid::kernel::routing::ClusterCreationArgs const& cluster)