Merge pull request #4714 from OlegHahm/6lo_nd_lookup
6lo nd: prefer NCEs over FIB entries
This commit is contained in:
commit
ca8dbbac20
@ -190,7 +190,8 @@ gnrc_ipv6_nc_t *gnrc_ipv6_nc_get(kernel_pid_t iface, const ipv6_addr_t *ipv6_add
|
||||
|
||||
for (int i = 0; i < GNRC_IPV6_NC_SIZE; i++) {
|
||||
if (((ncache[i].iface == KERNEL_PID_UNDEF) || (iface == KERNEL_PID_UNDEF) ||
|
||||
(iface == ncache[i].iface)) && ipv6_addr_equal(&(ncache[i].ipv6_addr), ipv6_addr)) {
|
||||
(iface == ncache[i].iface)) &&
|
||||
ipv6_addr_equal(&(ncache[i].ipv6_addr), ipv6_addr)) {
|
||||
DEBUG("ipv6_nc: Found entry for %s on interface %" PRIkernel_pid
|
||||
" (0 = all interfaces) [%p]\n",
|
||||
ipv6_addr_to_str(addr_str, ipv6_addr, sizeof(addr_str)),
|
||||
|
||||
@ -133,13 +133,14 @@ kernel_pid_t gnrc_sixlowpan_nd_next_hop_l2addr(uint8_t *l2addr, uint8_t *l2addr_
|
||||
next_hop = ipv6_ext_rh_next_hop(hdr);
|
||||
#endif
|
||||
#ifdef MODULE_FIB
|
||||
kernel_pid_t fib_iface;
|
||||
ipv6_addr_t next_hop_actual; /* FIB copies address into this variable */
|
||||
/* don't look-up link local addresses in FIB */
|
||||
if ((next_hop == NULL) && !ipv6_addr_is_link_local(dst)) {
|
||||
size_t next_hop_size = sizeof(ipv6_addr_t);
|
||||
uint32_t next_hop_flags = 0;
|
||||
if ((next_hop == NULL) &&
|
||||
(fib_get_next_hop(&gnrc_ipv6_fib_table, &iface, next_hop_actual.u8, &next_hop_size,
|
||||
(fib_get_next_hop(&gnrc_ipv6_fib_table, &fib_iface, next_hop_actual.u8, &next_hop_size,
|
||||
&next_hop_flags, (uint8_t *)dst,
|
||||
sizeof(ipv6_addr_t), 0) >= 0) &&
|
||||
(next_hop_size == sizeof(ipv6_addr_t))) {
|
||||
@ -150,6 +151,11 @@ kernel_pid_t gnrc_sixlowpan_nd_next_hop_l2addr(uint8_t *l2addr, uint8_t *l2addr_
|
||||
#ifdef MODULE_GNRC_SIXLOWPAN_ND_ROUTER
|
||||
/* next hop determination: https://tools.ietf.org/html/rfc6775#section-6.5.4 */
|
||||
nc_entry = gnrc_ipv6_nc_get(iface, dst);
|
||||
#ifdef MODULE_FIB
|
||||
if ((next_hop != NULL) && (nc_entry == NULL)) {
|
||||
nc_entry = gnrc_ipv6_nc_get(fib_iface, dst);
|
||||
}
|
||||
#endif
|
||||
/* if NCE found */
|
||||
if (nc_entry != NULL) {
|
||||
gnrc_ipv6_netif_t *ipv6_if = gnrc_ipv6_netif_get(nc_entry->iface);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user