Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Jan 2021 10:05:29 GMT
From:      "Alexander V. Chernikov" <melifaro@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: e58c8da0683d - main - Map IPv6 link-local prefix to the link-local ifa.
Message-ID:  <202101131005.10DA5TdR036284@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by melifaro:

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

commit e58c8da0683dcff6ce3432bdfa98f7271140cda3
Author:     Alexander V. Chernikov <melifaro@FreeBSD.org>
AuthorDate: 2021-01-12 23:14:03 +0000
Commit:     Alexander V. Chernikov <melifaro@FreeBSD.org>
CommitDate: 2021-01-13 10:03:15 +0000

    Map IPv6 link-local prefix to the link-local ifa.
    
    Currently we create link-local route by creating an always-on IPv6 prefix
     in the prefix list. This prefix is not tied to the link-local ifa.
    
    This leads to the following problems:
    
    First, when flushing interface addresses we skip on-link route, leaving
     fe80::/64 prefix on the interface without any IPv6 addresses.
    Second, when creating and removing link-local alias we lose fe80::/64 prefix
     from the routing table.
    
    Fix this by attaching link-local prefix to the ifa at the initial creation.
    
    Reviewed by:    hrs
    MFC after:      2 weeks
    Differential revision:  https://reviews.freebsd.org/D28129
---
 sys/netinet6/in6_ifattach.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c
index 81cd24823f10..1a07fb13b179 100644
--- a/sys/netinet6/in6_ifattach.c
+++ b/sys/netinet6/in6_ifattach.c
@@ -520,8 +520,11 @@ in6_ifattach_linklocal(struct ifnet *ifp, struct ifnet *altifp)
 	 * valid with referring to the old link-local address.
 	 */
 	if ((pr = nd6_prefix_lookup(&pr0)) == NULL) {
-		if ((error = nd6_prelist_add(&pr0, NULL, NULL)) != 0)
+		if ((error = nd6_prelist_add(&pr0, NULL, &pr)) != 0)
 			return (error);
+		/* Reference prefix */
+		ia->ia6_ndpr = pr;
+		pr->ndpr_addrcnt++;
 	} else
 		nd6_prefix_rele(pr);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101131005.10DA5TdR036284>