diff --git a/examples/aodv.cc b/examples/aodv.cc index 5dd4e53b0..b79f8c183 100644 --- a/examples/aodv.cc +++ b/examples/aodv.cc @@ -227,11 +227,11 @@ AodvExample::InstallApplications () // Create the OnOff application to send UDP datagrams of size // 210 bytes at a rate of 448 Kb/s Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (210)); - Config::SetDefault ("ns3::OnOffApplication::DataRate", DataRateValue (DataRate ("448kb/s"))); + Config::SetDefault ("ns3::OnOffApplication::DataRate", DataRateValue (DataRate ("6Mbps"))); uint16_t port = 9; // Discard port (RFC 863) OnOffHelper onoff ("ns3::UdpSocketFactory", - Address (InetSocketAddress ("10.255.255.255", port))); + Address (InetSocketAddress (interfaces.GetAddress(size-1), port))); onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable(1))); onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable(0))); @@ -252,12 +252,12 @@ AodvExample::InstallApplications () } case TCP: { -// V4PingHelper ping (interfaces.GetAddress(size - 1)); -// ping.SetAttribute ("Verbose", BooleanValue (true)); -// -// ApplicationContainer p = ping.Install (nodes.Get (0)); -// p.Start (Seconds (0)); -// p.Stop (Seconds (totalTime/2)); + V4PingHelper ping (interfaces.GetAddress(size - 1)); + ping.SetAttribute ("Verbose", BooleanValue (true)); + + ApplicationContainer p = ping.Install (nodes.Get (0)); + p.Start (Seconds (0)); + p.Stop (Seconds (totalTime/2)); Config::SetDefault ("ns3::OnOffApplication::PacketSize", UintegerValue (4096)); diff --git a/src/internet-stack/udp-socket-impl.cc b/src/internet-stack/udp-socket-impl.cc index bb003021d..b76408dbc 100644 --- a/src/internet-stack/udp-socket-impl.cc +++ b/src/internet-stack/udp-socket-impl.cc @@ -373,6 +373,8 @@ UdpSocketImpl::DoSendTo (Ptr p, Ipv4Address dest, uint16_t port) // Get the primary address Ipv4InterfaceAddress iaddr = ipv4->GetAddress (i, 0); Ipv4Address addri = iaddr.GetLocal (); + if (addri == Ipv4Address ("127.0.0.1")) + continue; Ipv4Mask maski = iaddr.GetMask (); if (maski == Ipv4Mask::GetOnes ()) { diff --git a/src/routing/aodv/aodv-routing-protocol.cc b/src/routing/aodv/aodv-routing-protocol.cc index fca930c7d..372205c73 100644 --- a/src/routing/aodv/aodv-routing-protocol.cc +++ b/src/routing/aodv/aodv-routing-protocol.cc @@ -310,7 +310,7 @@ RoutingProtocol::RouteInput (Ptr p, const Ipv4Header &header, Ptr< } else { - NS_LOG_WARN ("TTL exceeded. Drop packet " << p->GetUid ()); + NS_LOG_DEBUG ("TTL exceeded. Drop packet " << p->GetUid ()); } return true; } @@ -381,6 +381,7 @@ RoutingProtocol::Forwarding (Ptr p, const Ipv4Header & header, Uni if (toDst.GetValidSeqNo ()) { SendRerrWhenNoRouteToForward (dst, toDst.GetSeqNo (), origin); + NS_LOG_DEBUG ("Drop packet"); return false; } } diff --git a/src/routing/aodv/id-cache.cc b/src/routing/aodv/id-cache.cc index 8b7aa218d..c23058e03 100644 --- a/src/routing/aodv/id-cache.cc +++ b/src/routing/aodv/id-cache.cc @@ -64,7 +64,6 @@ IdCache::GetSize () return m_idCache.size (); } - #ifdef RUN_SELF_TESTS /// Unit test for id cache struct IdCacheTest : public Test @@ -90,6 +89,7 @@ IdCacheTest::RunTests () NS_TEST_ASSERT_EQUAL (cache.LookupId (Ipv4Address ("4.3.2.1"), 3), false); NS_TEST_ASSERT_EQUAL (cache.LookupId (Ipv4Address ("1.2.3.4"), 3), true); cache.InsertId(Ipv4Address ("1.1.1.1"), 4, Seconds(5)); + cache.InsertId(Ipv4Address ("1.1.1.1"), 4, Seconds(5)); cache.InsertId(Ipv4Address ("2.2.2.2"), 5, Seconds(16)); cache.InsertId(Ipv4Address ("3.3.3.3"), 6, Seconds(27)); NS_TEST_ASSERT_EQUAL (cache.GetSize (), 4);