diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 1999-12-09 00:34:14 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 1999-12-09 00:34:14 +0000 |
commit | ba67610d6d950b7d16e8c9031dc4007bcf40d9d8 (patch) | |
tree | 726a43ae2436a395c5fde9217377ef0a47fe7637 /sys | |
parent | b468bf327b3d7890d3b2a09ff83f4307cd0b1856 (diff) |
Shrink...
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet6/ip6_input.c | 142 |
1 files changed, 6 insertions, 136 deletions
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 9573ae2def9..2cb6db0c6a9 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.1 1999/12/08 06:50:21 itojun Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.2 1999/12/09 00:34:13 angelos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -64,16 +64,6 @@ * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 */ -#ifdef __FreeBSD__ -#include "opt_ip6fw.h" -#endif -#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__NetBSD__) -#include "opt_inet.h" -#ifdef __NetBSD__ /*XXX*/ -#include "opt_ipsec.h" -#endif -#endif - #include <sys/param.h> #include <sys/systm.h> #include <sys/malloc.h> @@ -86,9 +76,7 @@ #include <sys/time.h> #include <sys/kernel.h> #include <sys/syslog.h> -#if !defined(__bsdi__) && !(defined(__FreeBSD__) && __FreeBSD__ < 3) #include <sys/proc.h> -#endif #include <net/if.h> #include <net/if_types.h> @@ -98,18 +86,16 @@ #include <netinet/in.h> #include <netinet/in_systm.h> + #ifdef INET #include <netinet/ip.h> #include <netinet/ip_icmp.h> #endif /*INET*/ -#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802) + #include <netinet/in_pcb.h> -#endif #include <netinet6/in6_var.h> #include <netinet6/ip6.h> -#if !((defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802)) #include <netinet6/in6_pcb.h> -#endif #include <netinet6/ip6_var.h> #include <netinet6/icmp6.h> #include <netinet6/in6_ifattach.h> @@ -123,38 +109,22 @@ #include <netinet6/ip6protosw.h> /* we need it for NLOOP. */ -#ifndef __bsdi__ #include "loop.h" -#endif #include "faith.h" - #include "gif.h" #include "bpfilter.h" #include <net/net_osdep.h> -#ifdef __OpenBSD__ /*KAME IPSEC*/ -#undef IPSEC -#endif - extern struct domain inet6domain; extern struct ip6protosw inet6sw[]; -#ifdef __bsdi__ -#if _BSDI_VERSION < 199802 -extern struct ifnet loif; -#else -extern struct ifnet *loifp; -#endif -#endif u_char ip6_protox[IPPROTO_MAX]; static int ip6qmaxlen = IFQ_MAXLEN; struct in6_ifaddr *in6_ifaddr; struct ifqueue ip6intrq; -#if defined(__NetBSD__) || defined(__OpenBSD__) extern struct ifnet loif[NLOOP]; -#endif int ip6_forward_srcrt; /* XXX */ int ip6_sourcecheck; /* XXX */ int ip6_sourcecheck_interval; /* XXX */ @@ -212,22 +182,14 @@ ip6_init() microtime(&tv); ip6_flow_seq = random() ^ tv.tv_usec; -#ifndef __FreeBSD__ ip6_init2((void *)0); -#endif } static void ip6_init2(dummy) void *dummy; { -#ifndef __bsdi__ - int i; -#endif - int ret; -#if defined(__bsdi__) && _BSDI_VERSION < 199802 - struct ifnet *loifp = &loif; -#endif + int i, ret; /* get EUI64 from somewhere */ ret = in6_ifattach_getifid(NULL); @@ -236,12 +198,8 @@ ip6_init2(dummy) * to route local address of p2p link to loopback, * assign loopback address first. */ -#ifdef __bsdi__ - in6_ifattach(loifp, IN6_IFT_LOOP, NULL, 0); -#else for (i = 0; i < NLOOP; i++) in6_ifattach(&loif[i], IN6_IFT_LOOP, NULL, 0); -#endif /* nd6_timer_init */ timeout(nd6_timer, (caddr_t)0, hz); @@ -249,11 +207,6 @@ ip6_init2(dummy) timeout(in6_rr_timer, (caddr_t)0, hz); } -#ifdef __FreeBSD__ -/* cheat */ -SYSINIT(netinet6init2, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, ip6_init2, NULL); -#endif - /* * IP6 input interrupt handling. Just pass the packet to ip6_input. */ @@ -273,10 +226,6 @@ ip6intr() } } -#ifdef __FreeBSD__ -NETISR_SET(NETISR_IPV6, ip6intr); -#endif - extern struct route_in6 ip6_forward_rt; void @@ -289,11 +238,8 @@ ip6_input(m) u_int32_t rtalert = ~0; int nxt, ours = 0; struct ifnet *deliverifp = NULL; -#if defined(__bsdi__) && _BSDI_VERSION < 199802 - struct ifnet *loifp = &loif; -#endif -#ifdef IPSEC +#if 0 /* IPSEC */ /* * should the inner packet be considered authentic? * see comment in ah4_input(). @@ -315,11 +261,7 @@ ip6_input(m) } else { if (m->m_next) { if (m->m_flags & M_LOOP) { -#ifdef __bsdi__ - ip6stat.ip6s_m2m[loifp->if_index]++; /*XXX*/ -#else ip6stat.ip6s_m2m[loif[0].if_index]++; /*XXX*/ -#endif } else if (m->m_pkthdr.rcvif->if_index <= 31) ip6stat.ip6s_m2m[m->m_pkthdr.rcvif->if_index]++; @@ -476,11 +418,7 @@ ip6_input(m) ip6_forward_rt.ro_dst.sin6_family = AF_INET6; ip6_forward_rt.ro_dst.sin6_addr = ip6->ip6_dst; -#ifdef __FreeBSD__ - rtalloc_ign((struct route *)&ip6_forward_rt, RTF_PRCLONING); -#else rtalloc((struct route *)&ip6_forward_rt); -#endif } #define rt6_key(r) ((struct sockaddr_in6 *)((r)->rt_nodes->rn_key)) @@ -660,15 +598,6 @@ ip6_input(m) /* * Tell launch routine the next header */ -#if defined(__NetBSD__) && defined(IFA_STATS) - if (IFA_STATS && deliverifp != NULL) { - struct in6_ifaddr *ia6; - ip6 = mtod(m, struct ip6_hdr *); - ia6 = in6_ifawithifp(deliverifp, &ip6->ip6_dst); - if (ia6) - ia6->ia_ifa.ifa_data.ifad_inbytes += m->m_pkthdr.len; - } -#endif ip6stat.ip6s_delivered++; in6_ifstat_inc(deliverifp, ifs6_in_deliver); nest = 0; @@ -919,39 +848,16 @@ ip6_unknown_opt(optp, m, off) */ void ip6_savecontrol(in6p, mp, ip6, m) -#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(HAVE_NRL_INPCB) register struct inpcb *in6p; -#else - register struct in6pcb *in6p; -#endif register struct mbuf **mp; register struct ip6_hdr *ip6; register struct mbuf *m; { -#ifdef HAVE_NRL_INPCB # define in6p_flags inp_flags -#endif -#if defined(__NetBSD__) || (defined(__FreeBSD__) && __FreeBSD__ >= 3) - struct proc *p = curproc; /* XXX */ -#endif -#ifdef __bsdi__ -# define sbcreatecontrol so_cmsg -#endif - int privileged; + int privileged = 0; - privileged = 0; -#if defined(__NetBSD__) || (defined(__FreeBSD__) && __FreeBSD__ >= 3) - if (p && !suser(p->p_ucred, &p->p_acflag)) - privileged++; -#else -#ifdef HAVE_NRL_INPCB if ((in6p->inp_socket->so_state & SS_PRIV) != 0) privileged++; -#else - if ((in6p->in6p_socket->so_state & SS_PRIV) != 0) - privileged++; -#endif -#endif #ifdef SO_TIMESTAMP if (in6p->in6p_socket->so_options & SO_TIMESTAMP) { @@ -1155,13 +1061,7 @@ ip6_savecontrol(in6p, mp, ip6, m) /* to be done */ } /* IN6P_RTHDR - to be done */ - -#ifdef __bsdi__ -# undef sbcreatecontrol -#endif -#ifdef __OpenBSD__ # undef in6p_flags -#endif } /* @@ -1227,7 +1127,6 @@ u_char inet6ctlerrmap[PRC_NCMDS] = { ENOPROTOOPT }; -#if defined(__NetBSD__) || defined(__OpenBSD__) #include <vm/vm.h> #include <sys/sysctl.h> @@ -1289,32 +1188,3 @@ ip6_sysctl(name, namelen, oldp, oldlenp, newp, newlen) } /* NOTREACHED */ } -#endif /* __NetBSD__ || __OpenBSD__ */ - -#ifdef __bsdi__ -int *ip6_sysvars[] = IPV6CTL_VARS; - -int -ip6_sysctl(name, namelen, oldp, oldlenp, newp, newlen) - int *name; - u_int namelen; - void *oldp; - size_t *oldlenp; - void *newp; - size_t newlen; -{ - if (name[0] >= IPV6CTL_MAXID) - return (EOPNOTSUPP); - - switch (name[0]) { - case IPV6CTL_STATS: - return sysctl_rdtrunc(oldp, oldlenp, newp, &ip6stat, - sizeof(ip6stat)); - case IPV6CTL_KAME_VERSION: - return sysctl_rdstring(oldp, oldlenp, newp, __KAME_VERSION); - default: - return (sysctl_int_arr(ip6_sysvars, name, namelen, - oldp, oldlenp, newp, newlen)); - } -} -#endif /* __bsdi__ */ |