mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-23 01:29:33 +00:00
Enable the root to send back a DAO-ACK
This commit is contained in:
parent
ed11320dc3
commit
0be30628ce
@ -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,20 +389,20 @@ 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;
|
||||||
|
|
||||||
PRINTF("RPL: SRH Hop ");
|
if(node->parent != root_node) {
|
||||||
PRINT6ADDR(&node_addr);
|
PRINTF("RPL: SRH Hop ");
|
||||||
PRINTF("\n");
|
PRINT6ADDR(&node_addr);
|
||||||
|
PRINTF("\n");
|
||||||
|
} else if(((DEBUG) & DEBUG_PRINT)) {
|
||||||
|
rpl_ns_get_node_global_addr(&node_addr, node);
|
||||||
|
PRINTF("RPL: SRH Next Hop ");
|
||||||
|
PRINT6ADDR(&node_addr);
|
||||||
|
PRINTF("\n");
|
||||||
|
}
|
||||||
node = node->parent;
|
node = node->parent;
|
||||||
path_len++;
|
path_len++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(((DEBUG) & DEBUG_PRINT) && node != NULL) {
|
|
||||||
rpl_ns_get_node_global_addr(&node_addr, node);
|
|
||||||
PRINTF("RPL: SRH Next Hop ");
|
|
||||||
PRINT6ADDR(&node_addr);
|
|
||||||
PRINTF("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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
|
||||||
+ (path_len - 1) * (16 - cmpre)
|
+ (path_len - 1) * (16 - cmpre)
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user