git: 613eb8ee9cb2 - stable/14 - ipv6: don't complain when deleting an address with prefix length of 128

From: Andrey V. Elsukov <ae_at_FreeBSD.org>
Date: Wed, 15 Oct 2025 14:07:13 UTC
The branch stable/14 has been updated by ae:

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

commit 613eb8ee9cb269205cdf168e02b4b093ae1c9a62
Author:     Andrey V. Elsukov <ae@FreeBSD.org>
AuthorDate: 2025-10-07 13:08:15 +0000
Commit:     Andrey V. Elsukov <ae@FreeBSD.org>
CommitDate: 2025-10-15 14:06:43 +0000

    ipv6: don't complain when deleting an address with prefix length of 128
    
    Save prefix length in unused field in6_ifaddr->ia_plen, then on remove
    check if an address has 128 prefix length, and if so, we don't need to
    complain that there is none of related prefixes.
    
    Reviewed by:    kp
    Obtained from:  Yandex LLC
    Sponsored by:   Yandex LLC
    Differential Revision:  https://reviews.freebsd.org/D52952
    
    (cherry picked from commit c4cce0a3e94e3b22f874508d1a9cd81442648238)
---
 sys/netinet6/in6.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 8d43ae18969a..b2b3c64d0a77 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1288,8 +1288,8 @@ in6_addifaddr(struct ifnet *ifp, struct in6_aliasreq *ifra, struct in6_ifaddr *i
 	 */
 	bzero(&pr0, sizeof(pr0));
 	pr0.ndpr_ifp = ifp;
-	pr0.ndpr_plen = in6_mask2len(&ifra->ifra_prefixmask.sin6_addr,
-	    NULL);
+	pr0.ndpr_plen = ia->ia_plen =
+	    in6_mask2len(&ifra->ifra_prefixmask.sin6_addr, NULL);
 	if (pr0.ndpr_plen == 128) {
 		/* we don't need to install a host route. */
 		goto aifaddr_out;
@@ -1483,16 +1483,16 @@ in6_unlink_ifa(struct in6_ifaddr *ia, struct ifnet *ifp)
 	 * positive reference.
 	 */
 	remove_lle = 0;
-	if (ia->ia6_ndpr == NULL) {
-		nd6log((LOG_NOTICE,
-		    "in6_unlink_ifa: autoconf'ed address "
-		    "%s has no prefix\n", ip6_sprintf(ip6buf, IA6_IN6(ia))));
-	} else {
+	if (ia->ia6_ndpr != NULL) {
 		ia->ia6_ndpr->ndpr_addrcnt--;
 		/* Do not delete lles within prefix if refcont != 0 */
 		if (ia->ia6_ndpr->ndpr_addrcnt == 0)
 			remove_lle = 1;
 		ia->ia6_ndpr = NULL;
+	} else if (ia->ia_plen < 128) {
+		nd6log((LOG_NOTICE,
+		    "in6_unlink_ifa: autoconf'ed address "
+		    "%s has no prefix\n", ip6_sprintf(ip6buf, IA6_IN6(ia))));
 	}
 
 	nd6_rem_ifa_lle(ia, remove_lle);