summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-05-27 13:42:17 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2002-05-27 13:42:17 +0000
commitdd02339b806a5c6f23ab54bb5815e81b249133f8 (patch)
treea4e0d98545a7ec34db68746c168991b043e1892c /sys
parent5ed7881d0cbf3bce3801829be9809f399c82b93a (diff)
if_attach() gets called before domaininit(). scan all interfaces for if_afdata
initialization after domaininit().
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/init_main.c3
-rw-r--r--sys/net/if.c28
-rw-r--r--sys/net/if.h3
3 files changed, 29 insertions, 5 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index d46f5117eaa..8af998125d8 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.94 2002/03/14 20:31:31 mickey Exp $ */
+/* $OpenBSD: init_main.c,v 1.95 2002/05/27 13:42:16 itojun Exp $ */
/* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */
/*
@@ -357,6 +357,7 @@ main(framep)
s = splimp();
ifinit();
domaininit();
+ if_attachdomain();
splx(s);
#ifdef GPROF
diff --git a/sys/net/if.c b/sys/net/if.c
index 89765b912a7..061e86111ab 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.54 2002/05/27 02:59:40 itojun Exp $ */
+/* $OpenBSD: if.c,v 1.55 2002/05/27 13:42:16 itojun Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -109,6 +109,7 @@
#endif
void if_attachsetup(struct ifnet *);
+void if_attachdomain1(struct ifnet *);
int if_detach_rtdelete(struct radix_node *, void *);
int if_mark_ignore(struct radix_node *, void *);
int if_mark_unignore(struct radix_node *, void *);
@@ -160,7 +161,6 @@ 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;
@@ -242,7 +242,29 @@ if_attachsetup(ifp)
ifp->if_snd.altq_ifp = ifp;
#endif
- /* address family dependent data region */
+ if (domains)
+ if_attachdomain1(ifp);
+}
+
+void
+if_attachdomain()
+{
+ struct ifnet *ifp;
+
+ for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list))
+ if_attachdomain1(ifp);
+}
+
+void
+if_attachdomain1(ifp)
+ struct ifnet *ifp;
+{
+ struct domain *dp;
+
+ /*
+ * address family dependent data region - effective only
+ * after domaininit()
+ */
bzero(ifp->if_afdata, sizeof(ifp->if_afdata));
for (dp = domains; dp; dp = dp->dom_next) {
if (dp->dom_ifattach)
diff --git a/sys/net/if.h b/sys/net/if.h
index cbfd14b2bab..fec6c7f53db 100644
--- a/sys/net/if.h
+++ b/sys/net/if.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.h,v 1.36 2002/05/27 02:59:40 itojun Exp $ */
+/* $OpenBSD: if.h,v 1.37 2002/05/27 13:42:16 itojun Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
@@ -557,6 +557,7 @@ int ether_output(struct ifnet *,
char *ether_sprintf(u_char *);
void if_attach(struct ifnet *);
+void if_attachdomain(void);
void if_attachtail(struct ifnet *);
void if_attachhead(struct ifnet *);
void if_detach(struct ifnet *);