local repair killed
This commit is contained in:
@@ -69,8 +69,6 @@ RoutingProtocol::RoutingProtocol () :
|
||||
AllowedHelloLoss (2),
|
||||
DeletePeriod (Scalar(5) * std::max(ActiveRouteTimeout, HelloInterval)),
|
||||
NextHopWait (NodeTraversalTime + MilliSeconds (10)),
|
||||
MaxRepairTtl (0.3* NetDiameter),
|
||||
LocalAddTtl (2),
|
||||
TimeoutBuffer (2),
|
||||
BlackListTimeout(Scalar (RreqRetries) * NetTraversalTime),
|
||||
MaxQueueLen (64),
|
||||
@@ -78,16 +76,12 @@ RoutingProtocol::RoutingProtocol () :
|
||||
DestinationOnly (false),
|
||||
GratuitousReply (true),
|
||||
EnableHello (true),
|
||||
EnableLocalRepair (true),
|
||||
m_routingTable (DeletePeriod),
|
||||
m_queue (MaxQueueLen, MaxQueueTime),
|
||||
m_requestId (0),
|
||||
m_seqNo (0),
|
||||
m_nb(HelloInterval),
|
||||
m_repairedDst (Ipv4Address ()),
|
||||
htimer (Timer::CANCEL_ON_DESTROY),
|
||||
lrtimer (Timer::CANCEL_ON_DESTROY)
|
||||
|
||||
htimer (Timer::CANCEL_ON_DESTROY)
|
||||
{
|
||||
if (EnableHello)
|
||||
{
|
||||
@@ -122,10 +116,6 @@ RoutingProtocol::GetTypeId (void)
|
||||
UintegerValue (35),
|
||||
MakeUintegerAccessor (&RoutingProtocol::NetDiameter),
|
||||
MakeUintegerChecker<uint32_t> ())
|
||||
.AddAttribute ("LocalAddTtl", "Value used in calculation RREQ TTL when use local repair.",
|
||||
UintegerValue (7),
|
||||
MakeUintegerAccessor (&RoutingProtocol::LocalAddTtl),
|
||||
MakeUintegerChecker<uint16_t> ())
|
||||
.AddAttribute ("MaxQueueLen", "Maximum number of packets that we allow a routing protocol to buffer.",
|
||||
UintegerValue (64),
|
||||
MakeUintegerAccessor (&RoutingProtocol::MaxQueueLen),
|
||||
@@ -153,11 +143,6 @@ RoutingProtocol::GetTypeId (void)
|
||||
MakeBooleanAccessor (&RoutingProtocol::SetHelloEnable,
|
||||
&RoutingProtocol::GetHelloEnable),
|
||||
MakeBooleanChecker ())
|
||||
.AddAttribute ("EnableLocalRepair", "Enable local repair.",
|
||||
BooleanValue (true),
|
||||
MakeBooleanAccessor (&RoutingProtocol::SetLocalRepairEnable,
|
||||
&RoutingProtocol::GetLocalRepairEnable),
|
||||
MakeBooleanChecker ())
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
@@ -310,23 +295,7 @@ RoutingProtocol::Forwarding (Ptr<const Packet> p, const Ipv4Header & header, Uni
|
||||
RoutingTableEntry toDst;
|
||||
if (m_routingTable.LookupRoute (dst, toDst))
|
||||
{
|
||||
if (toDst.GetFlag () == REPAIRABLE && EnableLocalRepair && !lrtimer.IsRunning())
|
||||
{
|
||||
if (toDst.GetHop () > MaxRepairTtl)
|
||||
return false;
|
||||
LocalRouteRepair (dst, origin);
|
||||
QueueEntry newEntry (p, header, ucb, ecb, MaxQueueTime);
|
||||
m_queue.Enqueue (newEntry);
|
||||
NS_LOG_LOGIC("Local repair "<< dst);
|
||||
return true;
|
||||
}
|
||||
else if (toDst.GetFlag () == BEING_REPAIRED)
|
||||
{
|
||||
QueueEntry newEntry (p, header, ucb, ecb, MaxQueueTime);
|
||||
m_queue.Enqueue (newEntry);
|
||||
return true;
|
||||
}
|
||||
else if (toDst.GetFlag () == VALID)
|
||||
if (toDst.GetFlag () == VALID)
|
||||
{
|
||||
Ptr<Ipv4Route> route = toDst.GetRoute ();
|
||||
NS_LOG_LOGIC(route->GetSource()<<" forwarding to " << dst << " from " << origin << " packet " << p->GetUid ());
|
||||
@@ -353,7 +322,7 @@ RoutingProtocol::Forwarding (Ptr<const Packet> p, const Ipv4Header & header, Uni
|
||||
m_nb.Update (toOrigin.GetNextHop (), ActiveRouteTimeout);
|
||||
|
||||
NS_LOG_LOGIC ("Forwarding");
|
||||
m_routingTable.Print(std::cout);
|
||||
m_routingTable.Print (std::cout);
|
||||
ucb (route, p, header);
|
||||
return true;
|
||||
}
|
||||
@@ -377,10 +346,6 @@ RoutingProtocol::SetIpv4 (Ptr<Ipv4> ipv4)
|
||||
NS_ASSERT (ipv4 != 0);
|
||||
NS_ASSERT (m_ipv4 == 0);
|
||||
|
||||
if (EnableLocalRepair)
|
||||
{
|
||||
lrtimer.SetFunction (&RoutingProtocol::LocalRepairTimerExpire, this);
|
||||
}
|
||||
if (EnableHello)
|
||||
{
|
||||
htimer.SetFunction (&RoutingProtocol::HelloTimerExpire, this);
|
||||
@@ -432,7 +397,6 @@ RoutingProtocol::NotifyInterfaceDown (uint32_t i )
|
||||
{
|
||||
NS_LOG_LOGIC ("No aodv interfaces");
|
||||
htimer.Cancel ();
|
||||
lrtimer.Cancel ();
|
||||
m_nb.Clear ();
|
||||
m_routingTable.Clear ();
|
||||
return;
|
||||
@@ -510,7 +474,6 @@ RoutingProtocol::NotifyRemoveAddress (uint32_t i, Ipv4InterfaceAddress address )
|
||||
{
|
||||
NS_LOG_LOGIC ("No aodv interfaces");
|
||||
htimer.Cancel ();
|
||||
lrtimer.Cancel ();
|
||||
m_nb.Clear ();
|
||||
m_routingTable.Clear ();
|
||||
return;
|
||||
@@ -946,18 +909,6 @@ RoutingProtocol::RecvReply (Ptr<Packet> p, Ipv4Address receiver, Ipv4Address sen
|
||||
return;
|
||||
}
|
||||
|
||||
if (dst == m_repairedDst)
|
||||
{
|
||||
RoutingTableEntry toDst;
|
||||
m_routingTable.LookupRoute (dst, toDst);
|
||||
if (toDst.GetHop () < rrepHeader.GetHopCount ())
|
||||
{
|
||||
lrtimer.Cancel ();
|
||||
m_repairedDst = Ipv4Address ();
|
||||
SendRerr (dst, true);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If the route table entry to the destination is created or updated, then the following actions occur:
|
||||
* - the route is marked as active,
|
||||
@@ -1222,17 +1173,6 @@ RoutingProtocol::HelloTimerExpire ()
|
||||
htimer.Schedule (HelloInterval - t);
|
||||
}
|
||||
|
||||
void
|
||||
RoutingProtocol::LocalRepairTimerExpire ()
|
||||
{
|
||||
NS_LOG_LOGIC ("Local repair failed. Drop packet with destination IP address " << m_repairedDst << " and send RERR message");
|
||||
m_queue.DropPacketWithDst (m_repairedDst);
|
||||
SendRerr (m_repairedDst, false);
|
||||
RoutingTableEntry toDst;
|
||||
m_routingTable.SetEntryState (m_repairedDst, INVALID);
|
||||
m_repairedDst = Ipv4Address ();
|
||||
}
|
||||
|
||||
void
|
||||
RoutingProtocol::AckTimerExpire (Ipv4Address neighbor, Time blacklistTimeout )
|
||||
{
|
||||
@@ -1400,23 +1340,6 @@ RoutingProtocol::SendRerrWhenNoRouteToForward (Ipv4Address dst, uint32_t dstSeqN
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RoutingProtocol::SendRerr (Ipv4Address dst, bool noDelete)
|
||||
{
|
||||
RerrHeader rerrHeader;
|
||||
std::vector<Ipv4Address> precursors;
|
||||
RoutingTableEntry toDst;
|
||||
if (!m_routingTable.LookupRoute (dst, toDst))
|
||||
return;
|
||||
toDst.GetPrecursors (precursors);
|
||||
rerrHeader.AddUnDestination (dst, toDst.GetSeqNo ());
|
||||
TypeHeader typeHeader (AODVTYPE_RERR);
|
||||
Ptr<Packet> packet = Create<Packet> ();
|
||||
packet->AddHeader (rerrHeader);
|
||||
packet->AddHeader (typeHeader);
|
||||
SendRerrMessage (packet, precursors);
|
||||
}
|
||||
|
||||
void
|
||||
RoutingProtocol::SendRerrMessage (Ptr<Packet> packet, std::vector<Ipv4Address> precursors )
|
||||
{
|
||||
@@ -1489,23 +1412,5 @@ RoutingProtocol::Drop(Ptr<const Packet> packet, const Ipv4Header & header, Socke
|
||||
NS_LOG_LOGIC (this <<" drop own packet " << packet->GetUid() << " to " << header.GetDestination () << " from queue. Error " << err);
|
||||
}
|
||||
|
||||
void
|
||||
RoutingProtocol::LocalRouteRepair (Ipv4Address dst, Ipv4Address origin )
|
||||
{
|
||||
NS_LOG_FUNCTION(this << " from " << origin << " to " << dst);
|
||||
|
||||
RoutingTableEntry toDst;
|
||||
RoutingTableEntry toOrigin;
|
||||
if (!m_routingTable.LookupRoute (dst, toDst))
|
||||
return;
|
||||
if (!m_routingTable.LookupRoute (origin, toOrigin))
|
||||
return;
|
||||
uint16_t ttl = std::max (toOrigin.GetHop () * 0.5, (double) toDst.GetHop ()) + LocalAddTtl;
|
||||
SendRequest (dst);
|
||||
toDst.SetFlag (BEING_REPAIRED);
|
||||
lrtimer.Schedule(Scalar(2*(ttl + TimeoutBuffer)) * NodeTraversalTime);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,8 +85,6 @@ public:
|
||||
void SetGratuitousReplyFlag (bool f) { GratuitousReply = f; }
|
||||
void SetHelloEnable (bool f) { EnableHello = f; }
|
||||
bool GetHelloEnable () const { return EnableHello; }
|
||||
void SetLocalRepairEnable (bool f) { EnableLocalRepair = f; }
|
||||
bool GetLocalRepairEnable () const { return EnableLocalRepair; }
|
||||
//\}
|
||||
private:
|
||||
///\name Protocol parameters. TODO document
|
||||
@@ -114,8 +112,6 @@ private:
|
||||
*/
|
||||
Time DeletePeriod;
|
||||
Time NextHopWait; ///< Period of our waiting for the neighbour's RREP_ACK
|
||||
uint16_t MaxRepairTtl; ///< Maximum distance in hops between intermediate node and destination node when local repair still may be applied.
|
||||
uint16_t LocalAddTtl; ///< Value used in calculation RREQ TTL when use local repair
|
||||
/**
|
||||
* The TimeoutBuffer is configurable. Its purpose is to provide a buffer for the timeout so that if the RREP is delayed
|
||||
* due to congestion, a timeout is less likely to occur while the RREP is still en route back to the source.
|
||||
@@ -127,7 +123,6 @@ private:
|
||||
bool DestinationOnly; ///< Indicates only the destination may respond to this RREQ.
|
||||
bool GratuitousReply; ///< Indicates whether a gratuitous RREP should be unicast to the node originated route discovery.
|
||||
bool EnableHello; ///< Indicates whether a hello messages enable
|
||||
bool EnableLocalRepair; ///< Indicates whether a local repair enable
|
||||
//\}
|
||||
|
||||
/// IP protocol
|
||||
@@ -147,8 +142,6 @@ private:
|
||||
IdCache m_idCache;
|
||||
/// Handle neighbors
|
||||
Neighbors m_nb;
|
||||
/// Address of the destination, which currently repaired.
|
||||
Ipv4Address m_repairedDst;
|
||||
|
||||
/// Unicast callback for own packets
|
||||
UnicastForwardCallback m_scb;
|
||||
@@ -158,16 +151,7 @@ private:
|
||||
private:
|
||||
/// Start protocol operation
|
||||
void Start ();
|
||||
/// Start local route repair procedure
|
||||
void LocalRouteRepair (Ipv4Address dst, Ipv4Address origin);
|
||||
/**
|
||||
* If route exists and valid, forward packet.
|
||||
* If route exists and down try to repair route if following conditions is true
|
||||
* 1. Using local route repair technique enable
|
||||
* 2. The destination is no farther than MAX_REPAIR_TTL hops away.
|
||||
* During local repair data packets SHOULD be buffered.
|
||||
* \return true if node forward packet or try to repair route.
|
||||
*/
|
||||
/// If route exists and valid, forward packet.
|
||||
bool Forwarding (Ptr<const Packet> p, const Ipv4Header & header, UnicastForwardCallback ucb, ErrorCallback ecb);
|
||||
/**
|
||||
* To reduce congestion in a network, repeated attempts by a source node at route discovery
|
||||
@@ -225,7 +209,6 @@ private:
|
||||
void SendReplyAck (Ipv4Address neighbor);
|
||||
/// Initiate RERR
|
||||
void SendRerrWhenBreaksLinkToNextHop (Ipv4Address nextHop);
|
||||
void SendRerr (Ipv4Address dst, bool noDelete);
|
||||
/// Forward RERR
|
||||
void SendRerrMessage(Ptr<Packet> packet, std::vector<Ipv4Address> precursors);
|
||||
/**
|
||||
@@ -248,8 +231,6 @@ private:
|
||||
//\{
|
||||
Timer htimer; // TODO independent hello timers for all interfaces
|
||||
void HelloTimerExpire ();
|
||||
Timer lrtimer;
|
||||
void LocalRepairTimerExpire ();
|
||||
std::map<Ipv4Address, Timer> m_addressReqTimer;
|
||||
void RouteRequestTimerExpire (Ipv4Address dst);
|
||||
void AckTimerExpire (Ipv4Address neighbor, Time blacklistTimeout);
|
||||
|
||||
@@ -145,16 +145,6 @@ RoutingTableEntry::Print (std::ostream & os ) const
|
||||
os << "DOWN";
|
||||
break;
|
||||
}
|
||||
case BEING_REPAIRED:
|
||||
{
|
||||
os << "IN_REPAIR";
|
||||
break;
|
||||
}
|
||||
case REPAIRABLE:
|
||||
{
|
||||
os << "REPAIRABLE";
|
||||
break;
|
||||
}
|
||||
case IN_SEARCH:
|
||||
{
|
||||
os << "IN_SEARCH";
|
||||
@@ -206,8 +196,6 @@ AodvRtableEntryTest::RunTests ()
|
||||
NS_TEST_ASSERT_EQUAL (rt.GetValidSeqNo (), false);
|
||||
rt.SetFlag(INVALID);
|
||||
NS_TEST_ASSERT_EQUAL (rt.GetFlag (), INVALID);
|
||||
rt.SetFlag(BEING_REPAIRED);
|
||||
NS_TEST_ASSERT_EQUAL (rt.GetFlag (), BEING_REPAIRED);
|
||||
rt.SetHop(12);
|
||||
NS_TEST_ASSERT_EQUAL (rt.GetHop (), 12);
|
||||
rt.SetLifeTime(Seconds(1));
|
||||
|
||||
@@ -50,8 +50,6 @@ enum RouteFlags
|
||||
VALID = 0, //!< VALID
|
||||
INVALID = 1, //!< INVALID
|
||||
IN_SEARCH = 2, //!< IN_SEARCH
|
||||
REPAIRABLE = 3, //!< REPAIRABLE
|
||||
BEING_REPAIRED = 4, //!BEING_REPAIRED
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user