fix the way  to get nexthop address.
@@ -443,7 +443,6 @@ void forwarding_receive(
*/
void forwarding_getNextHop(open_addr_t* destination128b, open_addr_t* addressToWrite64b) {
uint8_t i;
- open_addr_t temp_prefix64btoWrite;
if (packetfunctions_isBroadcastMulticast(destination128b)) {
// IP destination is broadcast, send to 0xffffffffffffffff
@@ -451,9 +450,6 @@ void forwarding_getNextHop(open_addr_t* destination128b, open_addr_t* addressToW
for (i=0;i<8;i++) {
addressToWrite64b->addr_64b[i] = 0xff;
}
- } else if (neighbors_isStableNeighbor(destination128b)) {
- // IP destination is 1-hop neighbor, send directly
- packetfunctions_ip128bToMac64b(destination128b,&temp_prefix64btoWrite,addressToWrite64b);
} else {
// destination is remote, send to preferred parent
icmpv6rpl_getPreferredParentEui64(addressToWrite64b);
@@ -483,8 +479,17 @@ owerror_t forwarding_send_internal_RoutingTable(
uint8_t fw_SendOrfw_Rcv
) {
+ open_addr_t temp_prefix64btoWrite;
+
// retrieve the next hop from the routing table
+ if (msg->creator==COMPONENT_CJOIN){
+ if (neighbors_isStableNeighbor(&(msg->l3_destinationAdd))) {
+ // IP destination is 1-hop neighbor, send directly
+ packetfunctions_ip128bToMac64b(&(msg->l3_destinationAdd),&temp_prefix64btoWrite,&(msg->l2_nextORpreviousHop));
+ }
+ } else {
forwarding_getNextHop(&(msg->l3_destinationAdd),&(msg->l2_nextORpreviousHop));
+ }
if (msg->l2_nextORpreviousHop.type==ADDR_NONE) {
openserial_printError(
COMPONENT_FORWARDING,
