From 0ace44eaeb49f7d42dde0b1ec4607b39b90baae8 Mon Sep 17 00:00:00 2001 From: Borovkova Elena Date: Tue, 18 Aug 2009 16:40:55 +0400 Subject: [PATCH] logic checked --- src/routing/aodv/aodv-packet.cc | 4 ++-- src/routing/aodv/aodv-packet.h | 5 ++++- src/routing/aodv/aodv-rtable.cc | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/routing/aodv/aodv-packet.cc b/src/routing/aodv/aodv-packet.cc index 16593cec6..f4f8c4dda 100644 --- a/src/routing/aodv/aodv-packet.cc +++ b/src/routing/aodv/aodv-packet.cc @@ -702,7 +702,7 @@ bool RerrHeader::AddUnDestination (Ipv4Address dst, uint32_t seqNo ) { if (m_unreachableDstSeqNo.find (dst) != m_unreachableDstSeqNo.end ()) - return false; + return true; NS_ASSERT (GetDestCount() < 255); // can't support more than 255 destinations in single RERR m_unreachableDstSeqNo.insert (std::make_pair (dst, seqNo)); @@ -776,7 +776,7 @@ bool RerrHeaderTest::RunTests () Ipv4Address dst = Ipv4Address("1.2.3.4"); NS_TEST_ASSERT(h.AddUnDestination(dst, 12)); NS_TEST_ASSERT_EQUAL(h.GetDestCount(),1); - NS_TEST_ASSERT(!h.AddUnDestination(dst, 13)); + NS_TEST_ASSERT(h.AddUnDestination(dst, 13)); Ipv4Address dst2 = Ipv4Address("4.3.2.1"); NS_TEST_ASSERT(h.AddUnDestination(dst2, 12)); NS_TEST_ASSERT_EQUAL(h.GetDestCount(), 2); diff --git a/src/routing/aodv/aodv-packet.h b/src/routing/aodv/aodv-packet.h index 78a46f272..0d626d2dd 100644 --- a/src/routing/aodv/aodv-packet.h +++ b/src/routing/aodv/aodv-packet.h @@ -292,7 +292,10 @@ public: bool GetNoDelete() const; //\} - /// Add unreachable node address and its sequence number in RERR header + /** + * Add unreachable node address and its sequence number in RERR header + *\return false if we already added maximum possible number of unreachable destinations + */ bool AddUnDestination(Ipv4Address dst, uint32_t seqNo); /** Delete pair (address + sequence number) from REER header, if the number of unreachable destinations > 0 * \return true on success diff --git a/src/routing/aodv/aodv-rtable.cc b/src/routing/aodv/aodv-rtable.cc index e8d8092aa..8f0f65636 100644 --- a/src/routing/aodv/aodv-rtable.cc +++ b/src/routing/aodv/aodv-rtable.cc @@ -313,7 +313,7 @@ RoutingTable::GetListOfDestinationWithNextHop (Ipv4Address nextHop, std::map::const_iterator i = m_ipv4AddressEntry.begin (); i != m_ipv4AddressEntry.end (); ++i) - if ((i->second.GetNextHop () == nextHop) && (i->second.GetFlag () == VALID) && (!i->second.IsPrecursorListEmpty ())) + if ((i->second.GetNextHop () == nextHop) && (i->second.GetFlag () == VALID)) { unreachable.insert (std::make_pair (i->first, i->second.GetSeqNo ())); }