From: kn Date: Wed, 23 Nov 2022 14:50:59 +0000 (+0000) Subject: Remove unused struct ifnet's *if_afdata[] and struct domain's dom_if{at,de}tach() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2d32fa7951ab90cbb391c7602cbc52baf8dcefbf;p=openbsd Remove unused struct ifnet's *if_afdata[] and struct domain's dom_if{at,de}tach() Both made obsolete through struct ifnet's previous *if_nd addition. IPv6 Neighbour Discovery handles per-interface data directly, nothing else uses this generic domain API anymore. Outside of _KERNEL, but nothing in base uses them, either. OK bluhm mvs claudio --- diff --git a/regress/sys/net/rtable/util.c b/regress/sys/net/rtable/util.c index f2c770f936f..b948d231cc5 100644 --- a/regress/sys/net/rtable/util.c +++ b/regress/sys/net/rtable/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.11 2022/06/29 04:49:51 anton Exp $ */ +/* $OpenBSD: util.c,v 1.12 2022/11/23 14:51:00 kn Exp $ */ /* * Copyright (c) 2015 Martin Pieuchot @@ -80,8 +80,6 @@ struct domain inetdomain = { .dom_protoswNPROTOSW = NULL, .dom_rtoffset = offsetof(struct sockaddr_in, sin_addr), .dom_maxplen = 32, - .dom_ifattach = NULL, - .dom_ifdetach = NULL, }; struct domain inet6domain = { @@ -94,8 +92,6 @@ struct domain inet6domain = { .dom_protoswNPROTOSW = NULL, .dom_rtoffset = offsetof(struct sockaddr_in6, sin6_addr), .dom_maxplen = 128, - .dom_ifattach = NULL, - .dom_ifdetach = NULL, }; struct domain *domains[] = { &inetdomain, &inet6domain, NULL }; diff --git a/sys/net/if.c b/sys/net/if.c index 36ac89ceb46..70f873b447d 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.681 2022/11/23 14:48:27 kn Exp $ */ +/* $OpenBSD: if.c,v 1.682 2022/11/23 14:50:59 kn Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -133,7 +133,6 @@ #include void if_attachsetup(struct ifnet *); -void if_attachdomain(struct ifnet *); void if_attach_common(struct ifnet *); void if_remove(struct ifnet *); int if_createrdomain(int, struct ifnet *); @@ -460,7 +459,6 @@ if_attachsetup(struct ifnet *ifp) if_addgroup(ifp, IFG_ALL); - if_attachdomain(ifp); #ifdef INET6 ifp->if_nd = nd6_ifattach(ifp); #endif @@ -537,25 +535,6 @@ if_free_sadl(struct ifnet *ifp) ifp->if_sadl = NULL; } -void -if_attachdomain(struct ifnet *ifp) -{ - const struct domain *dp; - int i, s; - - s = splnet(); - - /* address family dependent data region */ - bzero(ifp->if_afdata, sizeof(ifp->if_afdata)); - for (i = 0; (dp = domains[i]) != NULL; i++) { - if (dp->dom_ifattach) - ifp->if_afdata[dp->dom_family] = - (*dp->dom_ifattach)(ifp); - } - - splx(s); -} - void if_attachhead(struct ifnet *ifp) { @@ -1058,7 +1037,6 @@ if_detach(struct ifnet *ifp) { struct ifaddr *ifa; struct ifg_list *ifg; - const struct domain *dp; int i, s; /* Undo pseudo-driver changes. */ @@ -1126,11 +1104,6 @@ if_detach(struct ifnet *ifp) KASSERT(TAILQ_EMPTY(&ifp->if_linkstatehooks)); KASSERT(TAILQ_EMPTY(&ifp->if_detachhooks)); - for (i = 0; (dp = domains[i]) != NULL; i++) { - if (dp->dom_ifdetach && ifp->if_afdata[dp->dom_family]) - (*dp->dom_ifdetach)(ifp, - ifp->if_afdata[dp->dom_family]); - } #ifdef INET6 nd6_ifdetach(ifp->if_nd); #endif diff --git a/sys/net/if_var.h b/sys/net/if_var.h index eeb2aa8ba4a..fc7512c0974 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_var.h,v 1.121 2022/11/23 14:48:27 kn Exp $ */ +/* $OpenBSD: if_var.h,v 1.122 2022/11/23 14:50:59 kn Exp $ */ /* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */ /* @@ -186,7 +186,6 @@ struct ifnet { /* and the entries */ struct sockaddr_dl *if_sadl; /* [N] pointer to our sockaddr_dl */ - void *if_afdata[AF_MAX]; struct nd_ifinfo *if_nd; /* [I] IPv6 Neighour Discovery info */ }; #define if_mtu if_data.ifi_mtu diff --git a/sys/sys/domain.h b/sys/sys/domain.h index d8758fb8b9c..478bc193d7a 100644 --- a/sys/sys/domain.h +++ b/sys/sys/domain.h @@ -1,4 +1,4 @@ -/* $OpenBSD: domain.h,v 1.22 2021/05/25 22:45:10 bluhm Exp $ */ +/* $OpenBSD: domain.h,v 1.23 2022/11/23 14:50:59 kn Exp $ */ /* $NetBSD: domain.h,v 1.10 1996/02/09 18:25:07 christos Exp $ */ /* @@ -60,9 +60,6 @@ struct domain { unsigned int dom_sasize; /* size of sockaddr structure */ unsigned int dom_rtoffset; /* offset of the key, in bytes */ unsigned int dom_maxplen; /* maximum prefix length, in bits */ - void *(*dom_ifattach)(struct ifnet *); - void (*dom_ifdetach)(struct ifnet *, void *); - /* af-dependent data on ifnet */ }; #ifdef _KERNEL