Skip to content

Commit

Permalink
6lowpan nd: prefer NCEs over FIB entries
Browse files Browse the repository at this point in the history
If an address can be found in the neighbor cache, it should be used - whatever the FIB may return.
  • Loading branch information
OlegHahm committed Jan 29, 2016
1 parent 35eb99a commit 250c288
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sys/net/gnrc/network_layer/sixlowpan/nd/gnrc_sixlowpan_nd.c
Expand Up @@ -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))) {
Expand All @@ -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);
Expand Down

0 comments on commit 250c288

Please sign in to comment.