|
|
| 603 |
{ |
603 |
{ |
| 604 |
// A node ignores all RREQs received from any node in its blacklist |
604 |
// A node ignores all RREQs received from any node in its blacklist |
| 605 |
RouteCacheEntry toPrev; |
605 |
RouteCacheEntry toPrev; |
|
|
606 |
RouteCacheEntry::IP_VECTOR ip = toPrev.GetVector (); // The route from our own route cache to dst |
| 607 |
PrintVector (ip); |
| 608 |
std::vector<Ipv4Address> saveRoute (nodeList); |
| 609 |
PrintVector (saveRoute); |
| 606 |
/* |
610 |
/* |
| 607 |
* When the reverse route is created or updated, the following actions on the route are also carried out: |
611 |
* When the reverse route is created or updated, the following actions on the route are also carried out: |
| 608 |
* 3. the next hop in the routing table becomes the node from which the RREQ was received |
612 |
* 3. the next hop in the routing table becomes the node from which the RREQ was received |
|
|
| 737 |
/* |
741 |
/* |
| 738 |
* (ii) or it has an active route to the destination, send reply based on request header and route cache, |
742 |
* (ii) or it has an active route to the destination, send reply based on request header and route cache, |
| 739 |
* need to delay based on a random value from d = H * (h - 1 + r), which can avoid possible route |
743 |
* need to delay based on a random value from d = H * (h - 1 + r), which can avoid possible route |
| 740 |
* reply storm. |
744 |
* reply storm. Also, verify if two vectors do not contain duplicates (part of the route to the |
|
|
745 |
* destination from route cache and route collected so far). If so, do not use the route found |
| 746 |
* and forward the route request. |
| 741 |
*/ |
747 |
*/ |
| 742 |
else if (dsr->LookupRoute (targetAddress, toPrev)) |
748 |
else if (dsr->LookupRoute (targetAddress, toPrev) && !(IfDuplicates (ip, saveRoute))) |
| 743 |
{ |
749 |
{ |
| 744 |
RouteCacheEntry::IP_VECTOR ip = toPrev.GetVector (); // The route from our own route cache to dst |
|
|
| 745 |
PrintVector (ip); |
| 746 |
std::vector<Ipv4Address> saveRoute (nodeList); |
| 747 |
PrintVector (saveRoute); |
| 748 |
// Verify if the two vector contains duplicates, if so, do not use |
| 749 |
// the route found and forward the route request |
| 750 |
if (!(IfDuplicates (ip, saveRoute))) |
| 751 |
{ |
| 752 |
m_finalRoute.clear (); // Clear the final route vector |
750 |
m_finalRoute.clear (); // Clear the final route vector |
| 753 |
/** |
751 |
/** |
| 754 |
* push back the intermediate node address from the source to this node |
752 |
* push back the intermediate node address from the source to this node |
|
|
| 870 |
newPacket->AddHeader (dsrRoutingHeader); |
868 |
newPacket->AddHeader (dsrRoutingHeader); |
| 871 |
dsr->ScheduleCachedReply (newPacket, ipv4Address, nextHop, m_ipv4Route, hops); |
869 |
dsr->ScheduleCachedReply (newPacket, ipv4Address, nextHop, m_ipv4Route, hops); |
| 872 |
isPromisc = false; |
870 |
isPromisc = false; |
| 873 |
} |
871 |
|
| 874 |
else |
|
|
| 875 |
{ |
| 876 |
NS_LOG_DEBUG ("There is duplicate ip addresses in the two route parts"); |
| 877 |
} |
| 878 |
return rreq.GetSerializedSize (); |
872 |
return rreq.GetSerializedSize (); |
| 879 |
} |
873 |
} |
| 880 |
/* |
874 |
/* |