diff --git a/RELEASE_NOTES b/RELEASE_NOTES index fdb6a2b29..9579581b5 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -45,6 +45,7 @@ Bugs fixed - Bug 2087 - Waf fails to build ns-3 if the path contains accented characters - Bug 2090 - (rip-ng) Routes may be added twice on interface activation - Bug 2093 - MultiModelSpectrumChannel::GetDevice only works for 0-th index +- Bug 2103 - Ipv[4,6]RoutingHelper::PrintRoutingTableAll[At,Every] hangs if a node doesn't have IP Known issues ------------ diff --git a/src/internet/helper/ipv4-routing-helper.cc b/src/internet/helper/ipv4-routing-helper.cc index 9ed5fbd07..90f33fada 100644 --- a/src/internet/helper/ipv4-routing-helper.cc +++ b/src/internet/helper/ipv4-routing-helper.cc @@ -71,19 +71,25 @@ void Ipv4RoutingHelper::Print (Ptr node, Ptr stream) { Ptr ipv4 = node->GetObject (); - Ptr rp = ipv4->GetRoutingProtocol (); - NS_ASSERT (rp); - rp->PrintRoutingTable (stream); + if (ipv4) + { + Ptr rp = ipv4->GetRoutingProtocol (); + NS_ASSERT (rp); + rp->PrintRoutingTable (stream); + } } void Ipv4RoutingHelper::PrintEvery (Time printInterval, Ptr node, Ptr stream) { Ptr ipv4 = node->GetObject (); - Ptr rp = ipv4->GetRoutingProtocol (); - NS_ASSERT (rp); - rp->PrintRoutingTable (stream); - Simulator::Schedule (printInterval, &Ipv4RoutingHelper::PrintEvery, printInterval, node, stream); + if (ipv4) + { + Ptr rp = ipv4->GetRoutingProtocol (); + NS_ASSERT (rp); + rp->PrintRoutingTable (stream); + Simulator::Schedule (printInterval, &Ipv4RoutingHelper::PrintEvery, printInterval, node, stream); + } } void @@ -121,27 +127,30 @@ Ipv4RoutingHelper::PrintNeighborCacheEvery (Time printInterval,Ptr node, P void Ipv4RoutingHelper::PrintArpCache (Ptr node, Ptr stream) { - std::ostream* os = stream->GetStream (); - - *os << "ARP Cache of node "; - std::string found = Names::FindName (node); - if (Names::FindName (node) != "") - { - *os << found; - } - else - { - *os << static_cast (node->GetId ()); - } - *os << " at time " << Simulator::Now ().GetSeconds () << "\n"; - Ptr ipv4 = node->GetObject (); - for (uint32_t i=0; iGetNInterfaces(); i++) + if (ipv4) { - Ptr arpCache = ipv4->GetInterface (i)->GetArpCache (); - if (arpCache) + std::ostream* os = stream->GetStream (); + + *os << "ARP Cache of node "; + std::string found = Names::FindName (node); + if (Names::FindName (node) != "") { - arpCache->PrintArpCache (stream); + *os << found; + } + else + { + *os << static_cast (node->GetId ()); + } + *os << " at time " << Simulator::Now ().GetSeconds () << "\n"; + + for (uint32_t i=0; iGetNInterfaces(); i++) + { + Ptr arpCache = ipv4->GetInterface (i)->GetArpCache (); + if (arpCache) + { + arpCache->PrintArpCache (stream); + } } } } @@ -149,30 +158,33 @@ Ipv4RoutingHelper::PrintArpCache (Ptr node, Ptr strea void Ipv4RoutingHelper::PrintArpCacheEvery (Time printInterval, Ptr node, Ptr stream) { - std::ostream* os = stream->GetStream (); - - *os << "ARP Cache of node "; - std::string found = Names::FindName (node); - if (Names::FindName (node) != "") - { - *os << found; - } - else - { - *os << static_cast (node->GetId ()); - } - *os << " at time " << Simulator::Now ().GetSeconds () << "\n"; - Ptr ipv4 = node->GetObject (); - for (uint32_t i=0; iGetNInterfaces(); i++) + if (ipv4) { - Ptr arpCache = ipv4->GetInterface (i)->GetArpCache (); - if (arpCache) + std::ostream* os = stream->GetStream (); + + *os << "ARP Cache of node "; + std::string found = Names::FindName (node); + if (Names::FindName (node) != "") { - arpCache->PrintArpCache (stream); + *os << found; } + else + { + *os << static_cast (node->GetId ()); + } + *os << " at time " << Simulator::Now ().GetSeconds () << "\n"; + + for (uint32_t i=0; iGetNInterfaces(); i++) + { + Ptr arpCache = ipv4->GetInterface (i)->GetArpCache (); + if (arpCache) + { + arpCache->PrintArpCache (stream); + } + } + Simulator::Schedule (printInterval, &Ipv4RoutingHelper::PrintArpCacheEvery, printInterval, node, stream); } - Simulator::Schedule (printInterval, &Ipv4RoutingHelper::PrintArpCacheEvery, printInterval, node, stream); } } // namespace ns3 diff --git a/src/internet/helper/ipv6-routing-helper.cc b/src/internet/helper/ipv6-routing-helper.cc index 09ca1703f..2f980167b 100644 --- a/src/internet/helper/ipv6-routing-helper.cc +++ b/src/internet/helper/ipv6-routing-helper.cc @@ -71,19 +71,25 @@ void Ipv6RoutingHelper::Print (Ptr node, Ptr stream) { Ptr ipv6 = node->GetObject (); - Ptr rp = ipv6->GetRoutingProtocol (); - NS_ASSERT (rp); - rp->PrintRoutingTable (stream); + if (ipv6) + { + Ptr rp = ipv6->GetRoutingProtocol (); + NS_ASSERT (rp); + rp->PrintRoutingTable (stream); + } } void Ipv6RoutingHelper::PrintEvery (Time printInterval, Ptr node, Ptr stream) { Ptr ipv6 = node->GetObject (); - Ptr rp = ipv6->GetRoutingProtocol (); - NS_ASSERT (rp); - rp->PrintRoutingTable (stream); - Simulator::Schedule (printInterval, &Ipv6RoutingHelper::PrintEvery, printInterval, node, stream); + if (ipv6) + { + Ptr rp = ipv6->GetRoutingProtocol (); + NS_ASSERT (rp); + rp->PrintRoutingTable (stream); + Simulator::Schedule (printInterval, &Ipv6RoutingHelper::PrintEvery, printInterval, node, stream); + } } void @@ -121,27 +127,30 @@ Ipv6RoutingHelper::PrintNeighborCacheEvery (Time printInterval,Ptr node, P void Ipv6RoutingHelper::PrintNdiscCache (Ptr node, Ptr stream) { - std::ostream* os = stream->GetStream (); - - *os << "NDISC Cache of node "; - std::string found = Names::FindName (node); - if (Names::FindName (node) != "") - { - *os << found; - } - else - { - *os << static_cast (node->GetId ()); - } - *os << " at time " << Simulator::Now ().GetSeconds () << "\n"; - Ptr ipv6 = node->GetObject (); - for (uint32_t i=0; iGetNInterfaces(); i++) + if (ipv6) { - Ptr ndiscCache = ipv6->GetInterface (i)->GetNdiscCache (); - if (ndiscCache) + std::ostream* os = stream->GetStream (); + + *os << "NDISC Cache of node "; + std::string found = Names::FindName (node); + if (Names::FindName (node) != "") { - ndiscCache->PrintNdiscCache (stream); + *os << found; + } + else + { + *os << static_cast (node->GetId ()); + } + *os << " at time " << Simulator::Now ().GetSeconds () << "\n"; + + for (uint32_t i=0; iGetNInterfaces(); i++) + { + Ptr ndiscCache = ipv6->GetInterface (i)->GetNdiscCache (); + if (ndiscCache) + { + ndiscCache->PrintNdiscCache (stream); + } } } } @@ -149,30 +158,33 @@ Ipv6RoutingHelper::PrintNdiscCache (Ptr node, Ptr str void Ipv6RoutingHelper::PrintNdiscCacheEvery (Time printInterval, Ptr node, Ptr stream) { - std::ostream* os = stream->GetStream (); - - *os << "NDISC Cache of node "; - std::string found = Names::FindName (node); - if (Names::FindName (node) != "") - { - *os << found; - } - else - { - *os << static_cast (node->GetId ()); - } - *os << " at time " << Simulator::Now ().GetSeconds () << "\n"; - Ptr ipv6 = node->GetObject (); - for (uint32_t i=0; iGetNInterfaces(); i++) + if (ipv6) { - Ptr ndiscCache = ipv6->GetInterface (i)->GetNdiscCache (); - if (ndiscCache) + std::ostream* os = stream->GetStream (); + + *os << "NDISC Cache of node "; + std::string found = Names::FindName (node); + if (Names::FindName (node) != "") { - ndiscCache->PrintNdiscCache (stream); + *os << found; } + else + { + *os << static_cast (node->GetId ()); + } + *os << " at time " << Simulator::Now ().GetSeconds () << "\n"; + + for (uint32_t i=0; iGetNInterfaces(); i++) + { + Ptr ndiscCache = ipv6->GetInterface (i)->GetNdiscCache (); + if (ndiscCache) + { + ndiscCache->PrintNdiscCache (stream); + } + } + Simulator::Schedule (printInterval, &Ipv6RoutingHelper::PrintNdiscCacheEvery, printInterval, node, stream); } - Simulator::Schedule (printInterval, &Ipv6RoutingHelper::PrintNdiscCacheEvery, printInterval, node, stream); } } // namespace ns3