diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-05-27 13:42:17 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-05-27 13:42:17 +0000 |
commit | dd02339b806a5c6f23ab54bb5815e81b249133f8 (patch) | |
tree | a4e0d98545a7ec34db68746c168991b043e1892c /sys/net | |
parent | 5ed7881d0cbf3bce3801829be9809f399c82b93a (diff) |
if_attach() gets called before domaininit(). scan all interfaces for if_afdata
initialization after domaininit().
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if.c | 28 | ||||
-rw-r--r-- | sys/net/if.h | 3 |
2 files changed, 27 insertions, 4 deletions
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 *); |