diff --git a/tos/lib/net/rpl/RPLDAORoutingEngineP.nc b/tos/lib/net/rpl/RPLDAORoutingEngineP.nc index 50737d80c3..88759817e8 100644 --- a/tos/lib/net/rpl/RPLDAORoutingEngineP.nc +++ b/tos/lib/net/rpl/RPLDAORoutingEngineP.nc @@ -367,6 +367,7 @@ generic module RPLDAORoutingEngineP() { if (memcmp_rpl((uint8_t*)entry->next_hop.s6_addr, (uint8_t*)iph->ip6_src.s6_addr, 16) == TRUE) { // same old destination with same DTSN + new_key = entry->key; } else { // new next hop for an existing downswards node call RPLRouteInfo.setDTSN((call RPLRouteInfo.getDTSN()) + 1); diff --git a/tos/lib/net/rpl/RPLOF0P.nc b/tos/lib/net/rpl/RPLOF0P.nc index b95b96b1a5..3952572fad 100644 --- a/tos/lib/net/rpl/RPLOF0P.nc +++ b/tos/lib/net/rpl/RPLOF0P.nc @@ -134,9 +134,8 @@ implementation{ parentNode = call ParentTable.get(min); - while ((!parentNode->valid) && - (min < MAX_PARENT) && - (parentNode->rank != INFINITE_RANK)) { + while ((min < MAX_PARENT) && + (!parentNode->valid || parentNode->rank >= nodeRank)) { min++; parentNode = call ParentTable.get(min); } diff --git a/tos/lib/net/rpl/RPLRankP.nc b/tos/lib/net/rpl/RPLRankP.nc index 1b8b3b2a37..97eda91dd2 100644 --- a/tos/lib/net/rpl/RPLRankP.nc +++ b/tos/lib/net/rpl/RPLRankP.nc @@ -316,7 +316,7 @@ implementation { tempEtx_hop = parentSet[indexset].etx_hop; parentSet[indexset] = parent; - if (tempEtx_hop > INIT_ETX && tempEtx_hop < BLIP_L2_RETRIES) { + if (tempEtx_hop > INIT_ETX && tempEtx_hop < BLIP_L2_RETRIES*divideRank) { tempEtx_hop = tempEtx_hop-INIT_ETX; if (tempEtx_hop < divideRank) tempEtx_hop = INIT_ETX;