diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/conf/files | 4 | ||||
-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 | ||||
-rw-r--r-- | sys/netinet/if_ether.c | 7 | ||||
-rw-r--r-- | sys/netinet6/in6_src.c | 8 | ||||
-rw-r--r-- | sys/netinet6/ip6_input.c | 9 | ||||
-rw-r--r-- | sys/netinet6/ip6_output.c | 12 | ||||
-rw-r--r-- | sys/netinet6/nd6.c | 10 | ||||
-rw-r--r-- | sys/netiso/if_eon.c | 8 |
10 files changed, 31 insertions, 51 deletions
diff --git a/sys/conf/files b/sys/conf/files index 3542f66f692..ea34e0b1ad9 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $OpenBSD: files,v 1.184 2001/01/24 09:38:02 hugh Exp $ +# $OpenBSD: files,v 1.185 2001/02/06 00:22:14 mickey Exp $ # $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 @@ -499,7 +499,7 @@ file net/if_atmsubr.c atm needs-flag file net/if_ethersubr.c ether | fddi | token needs-flag file net/if_fddisubr.c fddi file net/if_spppsubr.c sppp -file net/if_loop.c loop needs-count +file net/if_loop.c loop file net/if_media.c ifmedia file net/if_sl.c sl needs-count file net/if_strip.c strip needs-count 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. diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c index b4bd2f55e9f..e13c12aec00 100644 --- a/sys/netinet/if_ether.c +++ b/sys/netinet/if_ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.c,v 1.27 2001/02/05 15:22:11 jason Exp $ */ +/* $OpenBSD: if_ether.c,v 1.28 2001/02/06 00:22:24 mickey Exp $ */ /* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */ /* @@ -87,7 +87,6 @@ void arptimer __P((void *)); static struct llinfo_arp *arplookup __P((u_int32_t, int, int)); static void in_arpinput __P((struct mbuf *)); -extern struct ifnet loif; LIST_HEAD(, llinfo_arp) llinfo_arp; struct ifqueue arpintrq = {0, 0, 0, 50}; int arp_inuse, arp_allocated, arp_intimer; @@ -228,7 +227,7 @@ arp_rtrequest(req, rt, info) (IA_SIN(rt->rt_ifa))->sin_addr.s_addr) { /* * This test used to be - * if (loif.if_flags & IFF_UP) + * if (lo0ifp->if_flags & IFF_UP) * It allowed local traffic to be forced through * the hardware by configuring the loopback down. * However, it causes problems during network @@ -242,7 +241,7 @@ arp_rtrequest(req, rt, info) LLADDR(SDL(gate)), SDL(gate)->sdl_alen = ETHER_ADDR_LEN); if (useloopback) - rt->rt_ifp = &loif; + rt->rt_ifp = lo0ifp; } break; diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index 07c9870e04e..061878abe12 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_src.c,v 1.8 2000/06/21 09:07:24 itojun Exp $ */ +/* $OpenBSD: in6_src.c,v 1.9 2001/02/06 00:22:23 mickey Exp $ */ /* $KAME: in6_src.c,v 1.27 2000/06/21 08:07:13 itojun Exp $ */ /* @@ -90,10 +90,6 @@ #include <netinet6/ip6_var.h> #include <netinet6/nd6.h> -#include "loop.h" - -extern struct ifnet loif[NLOOP]; - /* * Return an IPv6 address, which is the most appropriate for given * destination and user specified options. @@ -189,7 +185,7 @@ in6_selectsrc(dstsock, opts, mopts, ro, laddr, errorp) struct ifnet *ifp = mopts ? mopts->im6o_multicast_ifp : NULL; if (ifp == NULL && IN6_IS_ADDR_MC_NODELOCAL(dst)) { - ifp = &loif[0]; + ifp = lo0ifp; } if (ifp) { diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index ac391f0a60c..4cc9d3424bd 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.19 2000/08/31 08:39:56 itojun Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.20 2001/02/06 00:22:23 mickey Exp $ */ /* $KAME: ip6_input.c,v 1.121 2000/08/31 06:07:29 itojun Exp $ */ /* @@ -108,8 +108,6 @@ #include <netinet6/ip6protosw.h> -/* we need it for NLOOP. */ -#include "loop.h" #include "faith.h" #include "gif.h" #include "bpfilter.h" @@ -124,7 +122,6 @@ static int ip6qmaxlen = IFQ_MAXLEN; struct in6_ifaddr *in6_ifaddr; struct ifqueue ip6intrq; -extern struct ifnet loif[NLOOP]; int ip6_forward_srcrt; /* XXX */ int ip6_sourcecheck; /* XXX */ int ip6_sourcecheck_interval; /* XXX */ @@ -184,7 +181,7 @@ ip6_init2(dummy) * to route local address of p2p link to loopback, * assign loopback address first. */ - in6_ifattach(&loif[0], NULL); + in6_ifattach(lo0ifp, NULL); #else /* you MUST bring lo0 up manually, in rc script. */ #endif @@ -267,7 +264,7 @@ ip6_input(m) } else { if (m->m_next) { if (m->m_flags & M_LOOP) { - ip6stat.ip6s_m2m[loif[0].if_index]++; /*XXX*/ + ip6stat.ip6s_m2m[lo0ifp->if_index]++; /*XXX*/ } else if (m->m_pkthdr.rcvif->if_index <= 31) ip6stat.ip6s_m2m[m->m_pkthdr.rcvif->if_index]++; else diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 9c6b0cc2af3..c1bf5a43748 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_output.c,v 1.18 2001/02/02 15:55:18 itojun Exp $ */ +/* $OpenBSD: ip6_output.c,v 1.19 2001/02/06 00:22:23 mickey Exp $ */ /* $KAME: ip6_output.c,v 1.152 2001/02/02 15:36:33 jinmei Exp $ */ /* @@ -103,8 +103,6 @@ extern int ipsec_esp_trans_default_level; extern int ipsec_esp_network_default_level; #endif /* IPSEC */ -#include "loop.h" - #include <net/net_osdep.h> #ifdef IPV6FIREWALL @@ -128,8 +126,6 @@ static int ip6_insertfraghdr __P((struct mbuf *, struct mbuf *, int, struct ip6_frag **)); static int ip6_insert_jumboopt __P((struct ip6_exthdrs *, u_int32_t)); static int ip6_splithdr __P((struct mbuf *, struct ip6_exthdrs *)); -extern struct ifnet *loifp; -extern struct ifnet loif[NLOOP]; /* * IP6 output. The packet in mbuf chain m contains a skeletal IP6 @@ -693,7 +689,7 @@ skip_ipsec2:; goto bad; } else { - ifp = &loif[0]; + ifp = lo0ifp; } } @@ -1936,7 +1932,7 @@ ip6_setmoptions(optname, im6op, m) * XXX: is it a good approach? */ if (IN6_IS_ADDR_MC_NODELOCAL(&mreq->ipv6mr_multiaddr)) { - ifp = &loif[0]; + ifp = lo0ifp; } else { ro.ro_rt = NULL; @@ -2318,7 +2314,7 @@ ip6_setpktoptions(control, opt, priv) * Routine called from ip6_output() to loop back a copy of an IP6 multicast * packet to the input queue of a specified interface. Note that this * calls the output routine of the loopback "driver", but with an interface - * pointer that might NOT be &loif -- easier than replicating that code here. + * pointer that might NOT be lo0ifp -- easier than replicating that code here. */ void ip6_mloopback(ifp, m, dst) diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 1ea4937f690..230902af6ab 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.c,v 1.20 2001/01/19 06:37:38 itojun Exp $ */ +/* $OpenBSD: nd6.c,v 1.21 2001/02/06 00:22:23 mickey Exp $ */ /* $KAME: nd6.c,v 1.75 2000/10/15 15:23:11 itojun Exp $ */ /* @@ -69,10 +69,6 @@ #include <netinet6/in6_prefix.h> #include <netinet/icmp6.h> -#include "loop.h" - -extern struct ifnet loif[NLOOP]; - #include <net/net_osdep.h> #define ND6_SLOWTIMER_INTERVAL (60 * 60) /* 1 hour */ @@ -1162,7 +1158,7 @@ nd6_rtrequest(req, rt, info) SDL(gate)->sdl_alen = ifp->if_addrlen; } if (nd6_useloopback) { - rt->rt_ifp = &loif[0]; /*XXX*/ + rt->rt_ifp = lo0ifp; /*XXX*/ /* * Make sure rt_ifa be equal to the ifaddr * corresponding to the address. @@ -1286,7 +1282,7 @@ nd6_p2p_rtrequest(req, rt, info) &SIN6(rt_key(rt))->sin6_addr); if (ifa) { if (nd6_useloopback) { - rt->rt_ifp = &loif[0]; /*XXX*/ + rt->rt_ifp = lo0ifp; /*XXX*/ } } break; diff --git a/sys/netiso/if_eon.c b/sys/netiso/if_eon.c index 1d6a16a1fde..79dca64acb5 100644 --- a/sys/netiso/if_eon.c +++ b/sys/netiso/if_eon.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_eon.c,v 1.8 2001/01/19 06:37:38 itojun Exp $ */ +/* $OpenBSD: if_eon.c,v 1.9 2001/02/06 00:22:25 mickey Exp $ */ /* $NetBSD: if_eon.c,v 1.15 1996/05/09 22:29:37 scottr Exp $ */ /*- @@ -109,10 +109,6 @@ SOFTWARE. #include <machine/stdarg.h> -#include "loop.h" - -extern struct ifnet loif[NLOOP]; - extern struct timeval time; #define EOK 0 @@ -299,7 +295,7 @@ eonrtrequest(cmd, rt, info) case RTM_ADD: case RTM_RESOLVE: - rt->rt_rmx.rmx_mtu = loif[0].if_mtu; /* unless better below */ + rt->rt_rmx.rmx_mtu = lo0ifp->if_mtu; /* unless better below */ R_Malloc(el, struct eon_llinfo *, sizeof(*el)); rt->rt_llinfo = (caddr_t) el; if (el == 0) |