From 3ba6a4dbe05d58a5a520e0f8c48f9328be929204 Mon Sep 17 00:00:00 2001 From: kn Date: Tue, 22 Nov 2022 14:51:01 +0000 Subject: [PATCH] Remove useless struct in6_ifextra in6_var.h r1.75 removed all other struct members. Now It only contains a single struct nd_ifinfo pointer, so address family specific data might as well be just that. ND_IFINFO() is the only way nd6_nbr.c and nd6.c access this data, there is no other usage of if_afdata[]. One allocation and unhelpful indirection less per interface. All under _KERNEL. OK claudio --- sys/netinet6/in6.c | 14 +++----------- sys/netinet6/in6_var.h | 7 +------ sys/netinet6/nd6.h | 4 ++-- 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 89f81b7929d..d52a7732207 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.251 2022/11/19 14:26:40 kn Exp $ */ +/* $OpenBSD: in6.c,v 1.252 2022/11/22 14:51:01 kn Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -1601,19 +1601,11 @@ in6if_do_dad(struct ifnet *ifp) void * in6_domifattach(struct ifnet *ifp) { - struct in6_ifextra *ext; - - ext = malloc(sizeof(*ext), M_IFADDR, M_WAITOK | M_ZERO); - - ext->nd_ifinfo = nd6_ifattach(ifp); - return ext; + return nd6_ifattach(ifp); } void in6_domifdetach(struct ifnet *ifp, void *aux) { - struct in6_ifextra *ext = (struct in6_ifextra *)aux; - - nd6_ifdetach(ext->nd_ifinfo); - free(ext, M_IFADDR, sizeof(*ext)); + nd6_ifdetach(aux); } diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h index c2ce99e08ec..8f95784b680 100644 --- a/sys/netinet6/in6_var.h +++ b/sys/netinet6/in6_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_var.h,v 1.75 2022/11/12 16:36:07 kn Exp $ */ +/* $OpenBSD: in6_var.h,v 1.76 2022/11/22 14:51:01 kn Exp $ */ /* $KAME: in6_var.h,v 1.55 2001/02/16 12:49:45 itojun Exp $ */ /* @@ -87,11 +87,6 @@ struct in6_addrlifetime { }; #ifdef _KERNEL -struct nd_ifinfo; -struct in6_ifextra { - struct nd_ifinfo *nd_ifinfo; -}; - struct in6_ifaddr { struct ifaddr ia_ifa; /* protocol-independent info */ #define ia_ifp ia_ifa.ifa_ifp diff --git a/sys/netinet6/nd6.h b/sys/netinet6/nd6.h index a889ccc5ec6..1ee60c94b83 100644 --- a/sys/netinet6/nd6.h +++ b/sys/netinet6/nd6.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.h,v 1.80 2022/11/12 02:53:17 kn Exp $ */ +/* $OpenBSD: nd6.h,v 1.81 2022/11/22 14:51:01 kn Exp $ */ /* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */ /* @@ -94,7 +94,7 @@ struct in6_ndifreq { #include #define ND_IFINFO(ifp) \ - (((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->nd_ifinfo) + ((struct nd_ifinfo *)(ifp)->if_afdata[AF_INET6]) struct llinfo_nd6 { TAILQ_ENTRY(llinfo_nd6) ln_list; -- 2.20.1