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;
|
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;
|
rpl_dag_t *dag;
|
||||||
|
rpl_ns_node_t *dest_node;
|
||||||
|
rpl_ns_node_t *root_node;
|
||||||
|
|
||||||
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) {
|
||||||
|
@ -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
|
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) &&
|
(dest_node != NULL && root_node != NULL && node->parent == root_node)) {
|
||||||
rpl_ns_get_node(dag, &UIP_IP_BUF->destipaddr) != NULL)) {
|
/* Routing header found or the packet destined for a direct child of the root.
|
||||||
/* Routing header found. The next hop should be already copied as the IPv6 destination
|
* 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 */
|
||||||
uip_ipaddr_copy(ipaddr, &UIP_IP_BUF->destipaddr);
|
uip_ipaddr_copy(ipaddr, &UIP_IP_BUF->destipaddr);
|
||||||
|
|
Loading…
Reference in a new issue