From 9feffe7ad476b413a96a4e90ff1827dfd5b249de Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Thu, 29 Sep 2022 14:18:18 +0200 Subject: [PATCH] platform: detect dadfailed IPv6 addresses during pruning If an address is removed during pruning and it had the TENTATIVE flag before, the most likely cause of the removal is that it failed DAD. It could also be that the user removed it at the same time we needed to resync the platform cache, but that seems more unlikely. --- src/libnm-platform/nm-linux-platform.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libnm-platform/nm-linux-platform.c b/src/libnm-platform/nm-linux-platform.c index 573c07d33e..cc57ce4045 100644 --- a/src/libnm-platform/nm-linux-platform.c +++ b/src/libnm-platform/nm-linux-platform.c @@ -6759,6 +6759,14 @@ cache_prune_one_type(NMPlatform *platform, const NMPLookup *lookup) obj = main_entry->obj; + if (NMP_OBJECT_GET_TYPE(obj) == NMP_OBJECT_TYPE_IP6_ADDRESS) { + const NMPlatformIP6Address *pladdr = NMP_OBJECT_CAST_IP6_ADDRESS(obj); + + if (pladdr->n_ifa_flags & IFA_F_TENTATIVE) { + nm_platform_ip6_dadfailed_set(platform, pladdr->ifindex, &pladdr->address, TRUE); + } + } + _LOGt("cache-prune: prune %s", nmp_object_to_string(obj, NMP_OBJECT_TO_STRING_ALL, sbuf, sizeof(sbuf)));