git: dfc15e761b84 - main - netlink: call IPv6 hook after the ifaddr operation when ifp is brought up.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 27 May 2023 10:44:21 UTC
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);