It only contains a single struct nd_ifinfo pointer now, so the
domain/address family specific data might as well be just that.

ND6 still works with this, as expected.

Again, IPv6/ND6 is the only subsystem using struct ifnet's
*if_afdata[AF_MAX];  perhaps this can be broken down further.

Feedback? Objection? OK?

diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index fb7b6fac053..c0d515ffc6d 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1608,19 +1608,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 9f4693b289f..2d7891fbc7b 100644
--- a/sys/netinet6/in6_var.h
+++ b/sys/netinet6/in6_var.h
@@ -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..f51088cc795 100644
--- a/sys/netinet6/nd6.h
+++ b/sys/netinet6/nd6.h
@@ -94,7 +94,7 @@ struct        in6_ndifreq {
 #include <sys/queue.h>
 
 #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;

Reply via email to