send to limited broadcast fixed

This commit is contained in:
Borovkova Elena
2009-08-19 16:25:22 +04:00
parent d4e5ff2659
commit 0813c9f0eb
4 changed files with 13 additions and 10 deletions

View File

@@ -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));

View File

@@ -373,6 +373,8 @@ UdpSocketImpl::DoSendTo (Ptr<Packet> 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 ())
{

View File

@@ -310,7 +310,7 @@ RoutingProtocol::RouteInput (Ptr<const Packet> 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<const Packet> p, const Ipv4Header & header, Uni
if (toDst.GetValidSeqNo ())
{
SendRerrWhenNoRouteToForward (dst, toDst.GetSeqNo (), origin);
NS_LOG_DEBUG ("Drop packet");
return false;
}
}

View File

@@ -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);