Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 May 2023 10:44:21 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: dfc15e761b84 - main - netlink: call IPv6 hook after the ifaddr operation when ifp is brought up.
Message-ID:  <202305271044.34RAiLLC057014@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=dfc15e761b84c6dcaee68a18e8077058479c928f

commit dfc15e761b84c6dcaee68a18e8077058479c928f
Author:     Alexander V. Chernikov <melifaro@FreeBSD.org>
AuthorDate: 2023-05-27 10:38:32 +0000
Commit:     Alexander V. Chernikov <melifaro@FreeBSD.org>
CommitDate: 2023-05-27 10:38:32 +0000

    netlink: call IPv6 hook after the ifaddr operation when ifp is brought
    up.
    
    This change fixes the case when the first address added to the interface
     is IPv6 GU address. Before the change, IPv6 LL addition was not
    triggered.
    
    PR: 271661
    MFC after:      2 weeks
---
 sys/netlink/route/iface.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/sys/netlink/route/iface.c b/sys/netlink/route/iface.c
index 920c473490ab..e7a66a3d32fc 100644
--- a/sys/netlink/route/iface.c
+++ b/sys/netlink/route/iface.c
@@ -1155,12 +1155,7 @@ handle_newaddr_inet(struct nlmsghdr *hdr, struct nl_parsed_ifa *attrs,
 	if (attrs->ifa_dst != NULL)
 		req.ifra_dstaddr = *((struct sockaddr_in *)attrs->ifa_dst);
 
-	int error = in_control(NULL, SIOCAIFADDR, &req, ifp, curthread);
-#ifdef INET6
-	if (error == 0 && !(if_flags & IFF_UP) && (if_getflags(ifp) & IFF_UP))
-		in6_if_up(ifp);
-#endif
-	return (error);
+	return (in_control(NULL, SIOCAIFADDR, &req, ifp, curthread));
 }
 
 static int
@@ -1262,6 +1257,7 @@ rtnl_handle_addr(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_pstate *npt)
 		    attrs.ifa_index);
 		return (ENOENT);
 	}
+	int if_flags = if_getflags(ifp);
 
 #if defined(INET) || defined(INET6)
 	bool new = hdr->nlmsg_type == NL_RTM_NEWADDR;
@@ -1294,6 +1290,11 @@ rtnl_handle_addr(struct nlmsghdr *hdr, struct nlpcb *nlp, struct nl_pstate *npt)
 		error = EAFNOSUPPORT;
 	}
 
+#ifdef INET6
+	if (error == 0 && !(if_flags & IFF_UP) && (if_getflags(ifp) & IFF_UP))
+		in6_if_up(ifp);
+#endif
+
 	if_rele(ifp);
 
 	return (error);



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