send to limited broadcast fixed
authorBorovkova Elena <borovkovaes@iitp.ru>
Wed, 19 Aug 2009 16:25:22 +0400
changeset 5696 207f9059840d
parent 5695 098168f99e72
child 5697 acf61aefb10f
send to limited broadcast fixed
examples/aodv.cc
src/internet-stack/udp-socket-impl.cc
src/routing/aodv/aodv-routing-protocol.cc
src/routing/aodv/id-cache.cc
--- a/examples/aodv.cc	Wed Aug 19 13:49:41 2009 +0400
+++ b/examples/aodv.cc	Wed Aug 19 16:25:22 2009 +0400
@@ -227,11 +227,11 @@
         // 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 @@
       }
     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));
--- a/src/internet-stack/udp-socket-impl.cc	Wed Aug 19 13:49:41 2009 +0400
+++ b/src/internet-stack/udp-socket-impl.cc	Wed Aug 19 16:25:22 2009 +0400
@@ -373,6 +373,8 @@
           // 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 ())
             {
--- a/src/routing/aodv/aodv-routing-protocol.cc	Wed Aug 19 13:49:41 2009 +0400
+++ b/src/routing/aodv/aodv-routing-protocol.cc	Wed Aug 19 16:25:22 2009 +0400
@@ -310,7 +310,7 @@
               }
             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 @@
           if (toDst.GetValidSeqNo ())
             {
               SendRerrWhenNoRouteToForward (dst, toDst.GetSeqNo (), origin);
+              NS_LOG_DEBUG ("Drop packet");
               return false;
             }
         }
--- a/src/routing/aodv/id-cache.cc	Wed Aug 19 13:49:41 2009 +0400
+++ b/src/routing/aodv/id-cache.cc	Wed Aug 19 16:25:22 2009 +0400
@@ -64,7 +64,6 @@
   return m_idCache.size ();
 }
 
-
 #ifdef RUN_SELF_TESTS
 /// Unit test for id cache
 struct IdCacheTest : public Test
@@ -90,6 +89,7 @@
   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);