1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 06:23:53 +01:00

6lowpan nd: check for link-local first

This commit is contained in:
Oleg Hahm 2015-09-11 22:55:58 +02:00
parent 93a92dfa03
commit dc225e2861

View File

@ -163,10 +163,6 @@ kernel_pid_t gnrc_sixlowpan_nd_next_hop_l2addr(uint8_t *l2addr, uint8_t *l2addr_
/* get if not gotten from previous check */
nc_entry = gnrc_ipv6_nc_get(iface, next_hop);
}
if ((nc_entry == NULL) || (!gnrc_ipv6_nc_is_reachable(nc_entry)) ||
(gnrc_ipv6_nc_get_type(nc_entry) == GNRC_IPV6_NC_TYPE_TENTATIVE)) {
return KERNEL_PID_UNDEF;
}
if (ipv6_addr_is_link_local(next_hop)) {
kernel_pid_t ifs[GNRC_NETIF_NUMOF];
size_t ifnum = gnrc_netif_get(ifs);
@ -185,6 +181,10 @@ kernel_pid_t gnrc_sixlowpan_nd_next_hop_l2addr(uint8_t *l2addr, uint8_t *l2addr_
}
return iface;
}
else if ((nc_entry == NULL) || (!gnrc_ipv6_nc_is_reachable(nc_entry)) ||
(gnrc_ipv6_nc_get_type(nc_entry) == GNRC_IPV6_NC_TYPE_TENTATIVE)) {
return KERNEL_PID_UNDEF;
}
else {
if (nc_entry->l2_addr_len > 0) {
memcpy(l2addr, nc_entry->l2_addr, nc_entry->l2_addr_len);