Enable the root to send back a DAO-ACK

This commit is contained in:
Yasuyuki Tanaka 2016-02-15 19:04:40 +01:00 committed by Simon Duquennoy
parent ed11320dc3
commit 0be30628ce
2 changed files with 23 additions and 12 deletions

View file

@ -180,9 +180,11 @@ rpl_srh_get_next_hop(uip_ipaddr_t *ipaddr)
{ {
uint8_t *uip_next_hdr; uint8_t *uip_next_hdr;
int last_uip_ext_len = uip_ext_len; int last_uip_ext_len = uip_ext_len;
rpl_dag_t *dag;
uip_ext_len = 0; uip_ext_len = 0;
uip_next_hdr = &UIP_IP_BUF->proto; uip_next_hdr = &UIP_IP_BUF->proto;
dag = rpl_get_dag(&UIP_IP_BUF->destipaddr);
/* Look for routing header */ /* Look for routing header */
while(uip_next_hdr != NULL && *uip_next_hdr != UIP_PROTO_ROUTING) { while(uip_next_hdr != NULL && *uip_next_hdr != UIP_PROTO_ROUTING) {
@ -207,8 +209,10 @@ rpl_srh_get_next_hop(uip_ipaddr_t *ipaddr)
} }
} }
if(uip_next_hdr != NULL && *uip_next_hdr == UIP_PROTO_ROUTING if((uip_next_hdr != NULL && *uip_next_hdr == UIP_PROTO_ROUTING
&& UIP_RH_BUF->routing_type == RPL_RH_TYPE_SRH) { && UIP_RH_BUF->routing_type == RPL_RH_TYPE_SRH) ||
(default_instance->current_dag->rank == ROOT_RANK(default_instance) &&
rpl_ns_get_node(dag, &UIP_IP_BUF->destipaddr) != NULL)) {
/* Routing header found. The next hop should be already copied as the IPv6 destination /* Routing header found. The next hop should be already copied as the IPv6 destination
* address, via rpl_process_srh_header. We turn this address into a link-local to enable * address, via rpl_process_srh_header. We turn this address into a link-local to enable
* forwarding to next hop */ * forwarding to next hop */
@ -371,6 +375,12 @@ insert_srh_header(void)
/* For simplicity, we use cmpri = cmpre */ /* For simplicity, we use cmpri = cmpre */
cmpri = 15; cmpri = 15;
cmpre = 15; cmpre = 15;
if(node != NULL && node == root_node) {
PRINTF("RPL: SRH no need to insert SRH\n");
return 0;
}
while(node != NULL && node != root_node) { while(node != NULL && node != root_node) {
rpl_ns_get_node_global_addr(&node_addr, node); rpl_ns_get_node_global_addr(&node_addr, node);
@ -379,19 +389,19 @@ insert_srh_header(void)
cmpri = MIN(cmpri, count_matching_bytes(&node_addr, &UIP_IP_BUF->destipaddr, 16)); cmpri = MIN(cmpri, count_matching_bytes(&node_addr, &UIP_IP_BUF->destipaddr, 16));
cmpre = cmpri; cmpre = cmpri;
if(node->parent != root_node) {
PRINTF("RPL: SRH Hop "); PRINTF("RPL: SRH Hop ");
PRINT6ADDR(&node_addr); PRINT6ADDR(&node_addr);
PRINTF("\n"); PRINTF("\n");
node = node->parent; } else if(((DEBUG) & DEBUG_PRINT)) {
path_len++;
}
if(((DEBUG) & DEBUG_PRINT) && node != NULL) {
rpl_ns_get_node_global_addr(&node_addr, node); rpl_ns_get_node_global_addr(&node_addr, node);
PRINTF("RPL: SRH Next Hop "); PRINTF("RPL: SRH Next Hop ");
PRINT6ADDR(&node_addr); PRINT6ADDR(&node_addr);
PRINTF("\n"); PRINTF("\n");
} }
node = node->parent;
path_len++;
}
/* Extension header length: fixed headers + (n-1) * (16-ComprI) + (16-ComprE)*/ /* Extension header length: fixed headers + (n-1) * (16-ComprI) + (16-ComprE)*/
ext_len = RPL_RH_LEN + RPL_SRH_LEN ext_len = RPL_RH_LEN + RPL_SRH_LEN

View file

@ -1348,6 +1348,7 @@ dao_ack_output(rpl_instance_t *instance, uip_ipaddr_t *dest, uint8_t sequence,
PRINT6ADDR(dest); PRINT6ADDR(dest);
PRINTF(" with status %d\n", status); PRINTF(" with status %d\n", status);
uip_ext_len = 0;
buffer = UIP_ICMP_PAYLOAD; buffer = UIP_ICMP_PAYLOAD;
buffer[0] = instance->instance_id; buffer[0] = instance->instance_id;