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