diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2001-02-06 00:22:26 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2001-02-06 00:22:26 +0000 |
commit | b2ad256d635f41da2c0217f8326a2f7c99ac44eb (patch) | |
tree | 6640bdd1d3a66949fec08460bb6a3fc426921f97 /sys/net | |
parent | a64bc62d54ad86a3b2fa0197206f5e5766d59241 (diff) |
allow changing number of loopbacks in ukc.
change rest of the code to use lo0ifp pointing
to the corresponding struct ifnet.
itojun@ and niklas@ ok
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if.h | 6 | ||||
-rw-r--r-- | sys/net/if_loop.c | 13 | ||||
-rw-r--r-- | sys/net/net_osdep.h | 5 |
3 files changed, 12 insertions, 12 deletions
diff --git a/sys/net/if.h b/sys/net/if.h index 1c6151b355e..1f517fb174e 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if.h,v 1.21 2001/01/19 06:37:36 itojun Exp $ */ +/* $OpenBSD: if.h,v 1.22 2001/02/06 00:22:22 mickey Exp $ */ /* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */ /* @@ -405,9 +405,7 @@ do { \ struct ifnet_head ifnet; struct ifnet **ifindex2ifnet; -#if 0 -struct ifnet loif[]; -#endif +struct ifnet *lo0ifp; int if_index; void ether_ifattach __P((struct ifnet *)); diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index c902c6f6692..517b0d21611 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_loop.c,v 1.15 2001/01/19 06:37:36 itojun Exp $ */ +/* $OpenBSD: if_loop.c,v 1.16 2001/02/06 00:22:21 mickey Exp $ */ /* $NetBSD: if_loop.c,v 1.15 1996/05/07 02:40:33 thorpej Exp $ */ /* @@ -82,7 +82,6 @@ didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>. */ #include "bpfilter.h" -#include "loop.h" #include <sys/param.h> #include <sys/systm.h> @@ -146,8 +145,6 @@ didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>. #define LOMTU (32768 + MHLEN + MLEN) #endif -struct ifnet loif[NLOOP]; - void loopattach(n) int n; @@ -155,8 +152,12 @@ loopattach(n) register int i; register struct ifnet *ifp; - for (i = NLOOP; i--; ) { - ifp = &loif[i]; + for (i = n; i--; ) { + MALLOC(ifp, struct ifnet *, sizeof(*ifp), M_DEVBUF, M_NOWAIT); + if (ifp == NULL) + return; + if (i == 0) + lo0ifp = ifp; sprintf(ifp->if_xname, "lo%d", i); ifp->if_softc = NULL; ifp->if_mtu = LOMTU; diff --git a/sys/net/net_osdep.h b/sys/net/net_osdep.h index 72e7ed9a470..36096a092a9 100644 --- a/sys/net/net_osdep.h +++ b/sys/net/net_osdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: net_osdep.h,v 1.2 2000/08/19 09:17:35 itojun Exp $ */ +/* $OpenBSD: net_osdep.h,v 1.3 2001/02/06 00:22:22 mickey Exp $ */ /* $KAME: net_osdep.h,v 1.23 2000/08/19 00:58:11 itojun Exp $ */ /* @@ -125,7 +125,8 @@ * - struct ifnet for loopback interface * BSDI3: struct ifnet loif; * BSDI4: struct ifnet *loifp; - * NetBSD, OpenBSD, FreeBSD2: struct ifnet loif[NLOOP]; + * NetBSD, FreeBSD2: struct ifnet loif[NLOOP]; + * OpenBSD: lo0ifp * * odd thing is that many of them refers loif as ifnet *loif, * not loif[NLOOP], from outside of if_loop.c. |