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
This commit is contained in:
Alexander V. Chernikov committed 2023-05-27 10:38:32 +00:00
1 parent 750ae32b9e
commit dfc15e761b
1 file changed
+7 -6
+7 -6
View File
@@ -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);