diff --git a/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c b/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c index 7554f2ff9a..ec9e18b3a7 100644 --- a/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c +++ b/sys/net/gnrc/network_layer/ndp/gnrc_ndp.c @@ -373,7 +373,7 @@ void gnrc_ndp_nbr_adv_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif, memcpy(&real_dst, dst, sizeof(real_dst)); adv_flags |= NDP_NBR_ADV_FLAGS_S; } - /* add SL2AO based on target address */ + /* add TL2AO based on target address */ if (supply_tl2a) { uint8_t l2tgt[8]; size_t l2tgt_len; @@ -389,15 +389,21 @@ void gnrc_ndp_nbr_adv_send(const ipv6_addr_t *tgt, gnrc_netif_t *netif, break; } pkt = hdr; + /* Set the Override flag, + if the target address is not an anycast address, and + we do not provide a proxy service for the target (TODO), and + the Target Link Layer Address Option is included. */ + if (!(netif->ipv6.addrs_flags[tgt_idx] & + GNRC_NETIF_IPV6_ADDRS_FLAGS_ANYCAST)) { + /* If the receipt of an NA has an existing cache entry + which is not in the INCOMPLETE state, and the supplied TLLAO + indicates a different L2 address than the cached address, + then the O-flag takes precedence and the cache entry should be + updated. (Cf. https://tools.ietf.org/html/rfc4861#section-7.2.5) */ + adv_flags |= NDP_NBR_ADV_FLAGS_O; + } } } - /* TODO: also check if the node provides proxy services for tgt */ - if ((pkt != NULL) && - (netif->ipv6.addrs_flags[tgt_idx] & - GNRC_NETIF_IPV6_ADDRS_FLAGS_ANYCAST)) { - /* TL2A is not supplied and tgt is not anycast */ - adv_flags |= NDP_NBR_ADV_FLAGS_O; - } /* add neighbor advertisement header */ hdr = gnrc_ndp_nbr_adv_build(tgt, adv_flags, pkt); if (hdr == NULL) {