git: f0ce2ae67f9f - main - nd6: Do not make SLAAC addresses usable with ifdisabled

From: Pouria Mousavizadeh Tehrani <pouria_at_FreeBSD.org>
Date: Wed, 25 Nov 2026 22:15:46 UTC
The branch main has been updated by pouria:

URL: https://cgit.FreeBSD.org/src/commit/?id=f0ce2ae67f9f5692aef743741e1063fad4d16813

commit f0ce2ae67f9f5692aef743741e1063fad4d16813
Author:     Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
AuthorDate: 2026-11-25 21:25:05 +0000
Commit:     Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
CommitDate: 2026-11-25 22:13:05 +0000

    nd6: Do not make SLAAC addresses usable with ifdisabled
    
    Setting TENTATIVE was what made these addresses unusable, because
    TENTATIVE is part of IN6_IFF_NOTREADY.
    keep setting TENTATIVE in nd6_timer() and nd6_ioctl() to not making
    them usable.
    
    Reported by:    llm-postcr
    Fixes:          c7cd7e7fad57 ("nd6: Add support for Optimistic DAD (RFC 4429)")
    Differential Revision:  https://reviews.freebsd.org/D55229
---
 sys/netinet6/in6.c | 1 +
 sys/netinet6/nd6.c | 7 +++----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 878ac7ec2e4b..c7ede610d6d5 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -2125,6 +2125,7 @@ in6_if_up(struct ifnet *ifp)
 			 * We may be able to skip the random delay in this
 			 * case, but we impose delays just in case.
 			 */
+			in6_ifa_need_dad(ia);
 			nd6_dad_start(ifa,
 			    arc4random() % (MAX_RTR_SOLICITATION_DELAY * hz));
 		}
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index 7952bc1985b0..6437875b7c2c 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1040,8 +1040,7 @@ nd6_timer(void *arg)
 		} else {
 			/*
 			 * Check status of the interface.  If it is down,
-			 * mark the address as optimistic if available, or
-			 * mark it as tentative for future DAD.
+			 * mark the address as tentative for future DAD.
 			 */
 			ifp = ia6->ia_ifp;
 			if ((ifp->if_inet6->nd_flags & ND6_IFF_NO_DAD) == 0 &&
@@ -1049,7 +1048,7 @@ nd6_timer(void *arg)
 			    (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 ||
 			    (ifp->if_inet6->nd_flags & ND6_IFF_IFDISABLED))){
 				ia6->ia6_flags &= ~IN6_IFF_DUPLICATED;
-				in6_ifa_need_dad(ia6);
+				ia6->ia6_flags |= IN6_IFF_TENTATIVE;
 			}
 
 			/*
@@ -1765,7 +1764,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp)
 					    AF_INET6)
 						continue;
 					ia = (struct in6_ifaddr *)ifa;
-					in6_ifa_need_dad(ia);
+					ia->ia6_flags |= IN6_IFF_TENTATIVE;
 				}
 				NET_EPOCH_EXIT(et);
 			}