1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 14:33:52 +01:00

gnrc/ndp: bugfix set O-flag on non anycast target

This commit is contained in:
Fabian Hüßler 2022-03-09 12:05:03 +01:00
parent a2146acef7
commit bc3dfd4fda

View File

@ -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) {