Use a stricter check in rpl_srh_get_next_hop()
This commit is contained in:
parent
0be30628ce
commit
97a362acdc
|
@ -181,10 +181,11 @@ rpl_srh_get_next_hop(uip_ipaddr_t *ipaddr)
|
|||
uint8_t *uip_next_hdr;
|
||||
int last_uip_ext_len = uip_ext_len;
|
||||
rpl_dag_t *dag;
|
||||
rpl_ns_node_t *dest_node;
|
||||
rpl_ns_node_t *root_node;
|
||||
|
||||
uip_ext_len = 0;
|
||||
uip_next_hdr = &UIP_IP_BUF->proto;
|
||||
dag = rpl_get_dag(&UIP_IP_BUF->destipaddr);
|
||||
|
||||
/* Look for routing header */
|
||||
while(uip_next_hdr != NULL && *uip_next_hdr != UIP_PROTO_ROUTING) {
|
||||
|
@ -209,11 +210,15 @@ rpl_srh_get_next_hop(uip_ipaddr_t *ipaddr)
|
|||
}
|
||||
}
|
||||
|
||||
dag = rpl_get_dag(&IP_IP_BUF->destipaddr);
|
||||
root_node = rpl_ns_get_node(dag, &dag->dag_id);
|
||||
dest_node = rpl_ns_get_node(dag, &UIP_IP_BUF->destipaddr);
|
||||
|
||||
if((uip_next_hdr != NULL && *uip_next_hdr == UIP_PROTO_ROUTING
|
||||
&& 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
|
||||
(dest_node != NULL && root_node != NULL && node->parent == root_node)) {
|
||||
/* Routing header found or the packet destined for a direct child of the root.
|
||||
* 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
|
||||
* forwarding to next hop */
|
||||
uip_ipaddr_copy(ipaddr, &UIP_IP_BUF->destipaddr);
|
||||
|
|
Loading…
Reference in a new issue