diff options
Diffstat (limited to 'sys/net/if.c')
-rw-r--r-- | sys/net/if.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index 107850024f8..89765b912a7 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.53 2002/04/24 16:42:59 dhartmei Exp $ */ +/* $OpenBSD: if.c,v 1.54 2002/05/27 02:59:40 itojun Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -77,6 +77,7 @@ #include <sys/protosw.h> #include <sys/kernel.h> #include <sys/ioctl.h> +#include <sys/domain.h> #include <net/if.h> #include <net/if_dl.h> @@ -159,6 +160,7 @@ if_attachsetup(ifp) register struct sockaddr_dl *sdl; register struct ifaddr *ifa; static int if_indexlim = 8; + struct domain *dp; ifp->if_index = ++if_index; @@ -239,6 +241,14 @@ if_attachsetup(ifp) ifp->if_snd.altq_tbr = NULL; ifp->if_snd.altq_ifp = ifp; #endif + + /* address family dependent data region */ + bzero(ifp->if_afdata, sizeof(ifp->if_afdata)); + for (dp = domains; dp; dp = dp->dom_next) { + if (dp->dom_ifattach) + ifp->if_afdata[dp->dom_family] = + (*dp->dom_ifattach)(ifp); + } } void @@ -336,6 +346,7 @@ if_detach(ifp) struct ifaddr *ifa; int i, s = splimp(); struct radix_node_head *rnh; + struct domain *dp; ifp->if_flags &= ~IFF_OACTIVE; ifp->if_start = if_detached_start; @@ -401,7 +412,15 @@ if_detach(ifp) #endif free(ifa, M_IFADDR); } + free(ifp->if_addrhooks, M_TEMP); + + for (dp = domains; dp; dp = dp->dom_next) { + if (dp->dom_ifdetach && ifp->if_afdata[dp->dom_family]) + (*dp->dom_ifdetach)(ifp, + ifp->if_afdata[dp->dom_family]); + } + splx(s); } |