From 3fee605300d7416b945b5c02abcf541ba1e94b9d Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Mon, 14 Sep 2015 21:06:00 +0200 Subject: [PATCH 1/2] 6lowpan nd: always perform l2 lookup for 6LBR --- .../network_layer/sixlowpan/nd/gnrc_sixlowpan_nd.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/net/gnrc/network_layer/sixlowpan/nd/gnrc_sixlowpan_nd.c b/sys/net/gnrc/network_layer/sixlowpan/nd/gnrc_sixlowpan_nd.c index 2b0d97acce5c..df2f360219b9 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/nd/gnrc_sixlowpan_nd.c +++ b/sys/net/gnrc/network_layer/sixlowpan/nd/gnrc_sixlowpan_nd.c @@ -164,6 +164,15 @@ kernel_pid_t gnrc_sixlowpan_nd_next_hop_l2addr(uint8_t *l2addr, uint8_t *l2addr_ nc_entry = gnrc_ipv6_nc_get(iface, next_hop); } if (ipv6_addr_is_link_local(next_hop)) { +/* in case of a border router there is no sensible way for address resolution + * if the interface is not given */ +#ifdef MODULE_GNRC_SIXLOWPAN_ND_BORDER_ROUTER + /* if no interface is specified it is impossible to resolve the + * link-layer address for a link-local address on a 6LBR */ + if (iface == KERNEL_PID_UNDEF) { + return KERNEL_PID_UNDEF; + } +#endif kernel_pid_t ifs[GNRC_NETIF_NUMOF]; size_t ifnum = gnrc_netif_get(ifs); /* we don't need address resolution, the EUI-64 is in next_hop's IID */ @@ -181,7 +190,7 @@ 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)) || + 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; } From 60be8fac8338d902354c19de630978d1835ceb24 Mon Sep 17 00:00:00 2001 From: Oleg Hahm Date: Thu, 17 Sep 2015 08:56:28 +0200 Subject: [PATCH 2/2] sixlowpan nd: check for a potential NCE first --- sys/net/gnrc/network_layer/sixlowpan/nd/gnrc_sixlowpan_nd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/net/gnrc/network_layer/sixlowpan/nd/gnrc_sixlowpan_nd.c b/sys/net/gnrc/network_layer/sixlowpan/nd/gnrc_sixlowpan_nd.c index df2f360219b9..d2a331a117ac 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/nd/gnrc_sixlowpan_nd.c +++ b/sys/net/gnrc/network_layer/sixlowpan/nd/gnrc_sixlowpan_nd.c @@ -163,7 +163,9 @@ 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 (ipv6_addr_is_link_local(next_hop)) { + /* If a NCE for this destination exist, we can use even for link-local + * addresses. This should be only the case for 6LBRs. */ + if ((ipv6_addr_is_link_local(next_hop)) && (nc_entry == NULL)) { /* in case of a border router there is no sensible way for address resolution * if the interface is not given */ #ifdef MODULE_GNRC_SIXLOWPAN_ND_BORDER_ROUTER