Skip to content

Commit 21fd01f

Browse files
Shashwat-Patnitomhenderson
authored andcommitted
internet: fix print routing table output format for GlobalRouting
1 parent 148bcb8 commit 21fd01f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/internet/model/global-routing.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,23 +503,25 @@ GlobalRouting<T>::PrintRoutingTable(Ptr<OutputStreamWrapper> stream, Time::Unit
503503
*os << std::resetiosflags(std::ios::adjustfield) << std::setiosflags(std::ios::left);
504504

505505
std::string name;
506+
std::string header;
506507
if constexpr (IsIpv4)
507508
{
508509
name = "Ipv4";
510+
header = "Destination Gateway Genmask Flags Metric Ref Use Iface";
509511
}
510512
else
511513
{
512514
name = "Ipv6";
515+
header = "Destination Next Hop Flag Met Ref Use Iface";
513516
}
514517

515518
*os << "Node: " << m_ip->template GetObject<Node>()->GetId() << ", Time: " << Now().As(unit)
516519
<< ", Local time: " << m_ip->template GetObject<Node>()->GetLocalTime().As(unit) << ", "
517-
<< name << "GlobalRouting table" << std::endl;
520+
<< name << "GlobalRouting table" << std::endl
521+
<< header << std::endl;
518522

519523
if (GetNRoutes() > 0)
520524
{
521-
*os << "Destination Next Hop Flag Met Ref Use If"
522-
<< std::endl;
523525
for (uint32_t j = 0; j < GetNRoutes(); j++)
524526
{
525527
std::ostringstream dest;
@@ -535,7 +537,6 @@ GlobalRouting<T>::PrintRoutingTable(Ptr<OutputStreamWrapper> stream, Time::Unit
535537
*os << std::setw(16) << gw.str();
536538
mask << route.GetDestNetworkMask();
537539
*os << std::setw(16) << mask.str();
538-
;
539540
}
540541
else
541542
{

0 commit comments

Comments
 (0)