internet: (fixes #1232) Add a function to reset routerId in GlobalRouteManager

This commit is contained in:
shashwat
2025-06-06 16:32:06 +05:30
committed by shashwat
parent 851e8b37cc
commit 6cbbf04672
2 changed files with 13 additions and 0 deletions

View File

@@ -55,4 +55,10 @@ GlobalRouteManager::AllocateRouterId()
return routerId++;
}
void
GlobalRouteManager::ResetRouterId()
{
routerId = 0;
}
} // namespace ns3

View File

@@ -60,6 +60,13 @@ class GlobalRouteManager
*/
static void InitializeRoutes();
/**
* @brief Reset the router ID counter to zero. This should only be called by tests to reset the
* router ID counter between simulations within the same program. This function should not be
* called In typical simulations or when using the GlobalRouting helper.
*/
static void ResetRouterId();
private:
static uint32_t routerId; //!< Router ID counter
};