summaryrefslogtreecommitdiff
path: root/sys/netinet6
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>1999-12-10 10:04:30 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>1999-12-10 10:04:30 +0000
commitcc70c02ab229784e5e0814387fc6294170f7c37b (patch)
tree1f054770db8e7017128a8bfb17b0637656d0167d /sys/netinet6
parent636726dd009587b6eac2d2a13e959eaf397bad57 (diff)
Remove remaining unnecessary ifdefs (itojun will hate me for this :-)
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/dest6.c5
-rw-r--r--sys/netinet6/frag6.c20
-rw-r--r--sys/netinet6/icmp6.c342
-rw-r--r--sys/netinet6/icmp6.h8
-rw-r--r--sys/netinet6/in6_gif.c16
-rw-r--r--sys/netinet6/in6_ifattach.c90
-rw-r--r--sys/netinet6/in6_prefix.c57
-rw-r--r--sys/netinet6/in6_proto.c345
-rw-r--r--sys/netinet6/in6_src.c38
-rw-r--r--sys/netinet6/in6_var.h86
-rw-r--r--sys/netinet6/ip6_forward.c24
-rw-r--r--sys/netinet6/ip6_mroute.c187
-rw-r--r--sys/netinet6/ip6_mroute.h7
-rw-r--r--sys/netinet6/ip6_output.c430
-rw-r--r--sys/netinet6/ip6_var.h32
-rw-r--r--sys/netinet6/ip6protosw.h23
-rw-r--r--sys/netinet6/mld6.c41
-rw-r--r--sys/netinet6/nd6.c151
-rw-r--r--sys/netinet6/nd6_nbr.c67
-rw-r--r--sys/netinet6/nd6_rtr.c75
-rw-r--r--sys/netinet6/raw_ipv6.c12
21 files changed, 77 insertions, 1979 deletions
diff --git a/sys/netinet6/dest6.c b/sys/netinet6/dest6.c
index 5ed163e8bfe..11ec60b0f6e 100644
--- a/sys/netinet6/dest6.c
+++ b/sys/netinet6/dest6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dest6.c,v 1.1 1999/12/08 06:50:20 itojun Exp $ */
+/* $OpenBSD: dest6.c,v 1.2 1999/12/10 10:04:27 angelos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -46,9 +46,6 @@
#include <netinet/in.h>
#include <netinet/in_var.h>
#include <netinet6/ip6.h>
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(__OpenBSD__)
-#include <netinet6/in6_pcb.h>
-#endif
#include <netinet6/ip6_var.h>
#include <netinet6/icmp6.h>
diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c
index bf0612d9bef..d107932d352 100644
--- a/sys/netinet6/frag6.c
+++ b/sys/netinet6/frag6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: frag6.c,v 1.1 1999/12/08 06:50:20 itojun Exp $ */
+/* $OpenBSD: frag6.c,v 1.2 1999/12/10 10:04:27 angelos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -47,9 +47,6 @@
#include <netinet/in.h>
#include <netinet/in_var.h>
#include <netinet6/ip6.h>
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(__OpenBSD__)
-#include <netinet6/in6_pcb.h>
-#endif
#include <netinet6/ip6_var.h>
#include <netinet6/icmp6.h>
@@ -72,11 +69,6 @@ int frag6_doing_reass;
u_int frag6_nfragpackets;
struct ip6q ip6q; /* ip6 reassemble queue */
-/* FreeBSD tweak */
-#if !defined(M_FTABLE) && (defined(__FreeBSD__) && __FreeBSD__ >= 3)
-MALLOC_DEFINE(M_FTABLE, "fragment", "fragment reassembly header");
-#endif
-
/*
* Initialise reassembly queue and fragment identifier.
*/
@@ -142,11 +134,9 @@ frag6_input(mp, offp, proto)
dst->sin6_len = sizeof(struct sockaddr_in6);
dst->sin6_addr = ip6->ip6_dst;
}
-#if defined(__NetBSD__) || defined(__OpenBSD__)
+
rtalloc((struct route *)&ro);
-#else
- rtcalloc((struct route *)&ro);
-#endif
+
if (ro.ro_rt != NULL && ro.ro_rt->rt_ifa != NULL)
dstifp = ((struct in6_ifaddr *)ro.ro_rt->rt_ifa)->ia_ifp;
#else
@@ -600,11 +590,7 @@ void
frag6_slowtimo()
{
struct ip6q *q6;
-#ifdef __NetBSD__
- int s = splsoftnet();
-#else
int s = splnet();
-#endif
#if 0
extern struct route_in6 ip6_forward_rt;
#endif
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index 240364aad83..7bee3516f95 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp6.c,v 1.1 1999/12/08 06:50:20 itojun Exp $ */
+/* $OpenBSD: icmp6.c,v 1.2 1999/12/10 10:04:27 angelos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -64,13 +64,6 @@
* @(#)ip_icmp.c 8.2 (Berkeley) 1/4/94
*/
-#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>
@@ -90,32 +83,18 @@
#include <netinet/in.h>
#include <netinet/in_var.h>
-#ifdef __OpenBSD__
#include <netinet/in_systm.h>
#include <netinet/ip.h>
-#endif
#include <netinet6/ip6.h>
#include <netinet6/ip6_var.h>
#include <netinet6/icmp6.h>
#include <netinet6/mld6_var.h>
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(__OpenBSD__)
-#include <netinet6/in6_pcb.h>
-#else
#include <netinet/in_pcb.h>
-#endif
#include <netinet6/nd6.h>
#include <netinet6/in6_ifattach.h>
#include <netinet6/ip6protosw.h>
-#ifdef __OpenBSD__ /*KAME IPSEC*/
#undef IPSEC
-#endif
-
-#ifdef IPSEC
-#include <netinet6/ipsec.h>
-#include <netkey/key.h>
-#include <netkey/key_debug.h>
-#endif
#include "faith.h"
@@ -127,20 +106,11 @@ extern u_char ip6_protox[];
struct icmp6stat icmp6stat;
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
extern struct in6pcb rawin6pcb;
-#else
-extern struct inpcbhead ripcb;
-#endif
extern u_int icmp6errratelim;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
static struct rttimer_queue *icmp6_mtudisc_timeout_q = NULL;
extern int pmtu_expire;
-#endif
-#ifndef HAVE_NRL_INPCB
-static int icmp6_rip6_input __P((struct mbuf **, int));
-#endif
static int icmp6_ratelimit __P((const struct in6_addr *, const int, const int));
static const char *icmp6_redirect_diag __P((struct in6_addr *,
struct in6_addr *, struct in6_addr *));
@@ -149,10 +119,8 @@ static int ni6_addrs __P((struct icmp6_nodeinfo *, struct mbuf *,
struct ifnet **));
static int ni6_store_addrs __P((struct icmp6_nodeinfo *, struct icmp6_nodeinfo *,
struct ifnet *, int));
-#if defined(__NetBSD__) || defined(__OpenBSD__)
static struct rtentry *icmp6_mtudisc_clone __P((struct sockaddr *));
static void icmp6_mtudisc_timeout __P((struct rtentry *, struct rttimer *));
-#endif
#ifdef COMPAT_RFC1885
static struct route_in6 icmp6_reflect_rt;
@@ -163,9 +131,7 @@ void
icmp6_init()
{
mld6_init();
-#if defined(__NetBSD__) || defined(__OpenBSD__)
icmp6_mtudisc_timeout_q = rt_timer_queue_create(pmtu_expire);
-#endif
}
/*
@@ -184,11 +150,6 @@ icmp6_error(m, type, code, param)
icmp6stat.icp6s_error++;
-#ifdef M_DECRYPTED /*not openbsd*/
- if (m->m_flags & M_DECRYPTED)
- goto freeit;
-#endif
-
#ifndef PULLDOWN_TEST
IP6_EXTHDR_CHECK(m, 0, sizeof(struct ip6_hdr), );
#else
@@ -459,9 +420,6 @@ icmp6_input(mp, offp, proto)
u_int mtu = ntohl(icmp6->icmp6_mtu);
struct rtentry *rt = NULL;
struct sockaddr_in6 sin6;
-#ifdef __bsdi__
- struct route_in6 ro6;
-#endif
if (icmp6len < sizeof(struct icmp6_hdr) + sizeof(struct ip6_hdr)) {
icmp6stat.icp6s_tooshort++;
@@ -485,24 +443,12 @@ icmp6_input(mp, offp, proto)
sin6.sin6_family = PF_INET6;
sin6.sin6_len = sizeof(struct sockaddr_in6);
sin6.sin6_addr = ((struct ip6_hdr *)(icmp6 + 1))->ip6_dst;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
rt = rtalloc1((struct sockaddr *)&sin6, 1); /*clone*/
if (!rt || (rt->rt_flags & RTF_HOST) == 0) {
if (rt)
RTFREE(rt);
rt = icmp6_mtudisc_clone((struct sockaddr *)&sin6);
}
-#endif
-#ifdef __FreeBSD__
- rt = rtalloc1((struct sockaddr *)&sin6, 0,
- RTF_CLONING | RTF_PRCLONING);
-#endif /*__FreeBSD__*/
-#ifdef __bsdi__
- bcopy(&sin6, &ro6.ro_dst, sizeof(struct sockaddr_in6));
- ro6.ro_rt = 0;
- rtcalloc((struct route *)&ro6);
- rt = ro6.ro_rt;
-#endif /*__bsdi__*/
if (rt && (rt->rt_flags & RTF_HOST)
&& !(rt->rt_rmx.rmx_locks & RTV_MTU)) {
@@ -649,9 +595,6 @@ icmp6_input(mp, offp, proto)
else
goto badlen;
-#ifdef __FreeBSD__
-#define hostnamelen strlen(hostname)
-#endif
if (mode == FQDN) {
IP6_EXTHDR_CHECK(m, off, sizeof(struct icmp6_nodeinfo),
IPPROTO_DONE);
@@ -874,11 +817,7 @@ icmp6_input(mp, offp, proto)
}
passit:
-#ifdef HAVE_NRL_INPCB
rip6_input(&m, offp, IPPROTO_ICMPV6);
-#else
- icmp6_rip6_input(&m, *offp);
-#endif
return IPPROTO_DONE;
freeit:
@@ -889,9 +828,6 @@ icmp6_input(mp, offp, proto)
/*
* Process a Node Information Query
*/
-#ifdef __FreeBSD__
-#define hostnamelen strlen(hostname)
-#endif
#ifndef offsetof /* XXX */
#define offsetof(type, member) ((size_t)(&((type *)0)->member))
#endif
@@ -1044,19 +980,11 @@ ni6_addrs(ni6, m, ifpp)
struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
int addrs = 0, addrsofif, iffound = 0;
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
- for (ifp = ifnet; ifp; ifp = ifp->if_next)
-#else
for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list))
-#endif
{
addrsofif = 0;
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
- for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next)
-#else
for (ifa = ifp->if_addrlist.tqh_first; ifa;
ifa = ifa->ifa_list.tqe_next)
-#endif
{
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
@@ -1110,11 +1038,7 @@ ni6_store_addrs(ni6, nni6, ifp0, resid)
struct ifnet *ifp0;
int resid;
{
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
- register struct ifnet *ifp = ifp0 ? ifp0 : ifnet;
-#else
register struct ifnet *ifp = ifp0 ? ifp0 : TAILQ_FIRST(&ifnet);
-#endif
register struct in6_ifaddr *ifa6;
register struct ifaddr *ifa;
int docopy, copied = 0;
@@ -1123,18 +1047,10 @@ ni6_store_addrs(ni6, nni6, ifp0, resid)
if (ifp0 == NULL && !(ni6->ni_flags & NI_NODEADDR_FLAG_ALL))
return(0); /* needless to copy */
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
- for (; ifp; ifp = ifp->if_next)
-#else
for (; ifp; ifp = TAILQ_NEXT(ifp, if_list))
-#endif
{
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
- for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next)
-#else
for (ifa = ifp->if_addrlist.tqh_first; ifa;
ifa = ifa->ifa_list.tqe_next)
-#endif
{
docopy = 0;
@@ -1201,104 +1117,6 @@ ni6_store_addrs(ni6, nni6, ifp0, resid)
return(copied);
}
-#ifndef HAVE_NRL_INPCB
-/*
- * XXX almost dup'ed code with rip6_input.
- */
-static int
-icmp6_rip6_input(mp, off)
- struct mbuf **mp;
- int off;
-{
- struct mbuf *m = *mp;
- register struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
- register struct in6pcb *in6p;
- struct in6pcb *last = NULL;
- struct sockaddr_in6 rip6src;
- struct icmp6_hdr *icmp6;
- struct mbuf *opts = NULL;
-
- /* this is assumed to be safe. */
- icmp6 = (struct icmp6_hdr *)((caddr_t)ip6 + off);
-
- bzero(&rip6src, sizeof(rip6src));
- rip6src.sin6_len = sizeof(struct sockaddr_in6);
- rip6src.sin6_family = AF_INET6;
- rip6src.sin6_addr = ip6->ip6_src;
- if (IN6_IS_SCOPE_LINKLOCAL(&rip6src.sin6_addr))
- rip6src.sin6_addr.s6_addr16[1] = 0;
- if (m->m_pkthdr.rcvif) {
- if (IN6_IS_SCOPE_LINKLOCAL(&rip6src.sin6_addr))
- rip6src.sin6_scope_id = m->m_pkthdr.rcvif->if_index;
- else
- rip6src.sin6_scope_id = 0;
- } else
- rip6src.sin6_scope_id = 0;
-
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- LIST_FOREACH(in6p, &ripcb, inp_list)
-#else
- for (in6p = rawin6pcb.in6p_next;
- in6p != &rawin6pcb; in6p = in6p->in6p_next)
-#endif
- {
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- if ((in6p->inp_vflag & INP_IPV6) == NULL)
- continue;
-#endif
- if (in6p->in6p_ip6_nxt != IPPROTO_ICMPV6)
- continue;
- if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr) &&
- !IN6_ARE_ADDR_EQUAL(&in6p->in6p_laddr, &ip6->ip6_dst))
- continue;
- if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr) &&
- !IN6_ARE_ADDR_EQUAL(&in6p->in6p_faddr, &ip6->ip6_src))
- continue;
- if (in6p->in6p_icmp6filt
- && ICMP6_FILTER_WILLBLOCK(icmp6->icmp6_type,
- in6p->in6p_icmp6filt))
- continue;
- if (last) {
- struct mbuf *n;
- if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) {
- if (last->in6p_flags & IN6P_CONTROLOPTS)
- ip6_savecontrol(last, &opts, ip6, n);
- /* strip intermediate headers */
- m_adj(n, off);
- if (sbappendaddr(&last->in6p_socket->so_rcv,
- (struct sockaddr *)&rip6src,
- n, opts) == 0) {
- /* should notify about lost packet */
- m_freem(n);
- if (opts)
- m_freem(opts);
- } else
- sorwakeup(last->in6p_socket);
- opts = NULL;
- }
- }
- last = in6p;
- }
- if (last) {
- if (last->in6p_flags & IN6P_CONTROLOPTS)
- ip6_savecontrol(last, &opts, ip6, m);
- /* strip intermediate headers */
- m_adj(m, off);
- if (sbappendaddr(&last->in6p_socket->so_rcv,
- (struct sockaddr *)&rip6src, m, opts) == 0) {
- m_freem(m);
- if (opts)
- m_freem(opts);
- } else
- sorwakeup(last->in6p_socket);
- } else {
- m_freem(m);
- ip6stat.ip6s_delivered--;
- }
- return IPPROTO_DONE;
-}
-#endif /*OpenBSD*/
-
/*
* Reflect the ip6 packet back to the source.
* The caller MUST check if the destination is multicast or not.
@@ -1388,12 +1206,6 @@ icmp6_reflect(m, off)
if (icmp6_reflect_rt.ro_rt == 0 ||
! (IN6_ARE_ADDR_EQUAL(&sin6->sin6_addr, &ip6->ip6_dst))) {
if (icmp6_reflect_rt.ro_rt) {
-#ifdef __FreeBSD__
- RTFREE(icmp6_reflect_rt.ro_rt);
-#endif
-#ifdef __bsdi__
- rtfree(icmp6_reflect_rt.ro_rt);
-#endif
icmp6_reflect_rt.ro_rt = 0;
}
bzero(sin6, sizeof(*sin6));
@@ -1401,12 +1213,7 @@ icmp6_reflect(m, off)
sin6->sin6_len = sizeof(struct sockaddr_in6);
sin6->sin6_addr = ip6->ip6_dst;
-#ifdef __FreeBSD__
- rtalloc_ign((struct route *)&icmp6_reflect_rt.ro_rt,
- RTF_PRCLONING);
-#else
rtalloc((struct route *)&icmp6_reflect_rt.ro_rt);
-#endif
}
if (icmp6_reflect_rt.ro_rt == 0)
@@ -1502,13 +1309,8 @@ icmp6_redirect_diag(src6, dst6, tgt6)
struct in6_addr *tgt6;
{
static char buf[1024];
-#if !defined(__OpenBSD__) && !defined(__bsdi__)
snprintf(buf, sizeof(buf), "(src=%s dst=%s tgt=%s)",
- ip6_sprintf(src6), ip6_sprintf(dst6), ip6_sprintf(tgt6));
-#else
- sprintf(buf, "(src=%s dst=%s tgt=%s)",
- ip6_sprintf(src6), ip6_sprintf(dst6), ip6_sprintf(tgt6));
-#endif
+ ip6_sprintf(src6), ip6_sprintf(dst6), ip6_sprintf(tgt6));
return buf;
}
@@ -1570,11 +1372,7 @@ icmp6_redirect_input(m, off)
sin6.sin6_family = AF_INET6;
sin6.sin6_len = sizeof(struct sockaddr_in6);
bcopy(&reddst6, &sin6.sin6_addr, sizeof(reddst6));
- rt = rtalloc1((struct sockaddr *)&sin6, 0
-#ifdef __FreeBSD__
- , 0UL
-#endif
- );
+ rt = rtalloc1((struct sockaddr *)&sin6, 0);
if (rt) {
gw6 = &(((struct sockaddr_in6 *)rt->rt_gateway)->sin6_addr);
if (bcmp(&src6, gw6, sizeof(struct in6_addr)) != 0) {
@@ -1655,9 +1453,6 @@ icmp6_redirect_input(m, off)
struct sockaddr_in6 sdst;
struct sockaddr_in6 sgw;
struct sockaddr_in6 ssrc;
-#ifdef __bsdi__
- extern int icmp_redirtimeout; /*XXX*/
-#endif
bzero(&sdst, sizeof(sdst));
bzero(&sgw, sizeof(sgw));
@@ -1671,11 +1466,7 @@ icmp6_redirect_input(m, off)
rtredirect((struct sockaddr *)&sdst, (struct sockaddr *)&sgw,
(struct sockaddr *)NULL, RTF_GATEWAY | RTF_HOST,
(struct sockaddr *)&ssrc,
-#ifdef __bsdi__
- icmp_redirtimeout
-#else
(struct rtentry **)NULL
-#endif /*__FreeBSD__, __NetBSD__, __bsdi__*/
);
}
/* finally update cached route in each socket via pfctlinput */
@@ -1857,10 +1648,6 @@ nolladdropt:;
m->m_pkthdr.len = m->m_len = p - (u_char *)ip6;
/* just to be safe */
-#ifdef M_DECRYPTED /*not openbsd*/
- if (m0->m_flags & M_DECRYPTED)
- goto noredhdropt;
-#endif
{
/* redirected header option */
@@ -1931,9 +1718,6 @@ nolladdropt:;
m->m_next = m0;
m->m_pkthdr.len = m->m_len + m0->m_len;
}
-#ifdef M_DECRYPTED /*not openbsd*/
-noredhdropt:;
-#endif
if (IN6_IS_ADDR_LINKLOCAL(&sip6->ip6_src))
sip6->ip6_src.s6_addr16[1] = 0;
@@ -1980,47 +1764,22 @@ fail:
* ICMPv6 socket option processing.
*/
int
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-icmp6_ctloutput(so, sopt)
- struct socket *so;
- struct sockopt *sopt;
-#else
icmp6_ctloutput(op, so, level, optname, mp)
int op;
struct socket *so;
int level, optname;
struct mbuf **mp;
-#endif
{
int error = 0;
int optlen;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
register struct inpcb *inp = sotoinpcb(so);
- int level, op, optname;
-
- if (sopt) {
- level = sopt->sopt_level;
- op = sopt->sopt_dir;
- optname = sopt->sopt_name;
- optlen = sopt->sopt_valsize;
- } else
- level = op = optname = optlen = 0;
-#else
-#if defined(__OpenBSD__)
- register struct inpcb *inp = sotoinpcb(so);
-#else
- register struct in6pcb *in6p = sotoin6pcb(so);
-#endif
register struct mbuf *m = *mp;
optlen = m ? m->m_len : 0;
-#endif
if (level != IPPROTO_ICMPV6) {
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
if (op == PRCO_SETOPT && m)
(void)m_free(m);
-#endif
return EINVAL;
}
@@ -2035,14 +1794,6 @@ icmp6_ctloutput(op, so, level, optname, mp)
error = EMSGSIZE;
break;
}
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- if (inp->in6p_icmp6filt == NULL) {
- error = EINVAL;
- break;
- }
- error = sooptcopyin(sopt, inp->in6p_icmp6filt, optlen,
- optlen);
-#elif defined(__OpenBSD__)
p = mtod(m, struct icmp6_filter *);
if (!p || !inp->inp_icmp6filt) {
error = EINVAL;
@@ -2051,16 +1802,6 @@ icmp6_ctloutput(op, so, level, optname, mp)
bcopy(p, inp->inp_icmp6filt,
sizeof(struct icmp6_filter));
error = 0;
-#else
- p = mtod(m, struct icmp6_filter *);
- if (!p || !in6p->in6p_icmp6filt) {
- error = EINVAL;
- break;
- }
- bcopy(p, in6p->in6p_icmp6filt,
- sizeof(struct icmp6_filter));
- error = 0;
-#endif
break;
}
@@ -2068,24 +1809,12 @@ icmp6_ctloutput(op, so, level, optname, mp)
error = ENOPROTOOPT;
break;
}
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
- if (m)
- (void)m_freem(m);
-#endif
break;
case PRCO_GETOPT:
switch (optname) {
case ICMP6_FILTER:
{
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- if (inp->in6p_icmp6filt == NULL) {
- error = EINVAL;
- break;
- }
- error = sooptcopyout(sopt, inp->in6p_icmp6filt,
- sizeof(struct icmp6_filter));
-#elif defined(__OpenBSD__)
struct icmp6_filter *p;
p = mtod(m, struct icmp6_filter *);
@@ -2096,18 +1825,6 @@ icmp6_ctloutput(op, so, level, optname, mp)
bcopy(inp->inp_icmp6filt, p,
sizeof(struct icmp6_filter));
error = 0;
-#else
- struct icmp6_filter *p;
-
- p = mtod(m, struct icmp6_filter *);
- if (!p || !in6p->in6p_icmp6filt) {
- error = EINVAL;
- break;
- }
- bcopy(in6p->in6p_icmp6filt, p,
- sizeof(struct icmp6_filter));
- error = 0;
-#endif
break;
}
@@ -2142,12 +1859,7 @@ icmp6_ratelimit(dst, type, code)
if (!icmp6errratelim)
return 0;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- microtime(&tp);
- tp.tv_sec = time_second;
-#else
tp = time;
-#endif
if (tp.tv_sec < icmp6_nextsend.tv_sec
|| (tp.tv_sec == icmp6_nextsend.tv_sec
&& tp.tv_usec < icmp6_nextsend.tv_usec)) {
@@ -2166,7 +1878,6 @@ icmp6_ratelimit(dst, type, code)
return 0;
}
-#if defined(__NetBSD__) || defined(__OpenBSD__)
static struct rtentry *
icmp6_mtudisc_clone(dst)
struct sockaddr *dst;
@@ -2222,53 +1933,7 @@ icmp6_mtudisc_timeout(rt, r)
}
}
}
-#endif /*__NetBSD__ || __OpenBSD__*/
-
-#ifdef __bsdi__
-void
-icmp6_mtuexpire(rt, rtt)
- struct rtentry *rt;
- struct rttimer *rtt;
-{
- rt->rt_flags |= RTF_PROBEMTU;
- Free(rtt);
-}
-
-int *icmp6_sysvars[] = ICMPV6CTL_VARS;
-
-int
-icmp6_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] >= ICMPV6CTL_MAXID)
- return (EOPNOTSUPP);
- switch (name[0]) {
-#if 0
- ICMPV6CTL_ND6_PRUNE:
- ICMPV6CTL_ND6_DELAY:
- ICMPV6CTL_ND6_UMAXTRIES:
- ICMPV6CTL_ND6_MMAXTRIES:
- ICMPV6CTL_ND6_USELOOPBACK:
- ICMPV6CTL_ND6_PROXYALL:
- /* need to check the value. */
-#endif
- case ICMPV6CTL_STATS:
- return sysctl_rdtrunc(oldp, oldlenp, newp, &icmp6stat,
- sizeof(icmp6stat));
-
- default:
- return (sysctl_int_arr(icmp6_sysvars, name, namelen,
- oldp, oldlenp, newp, newlen));
- }
-}
-#endif /*__bsdi__*/
-#if defined(__NetBSD__) || defined(__OpenBSD__)
#include <vm/vm.h>
#include <sys/sysctl.h>
int
@@ -2317,4 +1982,3 @@ icmp6_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
}
/* NOTREACHED */
}
-#endif /* __NetBSD__ */
diff --git a/sys/netinet6/icmp6.h b/sys/netinet6/icmp6.h
index e5c4d5716da..03a1bc9b484 100644
--- a/sys/netinet6/icmp6.h
+++ b/sys/netinet6/icmp6.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: icmp6.h,v 1.1 1999/12/08 06:50:20 itojun Exp $ */
+/* $OpenBSD: icmp6.h,v 1.2 1999/12/10 10:04:27 angelos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -578,13 +578,7 @@ void icmp6_reflect __P((struct mbuf *, size_t));
void icmp6_prepare __P((struct mbuf *));
void icmp6_redirect_input __P((struct mbuf *, int));
void icmp6_redirect_output __P((struct mbuf *, struct rtentry *));
-#ifdef __bsdi__
int icmp6_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
-void icmp6_mtuexpire __P((struct rtentry *, struct rttimer *));
-#endif /*__bsdi__*/
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-int icmp6_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
-#endif
/* XXX: is this the right place for these macros? */
#define icmp6_ifstat_inc(ifp, tag) \
diff --git a/sys/netinet6/in6_gif.c b/sys/netinet6/in6_gif.c
index 54bef8d5282..8a77519b032 100644
--- a/sys/netinet6/in6_gif.c
+++ b/sys/netinet6/in6_gif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_gif.c,v 1.1 1999/12/08 06:50:21 itojun Exp $ */
+/* $OpenBSD: in6_gif.c,v 1.2 1999/12/10 10:04:27 angelos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -33,22 +33,13 @@
* in6_gif.c
*/
-#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/socket.h>
#include <sys/sockio.h>
#include <sys/mbuf.h>
#include <sys/errno.h>
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
#include <sys/ioctl.h>
-#endif
#include <sys/protosw.h>
#include <net/if.h>
@@ -207,11 +198,6 @@ in6_gif_output(ifp, family, m, rt)
#endif
}
-#ifdef IPSEC
-#ifndef __OpenBSD__ /*KAME IPSEC*/
- m->m_pkthdr.rcvif = NULL;
-#endif
-#endif /*IPSEC*/
return(ip6_output(m, 0, &sc->gif_ro6, 0, 0, NULL));
}
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c
index 5736bde4d88..fce5c9a8aad 100644
--- a/sys/netinet6/in6_ifattach.c
+++ b/sys/netinet6/in6_ifattach.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_ifattach.c,v 1.1 1999/12/08 06:50:21 itojun Exp $ */
+/* $OpenBSD: in6_ifattach.c,v 1.2 1999/12/10 10:04:27 angelos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -35,13 +35,7 @@
#include <sys/socket.h>
#include <sys/sockio.h>
#include <sys/kernel.h>
-#ifdef __bsdi__
-#include <crypto/md5.h>
-#elif defined(__OpenBSD__)
#include <sys/md5k.h>
-#else
-#include <sys/md5.h>
-#endif
#include <net/if.h>
#include <net/if_dl.h>
@@ -50,9 +44,7 @@
#include <netinet/in.h>
#include <netinet/in_var.h>
-#ifndef __NetBSD__
#include <netinet/if_ether.h>
-#endif
#include <netinet6/ip6.h>
#include <netinet6/ip6_var.h>
@@ -124,9 +116,6 @@ gen_rand_eui64(dst)
{
MD5_CTX ctxt;
u_int8_t digest[16];
-#ifdef __FreeBSD__
- int hostnamelen = strlen(hostname);
-#endif
/* generate 8bytes of pseudo-random value. */
bzero(&ctxt, sizeof(ctxt));
@@ -162,21 +151,13 @@ in6_ifattach_getifid(ifp0)
if (found_first_ifid)
return 0;
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
- for (ifp = ifnet; ifp; ifp = ifp->if_next)
-#else
for (ifp = ifnet.tqh_first; ifp; ifp = ifp->if_list.tqe_next)
-#endif
{
if (ifp0 != NULL && ifp0 != ifp)
continue;
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
- for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next)
-#else
for (ifa = ifp->if_addrlist.tqh_first;
ifa;
ifa = ifa->ifa_list.tqe_next)
-#endif
{
if (ifa->ifa_addr->sa_family != AF_LINK)
continue;
@@ -254,10 +235,6 @@ in6_ifattach(ifp, type, laddr, noloop)
struct sockaddr_in6 mltmask;
struct sockaddr_in6 gate;
struct sockaddr_in6 mask;
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
- struct ifaddr **ifap;
-#endif
-
struct in6_ifaddr *ia, *ib, *oia;
struct ifaddr *ifa;
int rtflag = 0;
@@ -340,19 +317,6 @@ in6_ifattach(ifp, type, laddr, noloop)
* cards multiple times.
* This is lengthy for P2P and LOOP but works.
*/
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
- ifa = ifp->if_addrlist;
- if (ifa != NULL) {
- for ( ; ifa; ifa = ifa->ifa_next) {
- ifap = &ifa->ifa_next;
- if (ifa->ifa_addr->sa_family != AF_INET6)
- continue;
- if (IN6_IS_ADDR_LINKLOCAL(&satosin6(ifa->ifa_addr)->sin6_addr))
- return;
- }
- } else
- ifap = &ifp->if_addrlist;
-#else
ifa = TAILQ_FIRST(&ifp->if_addrlist);
if (ifa != NULL) {
for ( ; ifa; ifa = TAILQ_NEXT(ifa, ifa_list)) {
@@ -364,7 +328,6 @@ in6_ifattach(ifp, type, laddr, noloop)
} else {
TAILQ_INIT(&ifp->if_addrlist);
}
-#endif
/*
* link-local address
@@ -375,11 +338,9 @@ in6_ifattach(ifp, type, laddr, noloop)
ia->ia_ifa.ifa_dstaddr = (struct sockaddr *)&ia->ia_dstaddr;
ia->ia_ifa.ifa_netmask = (struct sockaddr *)&ia->ia_prefixmask;
ia->ia_ifp = ifp;
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
- *ifap = (struct ifaddr *)ia;
-#else
+
TAILQ_INSERT_TAIL(&ifp->if_addrlist, (struct ifaddr *)ia, ifa_list);
-#endif
+
/*
* Also link into the IPv6 address chain beginning with in6_ifaddr.
* kazu opposed it, but itojun & jinmei wanted.
@@ -475,11 +436,7 @@ in6_ifattach(ifp, type, laddr, noloop)
}
/* undo changes */
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
- *ifap = NULL;
-#else
TAILQ_REMOVE(&ifp->if_addrlist, (struct ifaddr *)ia, ifa_list);
-#endif
if (oia)
oia->ia_next = ia->ia_next;
else
@@ -532,12 +489,8 @@ in6_ifattach(ifp, type, laddr, noloop)
ib->ia_ifp = ifp;
ia->ia_next = ib;
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
- ia->ia_ifa.ifa_next = (struct ifaddr *)ib;
-#else
TAILQ_INSERT_TAIL(&ifp->if_addrlist, (struct ifaddr *)ib,
ifa_list);
-#endif
ib->ia_prefixmask.sin6_len = sizeof(struct sockaddr_in6);
ib->ia_prefixmask.sin6_family = AF_INET6;
@@ -545,18 +498,6 @@ in6_ifattach(ifp, type, laddr, noloop)
ib->ia_addr.sin6_len = sizeof(struct sockaddr_in6);
ib->ia_addr.sin6_family = AF_INET6;
ib->ia_addr.sin6_addr = in6addr_loopback;
-#ifdef __bsdi__
- /*
- * It is necessary to set the loopback address to the dstaddr
- * field at least for BSDI. Without this setting, the BSDI
- * version of ifa_ifwithroute() rejects to add a route
- * to the loopback interface.
- */
- ib->ia_dstaddr.sin6_len = sizeof(struct sockaddr_in6);
- ib->ia_dstaddr.sin6_family = AF_INET6;
- ib->ia_dstaddr.sin6_addr = in6addr_loopback;
-#endif
-
ib->ia_ifa.ifa_metric = ifp->if_metric;
rtrequest(RTM_ADD,
@@ -575,10 +516,8 @@ in6_ifattach(ifp, type, laddr, noloop)
if (ifp->if_flags & IFF_MULTICAST) {
int error; /* not used */
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
/* Restore saved multicast addresses(if any). */
in6_restoremkludge(ia, ifp);
-#endif
bzero(&mltmask, sizeof(mltmask));
mltmask.sin6_len = sizeof(struct sockaddr_in6);
@@ -676,23 +615,13 @@ in6_ifdetach(ifp)
{
struct in6_ifaddr *ia, *oia;
struct ifaddr *ifa;
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
- struct ifaddr *ifaprev = NULL;
-#endif
struct rtentry *rt;
short rtflags;
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
- for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next)
-#else
for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next)
-#endif
{
if (ifa->ifa_addr->sa_family != AF_INET6
|| !IN6_IS_ADDR_LINKLOCAL(&satosin6(&ifa->ifa_addr)->sin6_addr)) {
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
- ifaprev = ifa;
-#endif
continue;
}
@@ -700,11 +629,7 @@ in6_ifdetach(ifp)
/* remove from the routing table */
if ((ia->ia_flags & IFA_ROUTE)
- && (rt = rtalloc1((struct sockaddr *)&ia->ia_addr, 0
-#ifdef __FreeBSD__
- , 0UL
-#endif
- ))) {
+ && (rt = rtalloc1((struct sockaddr *)&ia->ia_addr, 0))) {
rtflags = rt->rt_flags;
rtfree(rt);
rtrequest(RTM_DELETE,
@@ -715,14 +640,7 @@ in6_ifdetach(ifp)
}
/* remove from the linked list */
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
- if (ifaprev)
- ifaprev->ifa_next = ifa->ifa_next;
- else
- ifp->if_addrlist = ifa->ifa_next;
-#else
TAILQ_REMOVE(&ifp->if_addrlist, (struct ifaddr *)ia, ifa_list);
-#endif
/* also remove from the IPv6 address chain(itojun&jinmei) */
oia = ia;
diff --git a/sys/netinet6/in6_prefix.c b/sys/netinet6/in6_prefix.c
index 20239469405..3ccd022f746 100644
--- a/sys/netinet6/in6_prefix.c
+++ b/sys/netinet6/in6_prefix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_prefix.c,v 1.1 1999/12/08 06:50:21 itojun Exp $ */
+/* $OpenBSD: in6_prefix.c,v 1.2 1999/12/10 10:04:28 angelos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -65,9 +65,7 @@
*/
#include <sys/param.h>
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
#include <sys/ioctl.h>
-#endif
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/socket.h>
@@ -75,9 +73,7 @@
#include <sys/sockio.h>
#include <sys/systm.h>
#include <sys/syslog.h>
-#if !defined(__bsdi__) && !(defined(__FreeBSD__) && __FreeBSD__ < 3)
#include <sys/proc.h>
-#endif
#include <net/if.h>
@@ -87,11 +83,6 @@
#include <netinet6/in6_prefix.h>
#include <netinet6/ip6_var.h>
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-static MALLOC_DEFINE(M_IP6RR, "ip6rr", "IPv6 Router Renumbering Prefix");
-static MALLOC_DEFINE(M_RR_ADDR, "rp_addr", "IPv6 Router Renumbering Ifid");
-#endif
-
struct rr_prhead rr_prefix;
#include <net/net_osdep.h>
@@ -189,11 +180,7 @@ search_matched_prefix(struct ifnet *ifp, struct in6_prefixreq *ipr)
* which matches the addr
*/
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
- for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next)
-#else
for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next)
-#endif
{
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
@@ -256,11 +243,7 @@ mark_matched_prefixes(u_long cmd, struct ifnet *ifp, struct in6_rrenumreq *irr)
* search matched addr, and then search prefixes
* which matche the addr
*/
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
- for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next)
-#else
for (ifa = ifp->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next)
-#endif
{
struct rr_prefix *rpp;
@@ -326,9 +309,7 @@ unmark_prefixes(struct ifnet *ifp)
static void
init_prefix_ltimes(struct rr_prefix *rpp)
{
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
long time_second = time.tv_sec;
-#endif
if (rpp->rp_pltime == RR_INFINITE_LIFETIME ||
rpp->rp_rrf_decrprefd == 0)
@@ -455,9 +436,7 @@ in6_prefix_add_ifid(int iilen, struct in6_ifaddr *ia)
/* XXX: init dummy so */
bzero(&so, sizeof(so));
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(__NetBSD__)
so.so_state |= SS_PRIV;
-#endif
error = add_each_prefix(&so, &rp);
@@ -569,11 +548,7 @@ add_each_addr(struct socket *so, struct rr_prefix *rpp, struct rp_addr *rap)
/* propagate ANYCAST flag if it is set for ancestor addr */
if (rap->ra_flags.anycast != 0)
ifra.ifra_flags |= IN6_IFF_ANYCAST;
- error = in6_control(so, SIOCAIFADDR_IN6, (caddr_t)&ifra, rpp->rp_ifp
-#if !defined(__bsdi__) && !(defined(__FreeBSD__) && __FreeBSD__ < 3)
- , curproc
-#endif
- );
+ error = in6_control(so, SIOCAIFADDR_IN6, (caddr_t)&ifra, rpp->rp_ifp, curproc);
if (error != 0)
log(LOG_ERR, "in6_prefix.c: add_each_addr: addition of an addr"
"%s/%d failed because in6_control failed for error %d",
@@ -631,11 +606,7 @@ rrpr_update(struct socket *so, struct rr_prefix *new)
* add rp_addr entries in new into rpp, if they have not
* been already included in rpp.
*/
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- while (!LIST_EMPTY(&new->rp_addrhead))
-#else
while (new->rp_addrhead.lh_first != NULL)
-#endif
{
rap = LIST_FIRST(&new->rp_addrhead);
LIST_REMOVE(rap, ra_entry);
@@ -664,11 +635,7 @@ rrpr_update(struct socket *so, struct rr_prefix *new)
*rpp = *new;
LIST_INIT(&rpp->rp_addrhead);
/* move rp_addr entries of new to rpp */
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- while (!LIST_EMPTY(&new->rp_addrhead))
-#else
while (new->rp_addrhead.lh_first != NULL)
-#endif
{
rap = LIST_FIRST(&new->rp_addrhead);
LIST_REMOVE(rap, ra_entry);
@@ -826,11 +793,7 @@ free_rp_entries(struct rr_prefix *rpp)
* This func is only called with rpp on stack(not on list).
* So no splnet() here
*/
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- while (!LIST_EMPTY(&rpp->rp_addrhead))
-#else
while (rpp->rp_addrhead.lh_first != NULL)
-#endif
{
struct rp_addr *rap;
@@ -870,9 +833,7 @@ static void
unprefer_prefix(struct rr_prefix *rpp)
{
struct rp_addr *rap;
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
long time_second = time.tv_sec;
-#endif
for (rap = rpp->rp_addrhead.lh_first; rap != NULL;
rap = rap->ra_entry.le_next) {
@@ -916,11 +877,7 @@ delete_each_prefix(struct socket *so, struct rr_prefix *rpp, u_char origin)
ifra.ifra_prefixmask = rap->ra_addr->ia_prefixmask;
error = in6_control(so, SIOCDIFADDR_IN6, (caddr_t)&ifra,
- rpp->rp_ifp
-#if !defined(__bsdi__) && !(defined(__FreeBSD__) && __FreeBSD__ < 3)
- , curproc
-#endif
- );
+ rpp->rp_ifp, curproc);
if (error != 0)
log(LOG_ERR, "in6_prefix.c: delete_each_prefix:"
"deletion of an addr %s/%d failed because"
@@ -956,12 +913,8 @@ link_stray_ia6s(struct rr_prefix *rpp)
{
struct ifaddr *ifa;
-#if (defined(__FreeBSD__) && __FreeBSD__ < 3) || defined(__bsdi__)
- for (ifa = rpp->rp_ifp->if_addrlist; ifa; ifa = ifa->ifa_next)
-#else
for (ifa = rpp->rp_ifp->if_addrlist.tqh_first; ifa;
ifa = ifa->ifa_list.tqe_next)
-#endif
{
struct rp_addr *rap;
struct rr_prefix *orpp;
@@ -1116,9 +1069,7 @@ in6_rr_timer(void *ignored_arg)
{
int s;
struct rr_prefix *rpp;
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
long time_second = time.tv_sec;
-#endif
timeout(in6_rr_timer, (caddr_t)0, ip6_rr_prune * hz);
@@ -1132,9 +1083,7 @@ in6_rr_timer(void *ignored_arg)
/* XXX: init dummy so */
bzero(&so, sizeof(so));
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(__NetBSD__)
so.so_state |= SS_PRIV;
-#endif
next_rpp = LIST_NEXT(rpp, rp_entry);
delete_each_prefix(&so, rpp, PR_ORIG_KERNEL);
diff --git a/sys/netinet6/in6_proto.c b/sys/netinet6/in6_proto.c
index 599e0af4a37..0b87927209f 100644
--- a/sys/netinet6/in6_proto.c
+++ b/sys/netinet6/in6_proto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_proto.c,v 1.5 1999/12/10 08:53:17 angelos Exp $ */
+/* $OpenBSD: in6_proto.c,v 1.6 1999/12/10 10:04:28 angelos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -64,26 +64,12 @@
* @(#)in_proto.c 8.1 (Berkeley) 6/10/93
*/
-#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/socket.h>
-#if defined(__FreeBSD__)
-#include <sys/socketvar.h>
-#endif
#include <sys/protosw.h>
#include <sys/kernel.h>
#include <sys/domain.h>
#include <sys/mbuf.h>
-#ifdef __FreeBSD__
-#include <sys/systm.h>
-#include <sys/sysctl.h>
-#endif
#include <net/if.h>
#include <net/radix.h>
@@ -92,68 +78,24 @@
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/in_var.h>
-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || (defined(__NetBSD__) && !defined(TCP6)) || defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802)
#include <netinet/ip.h>
#include <netinet/ip_var.h>
-#endif
-#if (defined(__NetBSD__) && !defined(TCP6)) || defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802)
#include <netinet/in_pcb.h>
-#endif
#include <netinet6/ip6.h>
#include <netinet6/ip6_var.h>
#include <netinet6/icmp6.h>
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(__OpenBSD__) && !(defined(__bsdi__) && _BSDI_VERSION >= 199802)
-#include <netinet6/in6_pcb.h>
-#endif
-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802)
#include <netinet/tcp.h>
#include <netinet/tcp_timer.h>
#include <netinet/tcp_var.h>
#include <netinet/udp.h>
#include <netinet/udp_var.h>
-#else
-#if defined(__NetBSD__) && !defined(TCP6)
-#include <netinet/tcp.h>
-#include <netinet/tcp_fsm.h>
-#include <netinet/tcp_seq.h>
-#include <netinet/tcp_timer.h>
-#include <netinet/tcp_var.h>
-#include <netinet/tcpip.h>
-#include <netinet/tcp_debug.h>
-#else
-#include <netinet6/tcp6.h>
-#include <netinet6/tcp6_fsm.h>
-#include <netinet6/tcp6_seq.h>
-#include <netinet6/tcp6_timer.h>
-#include <netinet6/tcp6_var.h>
-#endif
-#endif
-
-#if !defined(__OpenBSD__) && !(defined(__bsdi__) && _BSDI_VERSION >= 199802)
-#include <netinet6/udp6.h>
-#include <netinet6/udp6_var.h>
-#endif
#include <netinet6/pim6_var.h>
#include <netinet6/nd6.h>
-#ifdef __FreeBSD__
-#include <netinet6/in6_prefix.h>
-#endif
-#ifdef __OpenBSD__ /*KAME IPSEC*/
#undef IPSEC
-#endif
-
-#ifdef IPSEC
-#include <netinet6/ipsec.h>
-#include <netinet6/ah.h>
-#ifdef IPSEC_ESP
-#include <netinet6/esp.h>
-#endif
-#include <netinet6/ipcomp.h>
-#endif /*IPSEC*/
#include <netinet6/ip6protosw.h>
@@ -171,172 +113,83 @@
*/
extern struct domain inet6domain;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-static struct pr_usrreqs nousrreqs;
-#endif
struct ip6protosw inet6sw[] = {
{ 0, &inet6domain, IPPROTO_IPV6, 0,
0, 0, 0, 0,
0,
ip6_init, 0, frag6_slowtimo, frag6_drain,
-#ifndef __FreeBSD__
ip6_sysctl,
-#else
-# if __FreeBSD__ >= 3
- &nousrreqs,
-# endif
-#endif
},
{ SOCK_DGRAM, &inet6domain, IPPROTO_UDP, PR_ATOMIC | PR_ADDR,
udp6_input, 0, udp6_ctlinput, ip6_ctloutput,
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- 0, 0,
-#elif defined(HAVE_NRL_INPCB)
udp6_usrreq, 0,
-#else
- udp6_usrreq, udp6_init,
-#endif
0, 0, 0,
-#ifndef __FreeBSD__
-#ifdef HAVE_NRL_INPCB
udp_sysctl,
-#else
- udp6_sysctl,
-#endif
-#else
-# if __FreeBSD__ >= 3
- &udp6_usrreqs,
-# endif
-#endif
},
#ifdef TCP6
{ SOCK_STREAM, &inet6domain, IPPROTO_TCP, PR_CONNREQUIRED | PR_WANTRCVD,
tcp6_input, 0, tcp6_ctlinput, tcp6_ctloutput,
tcp6_usrreq,
tcp6_init, tcp6_fasttimo, tcp6_slowtimo, tcp6_drain,
-#ifndef __FreeBSD__
tcp6_sysctl,
-#else
-# if __FreeBSD__ >= 3
- &tcp6_usrreqs,
-# endif
-#endif
},
#else
{ SOCK_STREAM, &inet6domain, IPPROTO_TCP, PR_CONNREQUIRED | PR_WANTRCVD,
tcp6_input, 0, tcp6_ctlinput, tcp_ctloutput,
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- 0,
-#elif defined(HAVE_NRL_INPCB)
tcp6_usrreq,
-#else
- tcp_usrreq,
-#endif
#ifdef INET /* don't call timeout routines twice */
tcp_init, 0, 0, tcp_drain,
#else
tcp_init, tcp_fasttimo, tcp_slowtimo, tcp_drain,
#endif
-#ifndef __FreeBSD__
tcp_sysctl,
-#else
-# if __FreeBSD__ >= 3
- &tcp6_usrreqs,
-# endif
-#endif
},
#endif /*TCP6*/
{ SOCK_RAW, &inet6domain, IPPROTO_RAW, PR_ATOMIC | PR_ADDR,
rip6_input, rip6_output, 0, rip6_ctloutput,
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- 0,
-#else
rip6_usrreq,
-#endif
0, 0, 0, 0,
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- &rip6_usrreqs
-#endif
},
{ SOCK_RAW, &inet6domain, IPPROTO_ICMPV6, PR_ATOMIC | PR_ADDR,
icmp6_input, rip6_output, 0, rip6_ctloutput,
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- 0,
-#else
rip6_usrreq,
-#endif
icmp6_init, icmp6_fasttimo, 0, 0,
-#ifndef __FreeBSD__
icmp6_sysctl,
-#else
-# if __FreeBSD__ >= 3
- &rip6_usrreqs
-# endif
-#endif
},
{ SOCK_RAW, &inet6domain, IPPROTO_DSTOPTS,PR_ATOMIC|PR_ADDR,
dest6_input, 0, 0, 0,
0,
0, 0, 0, 0,
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- &nousrreqs
-#endif
},
{ SOCK_RAW, &inet6domain, IPPROTO_ROUTING,PR_ATOMIC|PR_ADDR,
route6_input, 0, 0, 0,
0,
0, 0, 0, 0,
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- &nousrreqs
-#endif
},
{ SOCK_RAW, &inet6domain, IPPROTO_FRAGMENT,PR_ATOMIC|PR_ADDR,
frag6_input, 0, 0, 0,
0,
0, 0, 0, 0,
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- &nousrreqs
-#endif
},
#ifdef IPSEC
{ SOCK_RAW, &inet6domain, IPPROTO_AH, PR_ATOMIC|PR_ADDR,
ah6_input, 0, 0, 0,
0,
0, 0, 0, 0,
-#ifndef __FreeBSD__
ipsec6_sysctl,
-#else
-# if __FreeBSD__ >= 3
- &nousrreqs,
-# endif
-#endif
},
-#ifdef IPSEC_ESP
{ SOCK_RAW, &inet6domain, IPPROTO_ESP, PR_ATOMIC|PR_ADDR,
esp6_input, 0, 0, 0,
0,
0, 0, 0, 0,
-#ifndef __FreeBSD__
ipsec6_sysctl,
-#else
-# if __FreeBSD__ >= 3
- &nousrreqs,
-# endif
-#endif
},
-#endif
{ SOCK_RAW, &inet6domain, IPPROTO_IPCOMP, PR_ATOMIC|PR_ADDR,
ipcomp6_input, 0, 0, 0,
0,
0, 0, 0, 0,
-#ifndef __FreeBSD__
ipsec6_sysctl,
-#else
-# if __FreeBSD__ >= 3
- &nousrreqs,
-# endif
-#endif
},
#endif /* IPSEC */
#if NGIF > 0
@@ -344,68 +197,36 @@ struct ip6protosw inet6sw[] = {
in6_gif_input,0, 0, 0,
0,
0, 0, 0, 0,
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- &nousrreqs
-#endif
},
#ifdef INET6
{ SOCK_RAW, &inet6domain, IPPROTO_IPV6, PR_ATOMIC|PR_ADDR,
in6_gif_input,0, 0, 0,
0,
0, 0, 0, 0,
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- &nousrreqs
-#endif
},
#endif /* INET6 */
#endif /* GIF */
{ SOCK_RAW, &inet6domain, IPPROTO_PIM, PR_ATOMIC|PR_ADDR,
pim6_input, rip6_output, 0, rip6_ctloutput,
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- 0,
-#else
rip6_usrreq,
-#endif
0, 0, 0, 0,
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- &rip6_usrreqs
-# endif
},
/* raw wildcard */
{ SOCK_RAW, &inet6domain, 0, PR_ATOMIC | PR_ADDR,
rip6_input, rip6_output, 0, rip6_ctloutput,
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- 0, 0,
-#else
rip6_usrreq, rip6_init,
-#endif
0, 0, 0,
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- &rip6_usrreqs
-#endif
},
};
-#ifdef __FreeBSD__
-extern int in6_inithead __P((void **, int));
-#endif
-
struct domain inet6domain =
{ AF_INET6, "internet6", 0, 0, 0,
(struct protosw *)inet6sw,
(struct protosw *)&inet6sw[sizeof(inet6sw)/sizeof(inet6sw[0])], 0,
-#ifdef __FreeBSD__
- in6_inithead,
-#else
rn_inithead,
-#endif
offsetof(struct sockaddr_in6, sin6_addr) << 3,
sizeof(struct sockaddr_in6) };
-#ifdef __FreeBSD__
-DOMAIN_SET(inet6);
-#endif
-
/*
* Internet configuration info
*/
@@ -449,7 +270,6 @@ int ip6_keepfaith = 0;
time_t ip6_log_time = (time_t)0L;
/* icmp6 */
-#ifndef __bsdi__
/*
* BSDI4 defines these variables in in_proto.c...
* XXX: what if we don't define INET? Should we define pmtu6_expire
@@ -457,7 +277,6 @@ time_t ip6_log_time = (time_t)0L;
*/
int pmtu_expire = 60*10;
int pmtu_probe = 60*2;
-#endif
/* raw IP6 parameters */
/*
@@ -553,165 +372,3 @@ int tcp6_roundfrac = TCP6_ROUNDFRAC;
int udp6_sendspace = 9216; /* really max datagram size */
int udp6_recvspace = 40 * (1024 + sizeof(struct sockaddr_in6));
/* 40 1K datagrams */
-
-#ifdef __FreeBSD__
-/*
- * sysctl related items.
- */
-SYSCTL_NODE(_net, PF_INET6, inet6, CTLFLAG_RW, 0,
- "Internet6 Family");
-
-/* net.inet6 */
-SYSCTL_NODE(_net_inet6, IPPROTO_IPV6, ip6, CTLFLAG_RW, 0, "IP6");
-SYSCTL_NODE(_net_inet6, IPPROTO_ICMPV6, icmp6, CTLFLAG_RW, 0, "ICMP6");
-SYSCTL_NODE(_net_inet6, IPPROTO_UDP, udp6, CTLFLAG_RW, 0, "UDP6");
-SYSCTL_NODE(_net_inet6, IPPROTO_TCP, tcp6, CTLFLAG_RW, 0, "TCP6");
-#ifdef IPSEC
-SYSCTL_NODE(_net_inet6, IPPROTO_ESP, ipsec6, CTLFLAG_RW, 0, "IPSEC6");
-#endif /* IPSEC */
-
-/* net.inet6.ip6 */
-static int
-sysctl_ip6_forwarding SYSCTL_HANDLER_ARGS
-{
- int error = 0;
- int old_ip6_forwarding;
- int changed;
-
- error = SYSCTL_OUT(req, arg1, sizeof(int));
- if (error || !req->newptr)
- return (error);
- old_ip6_forwarding = ip6_forwarding;
- error = SYSCTL_IN(req, arg1, sizeof(int));
- if (error != 0)
- return (error);
- changed = (ip6_forwarding ? 1 : 0) ^ (old_ip6_forwarding ? 1 : 0);
- if (changed == 0)
- return (error);
- if (ip6_forwarding != 0) { /* host becomes router */
- int s = splnet();
- struct nd_prefix *pr, *next;
-
- for (pr = nd_prefix.lh_first; pr; pr = next) {
- next = pr->ndpr_next;
- if (!IN6_IS_ADDR_UNSPECIFIED(&pr->ndpr_addr))
- in6_ifdel(pr->ndpr_ifp, &pr->ndpr_addr);
- prelist_remove(pr);
- }
- splx(s);
- } else { /* router becomes host */
- struct socket so;
-
- /* XXX: init dummy so */
- bzero(&so, sizeof(so));
- while(!LIST_EMPTY(&rr_prefix))
- delete_each_prefix(&so, LIST_FIRST(&rr_prefix),
- PR_ORIG_KERNEL);
- }
-
- return (error);
-}
-
-SYSCTL_OID(_net_inet6_ip6, IPV6CTL_FORWARDING, forwarding,
- CTLTYPE_INT|CTLFLAG_RW, &ip6_forwarding, 0, sysctl_ip6_forwarding,
- "I", "");
-SYSCTL_INT(_net_inet6_ip6, IPV6CTL_SENDREDIRECTS,
- redirect, CTLFLAG_RW, &ip6_sendredirects, 0, "");
-SYSCTL_INT(_net_inet6_ip6, IPV6CTL_DEFHLIM,
- hlim, CTLFLAG_RW, &ip6_defhlim, 0, "");
-SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGPACKETS,
- maxfragpackets, CTLFLAG_RW, &ip6_maxfragpackets, 0, "");
-SYSCTL_INT(_net_inet6_ip6, IPV6CTL_ACCEPT_RTADV,
- accept_rtadv, CTLFLAG_RW, &ip6_accept_rtadv, 0, "");
-SYSCTL_INT(_net_inet6_ip6, IPV6CTL_KEEPFAITH,
- keepfaith, CTLFLAG_RW, &ip6_keepfaith, 0, "");
-SYSCTL_INT(_net_inet6_ip6, IPV6CTL_LOG_INTERVAL,
- log_interval, CTLFLAG_RW, &ip6_log_interval, 0, "");
-SYSCTL_INT(_net_inet6_ip6, IPV6CTL_HDRNESTLIMIT,
- hdrnestlimit, CTLFLAG_RW, &ip6_hdrnestlimit, 0, "");
-SYSCTL_INT(_net_inet6_ip6, IPV6CTL_DAD_COUNT,
- dad_count, CTLFLAG_RW, &ip6_dad_count, 0, "");
-SYSCTL_INT(_net_inet6_ip6, IPV6CTL_AUTO_FLOWLABEL,
- auto_flowlabel, CTLFLAG_RW, &ip6_auto_flowlabel, 0, "");
-SYSCTL_INT(_net_inet6_ip6, IPV6CTL_DEFMCASTHLIM,
- defmcasthlim, CTLFLAG_RW, &ip6_defmcasthlim, 0, "");
-SYSCTL_INT(_net_inet6_ip6, IPV6CTL_GIF_HLIM,
- gifhlim, CTLFLAG_RW, &ip6_gif_hlim, 0, "");
-SYSCTL_STRING(_net_inet6_ip6, IPV6CTL_KAME_VERSION,
- kame_version, CTLFLAG_RD, __KAME_VERSION, 0, "");
-SYSCTL_INT(_net_inet6_ip6, IPV6CTL_USE_DEPRECATED,
- use_deprecated, CTLFLAG_RW, &ip6_use_deprecated, 0, "");
-SYSCTL_INT(_net_inet6_ip6, IPV6CTL_RR_PRUNE,
- rr_prune, CTLFLAG_RW, &ip6_rr_prune, 0, "");
-#ifdef MAPPED_ADDR_ENABLED
-SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAPPED_ADDR,
- mapped_addr, CTLFLAG_RW, &ip6_mapped_addr_on, 0, "");
-#endif /* MAPPED_ADDR_ENABLED */
-
-/* net.inet6.icmp6 */
-SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRACCEPT,
- rediraccept, CTLFLAG_RW, &icmp6_rediraccept, 0, "");
-SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_REDIRTIMEOUT,
- redirtimeout, CTLFLAG_RW, &icmp6_redirtimeout, 0, "");
-SYSCTL_STRUCT(_net_inet6_icmp6, ICMPV6CTL_STATS, stats, CTLFLAG_RD,
- &icmp6stat, icmp6stat, "");
-SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ERRRATELIMIT,
- errratelimit, CTLFLAG_RW, &icmp6errratelim, 0, "");
-SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_PRUNE,
- nd6_prune, CTLFLAG_RW, &nd6_prune, 0, "");
-SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_DELAY,
- nd6_delay, CTLFLAG_RW, &nd6_delay, 0, "");
-SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_UMAXTRIES,
- nd6_umaxtries, CTLFLAG_RW, &nd6_umaxtries, 0, "");
-SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_MMAXTRIES,
- nd6_mmaxtries, CTLFLAG_RW, &nd6_mmaxtries, 0, "");
-SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_USELOOPBACK,
- nd6_useloopback, CTLFLAG_RW, &nd6_useloopback, 0, "");
-SYSCTL_INT(_net_inet6_icmp6, ICMPV6CTL_ND6_PROXYALL,
- nd6_proxyall, CTLFLAG_RW, &nd6_proxyall, 0, "");
-
-#if __FreeBSD__ < 3
-/* net.inet6.udp6 */
-SYSCTL_INT(_net_inet6_udp6, UDP6CTL_SENDMAX,
- sendmax, CTLFLAG_RW, &udp6_sendspace, 0, "");
-SYSCTL_INT(_net_inet6_udp6, UDP6CTL_RECVSPACE,
- recvspace, CTLFLAG_RW, &udp6_recvspace, 0, "");
-
-/* net.inet6.tcp6 */
-SYSCTL_INT(_net_inet6_tcp6, TCP6CTL_MSSDFLT,
- mssdflt, CTLFLAG_RW, &tcp6_mssdflt, 0, "");
-SYSCTL_INT(_net_inet6_tcp6, TCP6CTL_DO_RFC1323,
- do_rfc1323, CTLFLAG_RW, &tcp6_do_rfc1323, 0, "");
-SYSCTL_INT(_net_inet6_tcp6, TCP6CTL_KEEPIDLE,
- keepidle, CTLFLAG_RW, &tcp6_keepidle, 0, "");
-SYSCTL_INT(_net_inet6_tcp6, TCP6CTL_KEEPINTVL,
- keepintvl, CTLFLAG_RW, &tcp6_keepintvl, 0, "");
-SYSCTL_INT(_net_inet6_tcp6, TCP6CTL_KEEPCNT,
- keepcnt, CTLFLAG_RW, &tcp6_keepcnt, 0, "");
-SYSCTL_INT(_net_inet6_tcp6, TCP6CTL_MAXPERSISTIDLE,
- maxpersistidle, CTLFLAG_RW, &tcp6_maxpersistidle, 0, "");
-SYSCTL_INT(_net_inet6_tcp6, TCP6CTL_SENDSPACE,
- sendspace, CTLFLAG_RW, &tcp6_sendspace, 0, "");
-SYSCTL_INT(_net_inet6_tcp6, TCP6CTL_RECVSPACE,
- recvspace, CTLFLAG_RW, &tcp6_recvspace, 0, "");
-SYSCTL_INT(_net_inet6_tcp6, TCP6CTL_CONNTIMEO,
- conntimeo, CTLFLAG_RW, &tcp6_conntimeo, 0, "");
-SYSCTL_INT(_net_inet6_tcp6, TCP6CTL_PMTU,
- pmtu, CTLFLAG_RW, &tcp6_pmtu, 0, "");
-SYSCTL_INT(_net_inet6_tcp6, TCP6CTL_PMTU_EXPIRE,
- pmtu_expire, CTLFLAG_RW, &pmtu_expire, 0, "");
-SYSCTL_INT(_net_inet6_tcp6, TCP6CTL_PMTU_PROBE,
- pmtu_probe, CTLFLAG_RW, &pmtu_probe, 0, "");
-SYSCTL_INT(_net_inet6_tcp6, TCP6CTL_43MAXSEG,
- pmtu_43maxseg, CTLFLAG_RW, &tcp6_43maxseg, 0, "");
-SYSCTL_STRUCT(_net_inet6_tcp6, TCP6CTL_STATS, stats, CTLFLAG_RD,
- &tcp6stat, tcp6stat, "");
-SYSCTL_INT(_net_inet6_tcp6, TCP6CTL_SYN_CACHE_LIMIT,
- syn_cache_limit, CTLFLAG_RW, &tcp6_syn_cache_limit, 0, "");
-SYSCTL_INT(_net_inet6_tcp6, TCP6CTL_SYN_BUCKET_LIMIT,
- syn_bucket_limit, CTLFLAG_RW, &tcp6_syn_bucket_limit, 0, "");
-SYSCTL_INT(_net_inet6_tcp6, TCP6CTL_SYN_CACHE_INTER,
- syn_cache_interval, CTLFLAG_RW, &tcp6_syn_cache_interval, 0, "");
-#endif /* !(defined(__FreeBSD__) && __FreeBSD__ >= 3) */
-
-#endif /* __FreeBSD__ */
diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c
index 2f222592ca4..e996ce837b4 100644
--- a/sys/netinet6/in6_src.c
+++ b/sys/netinet6/in6_src.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_src.c,v 1.1 1999/12/08 06:50:21 itojun Exp $ */
+/* $OpenBSD: in6_src.c,v 1.2 1999/12/10 10:04:28 angelos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -64,10 +64,6 @@
* @(#)in_pcb.c 8.2 (Berkeley) 1/4/94
*/
-#ifdef __NetBSD__ /*XXX*/
-#include "opt_ipsec.h"
-#endif
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
@@ -96,12 +92,9 @@
#include <netinet6/ip6_var.h>
#include <netinet6/nd6.h>
-#ifndef __bsdi__
#include "loop.h"
-#endif
-#if defined(__NetBSD__) || defined(__OpenBSD__)
+
extern struct ifnet loif[NLOOP];
-#endif
/*
* Return an IPv6 address, which is the most appropriate for given
@@ -196,21 +189,9 @@ in6_selectsrc(dstsock, opts, mopts, ro, laddr, errorp)
*/
if (IN6_IS_ADDR_MULTICAST(dst)) {
struct ifnet *ifp = mopts ? mopts->im6o_multicast_ifp : NULL;
-#ifdef __bsdi__
-#if _BSDI_VERSION >= 199802
- extern struct ifnet *loifp;
-#else
- extern struct ifnet loif;
- struct ifnet *loifp = &loif;
-#endif
-#endif
if (ifp == NULL && IN6_IS_ADDR_MC_NODELOCAL(dst)) {
-#ifdef __bsdi__
- ifp = loifp;
-#else
ifp = &loif[0];
-#endif
}
if (ifp) {
@@ -265,21 +246,8 @@ in6_selectsrc(dstsock, opts, mopts, ro, laddr, errorp)
ro->ro_dst.sin6_family = AF_INET6;
ro->ro_dst.sin6_len = sizeof(struct sockaddr_in6);
ro->ro_dst.sin6_addr = *dst;
- if (IN6_IS_ADDR_MULTICAST(dst)) {
-#ifdef __FreeBSD__
- ro->ro_rt = rtalloc1(&((struct route *)ro)
- ->ro_dst, 0, 0UL);
-#endif /*__FreeBSD__*/
-#if defined(__bsdi__) || defined(__NetBSD__)
- ro->ro_rt = rtalloc1(&((struct route *)ro)
- ->ro_dst, 0);
-#endif /*__bsdi__*/
- } else {
-#ifdef __FreeBSD__
- rtcalloc((struct route *)ro);
-#else
+ if (!IN6_IS_ADDR_MULTICAST(dst)) {
rtalloc((struct route *)ro);
-#endif
}
}
diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h
index 31ff8983a6e..650a82ec2fe 100644
--- a/sys/netinet6/in6_var.h
+++ b/sys/netinet6/in6_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_var.h,v 1.5 1999/12/10 08:53:17 angelos Exp $ */
+/* $OpenBSD: in6_var.h,v 1.6 1999/12/10 10:04:28 angelos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -99,10 +99,8 @@ struct in6_ifaddr {
struct sockaddr_in6 ia_prefixmask; /* prefix mask */
u_int32_t ia_plen; /* prefix length */
struct in6_ifaddr *ia_next; /* next in6 list of IP6 addresses */
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
LIST_HEAD(in6_multihead, in6_multi) ia6_multiaddrs;
/* list of multicast addresses */
-#endif
int ia6_flags;
struct in6_addrlifetime ia6_lifetime; /* NULL = infty */
@@ -429,34 +427,11 @@ extern struct ifqueue ip6intrq; /* IP6 packet input queue */
extern struct in6_addr zeroin6_addr;
extern u_char inet6ctlerrmap[];
extern unsigned long in6_maxmtu;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-#ifdef MALLOC_DECLARE
-MALLOC_DECLARE(M_IPMADDR);
-#endif /* MALLOC_DECLARE */
-#endif
/*
* Macro for finding the internet address structure (in6_ifaddr) corresponding
* to a given interface (ifnet structure).
*/
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
-
-#define IFP_TO_IA6(ifp, ia) \
-/* struct ifnet *ifp; */ \
-/* struct in6_ifaddr *ia; */ \
-do { \
- struct ifaddr *ifa; \
- for (ifa = (ifp)->if_addrlist; ifa; ifa = ifa->ifa_next) { \
- if (!ifa->ifa_addr) \
- continue; \
- if (ifa->ifa_addr->sa_family == AF_INET6) \
- break; \
- } \
- (ia) = (struct in6_ifaddr *)ifa; \
-} while (0)
-
-#else
-
#define IFP_TO_IA6(ifp, ia) \
/* struct ifnet *ifp; */ \
/* struct in6_ifaddr *ia; */ \
@@ -472,8 +447,6 @@ do { \
} while (0)
#endif /* _KERNEL */
-#endif
-
/*
* Multi-cast membership entry. One for each group/ifp that a PCB
* belongs to.
@@ -487,21 +460,13 @@ struct in6_multi {
LIST_ENTRY(in6_multi) in6m_entry; /* list glue */
struct in6_addr in6m_addr; /* IP6 multicast address */
struct ifnet *in6m_ifp; /* back pointer to ifnet */
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
struct in6_ifaddr *in6m_ia; /* back pointer to in6_ifaddr */
-#else
- struct ifmultiaddr *in6m_ifma; /* back pointer to ifmultiaddr */
-#endif
u_int in6m_refcount; /* # membership claims by sockets */
u_int in6m_state; /* state of the membership */
u_int in6m_timer; /* MLD6 listener report timer */
};
#ifdef _KERNEL
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-extern LIST_HEAD(in6_multihead, in6_multi) in6_multihead;
-#endif
-
/*
* Structure used by macros below to remember position when stepping through
* all of eht in6_multi records.
@@ -517,49 +482,6 @@ struct in6_multistep {
* returns NLL.
*/
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-
-#define IN6_LOOKUP_MULTI(addr, ifp, in6m) \
-/* struct in6_addr addr; */ \
-/* struct ifnet *ifp; */ \
-/* struct in6_multi *in6m; */ \
-do { \
- register struct ifmultiaddr *ifma; \
- for (ifma = (ifp)->if_multiaddrs.lh_first; ifma; \
- ifma = ifma->ifma_link.le_next) { \
- if (ifma->ifma_addr->sa_family == AF_INET6 \
- && IN6_ARE_ADDR_EQUAL(&((struct sockaddr_in6 *)ifma->ifma_addr)->sin6_addr, \
- &(addr))) \
- break; \
- } \
- (in6m) = (struct in6_multi *)(ifma ? ifma->ifma_protospec : 0); \
-} while(0)
-
-/*
- * Macro to step through all of the in6_multi records, one at a time.
- * The current position is remembered in "step", which the caller must
- * provide. IN6_FIRST_MULTI(), below, must be called to initialize "step"
- * and get the first record. Both macros return a NULL "in6m" when there
- * are no remaining records.
- */
-#define IN6_NEXT_MULTI(step, in6m) \
-/* struct in6_multistep step; */ \
-/* struct in6_multi *in6m; */ \
-do { \
- if (((in6m) = (step).i_in6m) != NULL) \
- (step).i_in6m = (step).i_in6m->in6m_entry.le_next; \
-} while(0)
-
-#define IN6_FIRST_MULTI(step, in6m) \
-/* struct in6_multistep step; */ \
-/* struct in6_multi *in6m */ \
-do { \
- (step).i_in6m = in6_multihead.lh_first; \
- IN6_NEXT_MULTI((step), (in6m)); \
-} while(0)
-
-#else /* not FreeBSD3 */
-
#define IN6_LOOKUP_MULTI(addr, ifp, in6m) \
/* struct in6_addr addr; */ \
/* struct ifnet *ifp; */ \
@@ -611,8 +533,6 @@ do { \
IN6_NEXT_MULTI((step), (in6m)); \
} while (0)
-#endif /* not FreeBSD3 */
-
int in6_ifinit __P((struct ifnet *,
struct in6_ifaddr *, struct sockaddr_in6 *, int));
struct in6_multi *in6_addmulti __P((struct in6_addr *, struct ifnet *,
@@ -622,12 +542,8 @@ void in6_ifscrub __P((struct ifnet *, struct in6_ifaddr *));
extern int in6_ifindex2scopeid __P((int));
extern int in6_mask2len __P((struct in6_addr *));
extern void in6_len2mask __P((struct in6_addr *, int));
-#if !defined(__bsdi__) && !(defined(__FreeBSD__) && __FreeBSD__ < 3)
int in6_control __P((struct socket *,
u_long, caddr_t, struct ifnet *, struct proc *));
-#else
-int in6_control __P((struct socket *, u_long, caddr_t, struct ifnet *));
-#endif
void in6_savemkludge __P((struct in6_ifaddr *));
void in6_setmaxmtu __P((void));
void in6_restoremkludge __P((struct in6_ifaddr *, struct ifnet *));
diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c
index df8b3879648..0b10bb2a8c9 100644
--- a/sys/netinet6/ip6_forward.c
+++ b/sys/netinet6/ip6_forward.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_forward.c,v 1.1 1999/12/08 06:50:21 itojun Exp $ */
+/* $OpenBSD: ip6_forward.c,v 1.2 1999/12/10 10:04:28 angelos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -29,11 +29,6 @@
* SUCH DAMAGE.
*/
-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3)
-#include "opt_ip6fw.h"
-#include "opt_inet.h"
-#endif
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
@@ -56,9 +51,7 @@
#include <netinet6/icmp6.h>
#include <netinet6/nd6.h>
-#ifdef __OpenBSD__ /*KAME IPSEC*/
#undef IPSEC
-#endif
#ifdef IPSEC_IPV6FWD
#include <netinet6/ipsec.h>
@@ -97,12 +90,11 @@ ip6_forward(m, srcrt)
register struct rtentry *rt;
int error, type = 0, code = 0;
struct mbuf *mcopy = NULL;
+ long time_second = time.tv_sec;
+
#ifdef IPSEC_IPV6FWD
struct secpolicy *sp = NULL;
#endif
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
- long time_second = time.tv_sec;
-#endif
#ifdef IPSEC_IPV6FWD
/*
@@ -297,12 +289,7 @@ ip6_forward(m, srcrt)
ip6_forward_rt.ro_rt = 0;
}
/* this probably fails but give it a try again */
-#ifdef __FreeBSD__
- rtalloc_ign((struct route *)&ip6_forward_rt,
- RTF_PRCLONING);
-#else
rtalloc((struct route *)&ip6_forward_rt);
-#endif
}
if (ip6_forward_rt.ro_rt == 0) {
@@ -326,11 +313,8 @@ ip6_forward(m, srcrt)
dst->sin6_family = AF_INET6;
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
+
if (ip6_forward_rt.ro_rt == 0) {
ip6stat.ip6s_noroute++;
/* XXX in6_ifstat_inc(rt->rt_ifp, ifs6_in_noroute) */
diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c
index 7790c0aff9d..e1643e8b448 100644
--- a/sys/netinet6/ip6_mroute.c
+++ b/sys/netinet6/ip6_mroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_mroute.c,v 1.1 1999/12/08 06:50:21 itojun Exp $ */
+/* $OpenBSD: ip6_mroute.c,v 1.2 1999/12/10 10:04:28 angelos Exp $ */
/*
* Copyright (C) 1998 WIDE Project.
@@ -44,10 +44,6 @@
* MROUTING Revision: 3.5.1.2 + PIM-SMv2 (pimd) Support
*/
-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__NetBSD__)
-#include "opt_inet.h"
-#endif
-
#ifndef _KERNEL
# ifdef KERNEL
# define _KERNEL
@@ -56,9 +52,6 @@
#include <sys/param.h>
#include <sys/systm.h>
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-#include <sys/malloc.h>
-#endif
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
@@ -67,9 +60,7 @@
#include <sys/errno.h>
#include <sys/time.h>
#include <sys/kernel.h>
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
#include <sys/ioctl.h>
-#endif
#include <sys/syslog.h>
#include <net/if.h>
@@ -85,19 +76,13 @@
#include <netinet6/pim6.h>
#include <netinet6/pim6_var.h>
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-static MALLOC_DEFINE(M_MRTABLE, "mf6c", "multicast forwarding cache entry");
-#endif
-
#define M_HASCL(m) ((m)->m_flags & M_EXT)
static int ip6_mdq __P((struct mbuf *, struct ifnet *, struct mf6c *));
static void phyint_send __P((struct ip6_hdr *, struct mif6 *, struct mbuf *));
static int set_pim6 __P((int *));
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
static int get_pim6 __P((struct mbuf *));
-#endif
static int socket_send __P((struct socket *, struct mbuf *,
struct sockaddr_in6 *));
static int register_send __P((struct ip6_hdr *, struct mif6 *,
@@ -157,10 +142,6 @@ static mifi_t reg_mif_num = (mifi_t)-1;
static struct pim6stat pim6stat;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-static struct callout_handle expire_upcalls_ch;
-#endif
-
/*
* one-back cache used by ipip_input to locate a tunnel's mif
* given a datagram's src ip address.
@@ -240,54 +221,6 @@ static int del_m6fc __P((struct mf6cctl *));
/*
* Handle MRT setsockopt commands to modify the multicast routing tables.
*/
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-int
-ip6_mrouter_set(so, sopt)
- struct socket *so;
- struct sockopt *sopt;
-{
- int error = 0;
- struct mbuf *m;
-
- if (so != ip6_mrouter && sopt->sopt_name != MRT6_INIT)
- return (EACCES);
-
- if (error = soopt_getm(sopt, &m)) /* XXX */
- return (error);
- if (error = soopt_mcopyin(sopt, m)) /* XXX */
- return (error);
-
- switch (sopt->sopt_name) {
- case MRT6_INIT:
- error = ip6_mrouter_init(so, m);
- break;
- case MRT6_DONE:
- error = ip6_mrouter_done();
- break;
- case MRT6_ADD_MIF:
- error = add_m6if(mtod(m, struct mif6ctl *));
- break;
- case MRT6_DEL_MIF:
- error = del_m6if(mtod(m, mifi_t *));
- break;
- case MRT6_ADD_MFC:
- error = add_m6fc(mtod(m, struct mf6cctl *));
- break;
- case MRT6_DEL_MFC:
- error = del_m6fc(mtod(m, struct mf6cctl *));
- break;
- case MRT6_PIM:
- error = set_pim6(mtod(m, int *));
- break;
- default:
- error = EOPNOTSUPP;
- break;
- }
-
- (void)m_freem(m);
- return(error);
-}
-#else
int
ip6_mrouter_set(cmd, so, m)
int cmd;
@@ -308,29 +241,10 @@ ip6_mrouter_set(cmd, so, m)
default: return EOPNOTSUPP;
}
}
-#endif
/*
* Handle MRT getsockopt commands
*/
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-int
-ip6_mrouter_get(so, sopt)
- struct socket *so;
- struct sockopt *sopt;
-{
- int error = 0;
-
- if (so != ip6_mrouter) return EACCES;
-
- switch (sopt->sopt_name) {
- case MRT6_PIM:
- error = sooptcopyout(sopt, &pim6, sizeof(pim6));
- break;
- }
- return (error);
-}
-#else
int
ip6_mrouter_get(cmd, so, m)
int cmd;
@@ -350,7 +264,6 @@ ip6_mrouter_get(cmd, so, m)
return EOPNOTSUPP;
}
}
-#endif
/*
* Handle ioctl commands to obtain information from the cache
@@ -386,11 +299,8 @@ get_sg_cnt(req)
register struct mf6c *rt;
int s;
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
s = splnet();
-#endif
+
MF6CFIND(req->src.sin6_addr, req->grp.sin6_addr, rt);
splx(s);
if (rt != NULL) {
@@ -426,7 +336,6 @@ get_mif6_cnt(req)
return 0;
}
-#if !(defined(__FreeBSD__) && __FreeBSD__ >=3)
/*
* Get PIM processiong global
*/
@@ -442,7 +351,6 @@ get_pim6(m)
return 0;
}
-#endif
static int
set_pim6(i)
@@ -493,9 +401,6 @@ ip6_mrouter_init(so, m)
pim6 = 0;/* used for stubbing out/in pim stuff */
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- expire_upcalls_ch =
-#endif
timeout(expire_upcalls, (caddr_t)NULL, EXPIRE_TIMEOUT);
#ifdef MRT6DEBUG
@@ -520,11 +425,7 @@ ip6_mrouter_done()
struct rtdetq *rte;
int s;
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
s = splnet();
-#endif
/*
* For each phyint in use, disable promiscuous reception of all IPv6
@@ -562,11 +463,7 @@ ip6_mrouter_done()
pim6 = 0; /* used to stub out/in pim specific code */
- untimeout(expire_upcalls, (caddr_t)NULL
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- , expire_upcalls_ch
-#endif
- );
+ untimeout(expire_upcalls, (caddr_t)NULL);
/*
* Free all multicast forwarding cache entries.
@@ -619,9 +516,7 @@ add_m6if(mifcp)
{
register struct mif6 *mifp;
struct ifnet *ifp;
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
struct in6_ifreq ifr;
-#endif
int error, s;
#ifdef notyet
struct tbf *m_tbf = tbftable + mifcp->mif6c_mifi;
@@ -638,12 +533,8 @@ add_m6if(mifcp)
if (mifcp->mif6c_flags & MIFF_REGISTER) {
if (reg_mif_num == (mifi_t)-1) {
-#if defined(__NetBSD__) || defined(__OpenBSD__)
strcpy(multicast_register_if.if_xname,
"register_mif"); /* XXX */
-#else
- multicast_register_if.if_name = "register_mif";
-#endif
multicast_register_if.if_flags |= IFF_LOOPBACK;
multicast_register_if.if_index = mifcp->mif6c_mifi;
reg_mif_num = mifcp->mif6c_mifi;
@@ -657,14 +548,8 @@ add_m6if(mifcp)
if ((ifp->if_flags & IFF_MULTICAST) == 0)
return EOPNOTSUPP;
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
s = splnet();
-#endif
-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3)
- error = if_allmulti(ifp, 1);
-#else
+
/*
* Enable promiscuous reception of all IPv6 multicasts
* from the interface.
@@ -672,17 +557,14 @@ add_m6if(mifcp)
ifr.ifr_addr.sin6_family = AF_INET6;
ifr.ifr_addr.sin6_addr = in6addr_any;
error = (*ifp->if_ioctl)(ifp, SIOCADDMULTI, (caddr_t)&ifr);
-#endif
+
splx(s);
if (error)
return error;
}
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
s = splnet();
-#endif
+
mifp->m6_flags = mifcp->mif6c_flags;
mifp->m6_ifp = ifp;
#ifdef notyet
@@ -721,9 +603,7 @@ del_m6if(mifip)
register struct mif6 *mifp = mif6table + *mifip;
register mifi_t mifi;
struct ifnet *ifp;
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
struct in6_ifreq ifr;
-#endif
int s;
if (*mifip >= nummifs)
@@ -731,11 +611,7 @@ del_m6if(mifip)
if (mifp->m6_ifp == NULL)
return EINVAL;
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
s = splnet();
-#endif
if (!(mifp->m6_flags & MIFF_REGISTER)) {
/*
@@ -744,13 +620,9 @@ del_m6if(mifip)
*/
ifp = mifp->m6_ifp;
-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3)
- if_allmulti(ifp, 0);
-#else
ifr.ifr_addr.sin6_family = AF_INET6;
ifr.ifr_addr.sin6_addr = in6addr_any;
(*ifp->if_ioctl)(ifp, SIOCDELMULTI, (caddr_t)&ifr);
-#endif
}
#ifdef notyet
@@ -801,11 +673,8 @@ add_m6fc(mfccp)
mfccp->mf6cc_parent);
#endif
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
s = splnet();
-#endif
+
rt->mf6c_parent = mfccp->mf6cc_parent;
rt->mf6c_ifset = mfccp->mf6cc_ifset;
splx(s);
@@ -815,11 +684,8 @@ add_m6fc(mfccp)
/*
* Find the entry for which the upcall was made and update
*/
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
s = splnet();
-#endif
+
hash = MF6CHASH(mfccp->mf6cc_origin.sin6_addr,
mfccp->mf6cc_mcastgrp.sin6_addr);
for (rt = mf6ctable[hash], nstl = 0; rt; rt = rt->mf6c_next) {
@@ -987,11 +853,7 @@ del_m6fc(mfccp)
ip6_sprintf(&mcastgrp.sin6_addr));
#endif
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
s = splnet();
-#endif
nptr = &mf6ctable[hash];
while ((rt = *nptr) != NULL) {
@@ -1077,11 +939,8 @@ ip6_mforward(ip6, ifp, m)
/*
* Determine forwarding mifs from the forwarding cache table
*/
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
s = splnet();
-#endif
+
MF6CFIND(ip6->ip6_src, ip6->ip6_dst, rt);
/* Entry exists, so forward if necessary */
@@ -1270,11 +1129,8 @@ expire_upcalls(unused)
int i;
int s;
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
s = splnet();
-#endif
+
for (i = 0; i < MF6CTBLSIZ; i++) {
if (nexpire[i] == 0)
continue;
@@ -1316,9 +1172,6 @@ expire_upcalls(unused)
}
}
splx(s);
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- expire_upcalls_ch =
-#endif
timeout(expire_upcalls, (caddr_t)NULL, EXPIRE_TIMEOUT);
}
@@ -1456,11 +1309,7 @@ phyint_send(ip6, mifp, m)
register struct mbuf *mb_copy;
struct ifnet *ifp = mifp->m6_ifp;
int error = 0;
-#ifdef __NetBSD__
- int s = splsoftnet();
-#else
int s = splnet();
-#endif
static struct route_in6 ro6;
struct in6_multi *in6m;
@@ -1542,16 +1391,6 @@ phyint_send(ip6, mifp, m)
return;
#else
#ifdef MRT6DEBUG
-#ifdef __NetBSD__
- if (mrt6debug & DEBUG_DEBUG_XMIT)
- log(LOG_DEBUG,
- "phyint_send: packet too big on %s o %s g %s"
- " size %d(discarded)\n",
- ifp->if_xname,
- ip6_sprintf(&ip6->ip6_src),
- ip6_sprintf(&ip6->ip6_dst),
- mb_copy->m_pkthdr.len);
-#else
if (mrt6debug & DEBUG_XMIT)
log(LOG_DEBUG,
"phyint_send: packet too big on %s%u o %s g %s"
@@ -1560,7 +1399,6 @@ phyint_send(ip6, mifp, m)
ip6_sprintf(&ip6->ip6_src),
ip6_sprintf(&ip6->ip6_dst),
mb_copy->m_pkthdr.len);
-#endif /* __NetBSD__ */
#endif /* MRT6DEBUG */
m_freem(mb_copy); /* simply discard the packet */
return;
@@ -1840,14 +1678,9 @@ pim6_input(mp, offp, proto)
}
#endif
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- rc = if_simloop(mif6table[reg_mif_num].m6_ifp, m,
- (struct sockaddr *) &dst, NULL);
-#else
rc = looutput(mif6table[reg_mif_num].m6_ifp, m,
(struct sockaddr *) &dst,
(struct rtentry *) NULL);
-#endif
/* prepare the register head to send to the mrouting daemon */
m = mcp;
diff --git a/sys/netinet6/ip6_mroute.h b/sys/netinet6/ip6_mroute.h
index d577d290231..9060d359a3b 100644
--- a/sys/netinet6/ip6_mroute.h
+++ b/sys/netinet6/ip6_mroute.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_mroute.h,v 1.1 1999/12/08 06:50:21 itojun Exp $ */
+/* $OpenBSD: ip6_mroute.h,v 1.2 1999/12/10 10:04:28 angelos Exp $ */
/*
* Copyright (C) 1998 WIDE Project.
@@ -240,13 +240,8 @@ struct rtdetq { /* XXX: rtdetq is also defined in ip_mroute.h */
#define MAX_UPQ6 4 /* max. no of pkts in upcall Q */
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-int ip6_mrouter_set __P((struct socket *so, struct sockopt *sopt));
-int ip6_mrouter_get __P((struct socket *so, struct sockopt *sopt));
-#else
int ip6_mrouter_set __P((int, struct socket *, struct mbuf *));
int ip6_mrouter_get __P((int, struct socket *, struct mbuf **));
-#endif
int ip6_mrouter_done __P((void));
int mrt6_ioctl __P((int, caddr_t));
#endif /* _KERNEL */
diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index c1784604fad..04041b4bade 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_output.c,v 1.1 1999/12/08 06:50:21 itojun Exp $ */
+/* $OpenBSD: ip6_output.c,v 1.2 1999/12/10 10:04:28 angelos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -64,16 +64,6 @@
* @(#)ip_output.c 8.3 (Berkeley) 1/21/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/malloc.h>
#include <sys/mbuf.h>
@@ -82,12 +72,6 @@
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/systm.h>
-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3)
-#include <sys/kernel.h>
-#endif
-#if defined(__bsdi__) && _BSDI_VERSION >= 199802
-#include <machine/pcpu.h>
-#endif
#include <sys/proc.h>
#include <net/if.h>
@@ -95,33 +79,18 @@
#include <netinet/in.h>
#include <netinet/in_var.h>
-#if defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802)
#include <netinet/in_systm.h>
#include <netinet/ip.h>
-#endif
+#include <netinet/in_pcb.h>
+
#include <netinet6/ip6.h>
#include <netinet6/icmp6.h>
-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802)
-#include <netinet/in_pcb.h>
-#else
-#include <netinet6/in6_pcb.h>
-#endif
#include <netinet6/ip6_var.h>
#include <netinet6/nd6.h>
-#ifdef __OpenBSD__ /*KAME IPSEC*/
#undef IPSEC
-#endif
-#ifdef IPSEC
-#include <netinet6/ipsec.h>
-#include <netkey/key.h>
-#include <netkey/key_debug.h>
-#endif /* IPSEC */
-
-#ifndef __bsdi__
#include "loop.h"
-#endif
#include <net/net_osdep.h>
@@ -129,10 +98,6 @@
#include <netinet6/ip6_fw.h>
#endif
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-static MALLOC_DEFINE(M_IPMOPTS, "ip6_moptions", "internet multicast options");
-#endif
-
struct ip6_exthdrs {
struct mbuf *ip6e_ip6;
struct mbuf *ip6e_hbh;
@@ -141,13 +106,8 @@ struct ip6_exthdrs {
struct mbuf *ip6e_dest2;
};
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-static int ip6_pcbopts __P((struct ip6_pktopts **, struct mbuf *,
- struct socket *, struct sockopt *sopt));
-#else
static int ip6_pcbopts __P((struct ip6_pktopts **, struct mbuf *,
struct socket *));
-#endif
static int ip6_setmoptions __P((int, struct ip6_moptions **, struct mbuf *));
static int ip6_getmoptions __P((int, struct ip6_moptions *, struct mbuf **));
static int ip6_copyexthdr __P((struct mbuf **, caddr_t, int));
@@ -155,16 +115,8 @@ 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 *));
-#ifdef __bsdi__
-#if _BSDI_VERSION < 199802
-extern struct ifnet loif;
-#else
extern struct ifnet *loifp;
-#endif
-#endif
-#if defined(__NetBSD__) || defined(__OpenBSD__)
extern struct ifnet loif[NLOOP];
-#endif
/*
* IP6 output. The packet in mbuf chain m contains a skeletal IP6
@@ -197,9 +149,7 @@ ip6_output(m0, opt, ro, flags, im6o, ifpp)
struct route_in6 *ro_pmtu = NULL;
int hdrsplit = 0;
int needipsec = 0;
-#if defined(__bsdi__) && _BSDI_VERSION < 199802
- struct ifnet *loifp = &loif;
-#endif
+
#ifdef IPSEC
int needipsectun = 0;
struct socket *so;
@@ -571,18 +521,11 @@ skip_ipsec2:;
* ifp must point it.
*/
if (ro->ro_rt == 0) {
-#if defined(__NetBSD__) || defined(__OpenBSD__)
/*
* NetBSD/OpenBSD always clones routes, if parent is
* PRF_CLONING.
*/
rtalloc((struct route *)ro);
-#else
- if (ro == &ip6route) /* xxx kazu */
- rtalloc((struct route *)ro);
- else
- rtcalloc((struct route *)ro);
-#endif
}
if (ro->ro_rt == 0) {
ip6stat.ip6s_noroute++;
@@ -661,11 +604,7 @@ skip_ipsec2:;
goto bad;
}
else {
-#if defined(__bsdi__)
- ifp = loifp;
-#else
ifp = &loif[0];
-#endif
}
}
@@ -682,11 +621,7 @@ skip_ipsec2:;
if (ifp == NULL) {
if (ro->ro_rt == 0) {
ro->ro_rt = rtalloc1((struct sockaddr *)
- &ro->ro_dst, 0
-#ifdef __FreeBSD__
- , 0UL
-#endif
- );
+ &ro->ro_dst, 0);
}
if (ro->ro_rt == 0) {
ip6stat.ip6s_noroute++;
@@ -781,11 +716,7 @@ skip_ipsec2:;
sin6_fin->sin6_len = sizeof(struct sockaddr_in6);
sin6_fin->sin6_addr = finaldst;
-#ifdef __FreeBSD__
- rtcalloc((struct route *)ro_pmtu);
-#else
rtalloc((struct route *)ro_pmtu);
-#endif
}
}
if (ro_pmtu->ro_rt != NULL) {
@@ -890,17 +821,6 @@ skip_ipsec2:;
#endif
)
{
-#if defined(__NetBSD__) && defined(IFA_STATS)
- if (IFA_STATS) {
- struct in6_ifaddr *ia6;
- ip6 = mtod(m, struct ip6_hdr *);
- ia6 = in6_ifawithifp(ifp, &ip6->ip6_src);
- if (ia6) {
- ia->ia_ifa.ifa_data.ifad_outbytes +=
- m->m_pkthdr.len;
- }
- }
-#endif
#ifdef OLDIP6OUTPUT
error = (*ifp->if_output)(ifp, m, (struct sockaddr *)dst,
ro->ro_rt);
@@ -1025,17 +945,6 @@ sendorfree:
m0 = m->m_nextpkt;
m->m_nextpkt = 0;
if (error == 0) {
-#if defined(__NetBSD__) && defined(IFA_STATS)
- if (IFA_STATS) {
- struct in6_ifaddr *ia6;
- ip6 = mtod(m, struct ip6_hdr *);
- ia6 = in6_ifawithifp(ifp, &ip6->ip6_src);
- if (ia6) {
- ia->ia_ifa.ifa_data.ifad_outbytes +=
- m->m_pkthdr.len;
- }
- }
-#endif
#ifdef OLDIP6OUTPUT
error = (*ifp->if_output)(ifp, m,
(struct sockaddr *)dst,
@@ -1230,96 +1139,31 @@ ip6_insertfraghdr(m0, m, hlen, frghdrp)
/*
* IP6 socket option processing.
*/
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-int
-ip6_ctloutput(so, sopt)
- struct socket *so;
- struct sockopt *sopt;
-#else
int
ip6_ctloutput(op, so, level, optname, mp)
int op;
struct socket *so;
int level, optname;
struct mbuf **mp;
-#endif
{
int privileged;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- register struct inpcb *in6p = sotoinpcb(so);
- int error, optval;
- int level, op, optname;
- int optlen;
- struct proc *p;
-
- if (sopt) {
- level = sopt->sopt_level;
- op = sopt->sopt_dir;
- optname = sopt->sopt_name;
- optlen = sopt->sopt_valsize;
- p = sopt->sopt_p;
- } else {
- panic("ip6_ctloutput: arg soopt is NULL");
- }
-#else
-#ifdef HAVE_NRL_INPCB
register struct inpcb *inp = sotoinpcb(so);
-#else
- register struct in6pcb *in6p = sotoin6pcb(so);
-#endif
register struct mbuf *m = *mp;
int error, optval;
int optlen;
-#if defined(__NetBSD__) || (defined(__FreeBSD__) && __FreeBSD__ >= 3)
- struct proc *p = curproc; /* XXX */
-#endif
optlen = m ? m->m_len : 0;
-#endif
error = optval = 0;
-#if defined(__NetBSD__) || (defined(__FreeBSD__) && __FreeBSD__ >= 3)
- privileged = (p == 0 || suser(p->p_ucred, &p->p_acflag)) ? 0 : 1;
-#else
-#ifdef HAVE_NRL_INPCB
privileged = (inp->inp_socket->so_state & SS_PRIV);
-#else
- privileged = (in6p->in6p_socket->so_state & SS_PRIV);
-#endif
-#endif
if (level == IPPROTO_IPV6) {
switch (op) {
-
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- case SOPT_SET:
-#else
case PRCO_SETOPT:
-#endif
switch (optname) {
case IPV6_PKTOPTIONS:
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- {
- struct mbuf *m;
-
- error = soopt_getm(sopt, &m); /* XXX */
- if (error != NULL)
- break;
- error = soopt_mcopyin(sopt, m); /* XXX */
- if (error != NULL)
- break;
- return (ip6_pcbopts(&in6p->in6p_outputopts,
- m, so, sopt));
- }
-#else
-#ifdef HAVE_NRL_INPCB
return(ip6_pcbopts(&inp->inp_outputopts6,
m, so));
-#else
- return(ip6_pcbopts(&in6p->in6p_outputopts,
- m, so));
-#endif
-#endif
case IPV6_HOPOPTS:
case IPV6_DSTOPTS:
if (!privileged) {
@@ -1336,22 +1180,10 @@ ip6_ctloutput(op, so, level, optname, mp)
case IPV6_RTHDR:
case IPV6_CHECKSUM:
case IPV6_FAITH:
-#ifdef MAPPED_ADDR_ENABLED
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- case IPV6_BINDV6ONLY:
-#endif
-#endif /* MAPPED_ADDR_ENABLED */
if (optlen != sizeof(int))
error = EINVAL;
else {
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- error = sooptcopyin(sopt, &optval,
- sizeof optval, sizeof optval);
- if (error)
- break;
-#else
optval = *mtod(m, int *);
-#endif
switch (optname) {
case IPV6_UNICAST_HOPS:
@@ -1359,35 +1191,14 @@ ip6_ctloutput(op, so, level, optname, mp)
error = EINVAL;
else {
/* -1 = kernel default */
-#ifdef HAVE_NRL_INPCB
inp->inp_hops = optval;
-#else
- in6p->in6p_hops = optval;
-
-#if defined(MAPPED_ADDR_ENABLED)
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- if ((in6p->in6p_vflag &
- INP_IPV4) != 0)
- in6p->inp_ip_ttl = optval;
-#endif
-#endif
-#endif
}
break;
-#ifdef HAVE_NRL_INPCB
#define OPTSET(bit) \
if (optval) \
inp->inp_flags |= bit; \
else \
inp->inp_flags &= ~bit;
-#else
-#define OPTSET(bit) \
- if (optval) \
- in6p->in6p_flags |= bit; \
- else \
- in6p->in6p_flags &= ~bit;
-#endif
-
case IPV6_RECVOPTS:
OPTSET(IN6P_RECVOPTS);
break;
@@ -1421,24 +1232,12 @@ ip6_ctloutput(op, so, level, optname, mp)
break;
case IPV6_CHECKSUM:
-#ifdef HAVE_NRL_INPCB
inp->inp_csumoffset = optval;
-#else
- in6p->in6p_cksum = optval;
-#endif
break;
case IPV6_FAITH:
OPTSET(IN6P_FAITH);
break;
-
-#ifdef MAPPED_ADDR_ENABLED
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- case IPV6_BINDV6ONLY:
- OPTSET(IN6P_BINDV6ONLY);
- break;
-#endif
-#endif /* MAPPED_ADDR_ENABLED */
}
}
break;
@@ -1449,53 +1248,15 @@ ip6_ctloutput(op, so, level, optname, mp)
case IPV6_MULTICAST_LOOP:
case IPV6_JOIN_GROUP:
case IPV6_LEAVE_GROUP:
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- {
- struct mbuf *m;
- if (sopt->sopt_valsize > MLEN) {
- error = EMSGSIZE;
- break;
- }
- /* XXX */
- MGET(m, sopt->sopt_p ? M_WAIT : M_DONTWAIT, MT_HEADER);
- if (m == 0) {
- error = ENOBUFS;
- break;
- }
- m->m_len = sopt->sopt_valsize;
- error = sooptcopyin(sopt, mtod(m, char *),
- m->m_len, m->m_len);
- error = ip6_setmoptions(sopt->sopt_name,
- &in6p->in6p_moptions,
- m);
- (void)m_free(m);
- }
-#else
-#ifdef HAVE_NRL_INPCB
error = ip6_setmoptions(optname,
&inp->inp_moptions6, m);
-#else
- error = ip6_setmoptions(optname,
- &in6p->in6p_moptions, m);
-#endif
-#endif
break;
-#ifndef __bsdi__
case IPV6_PORTRANGE:
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- error = sooptcopyin(sopt, &optval, sizeof optval,
- sizeof optval);
- if (error)
- break;
-#else
optval = *mtod(m, int *);
-#endif
-#ifdef HAVE_NRL_INPCB
# define in6p inp
# define in6p_flags inp_flags
-#endif
switch (optval) {
case IPV6_PORTRANGE_DEFAULT:
in6p->in6p_flags &= ~(IN6P_LOWPORT);
@@ -1516,34 +1277,18 @@ ip6_ctloutput(op, so, level, optname, mp)
error = EINVAL;
break;
}
-#ifdef HAVE_NRL_INPCB
# undef in6p
# undef in6p_flags
-#endif
break;
-#endif
#ifdef IPSEC
case IPV6_IPSEC_POLICY:
{
caddr_t req = NULL;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- struct mbuf *m;
-#endif
-
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- if (error = soopt_getm(sopt, &m)) /* XXX */
- break;
- if (error = soopt_mcopyin(sopt, m)) /* XXX */
- break;
-#endif
if (m != 0)
req = mtod(m, caddr_t);
error = ipsec6_set_policy(in6p, optname, req,
privileged);
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- m_freem(m);
-#endif
}
break;
#endif /* IPSEC */
@@ -1554,24 +1299,10 @@ ip6_ctloutput(op, so, level, optname, mp)
case IPV6_FW_FLUSH:
case IPV6_FW_ZERO:
{
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- struct mbuf *m;
- struct mbuf **mp = &m;
-#endif
-
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- if (ip6_fw_ctl_ptr == NULL)
- return EINVAL;
- if (error = soopt_getm(sopt, &m)) /* XXX */
- break;
- if (error = soopt_mcopyin(sopt, m)) /* XXX */
- break;
-#else
if (ip6_fw_ctl_ptr == NULL) {
if (m) (void)m_free(m);
return EINVAL;
}
-#endif
error = (*ip6_fw_ctl_ptr)(optname, mp);
m = *mp;
}
@@ -1582,36 +1313,15 @@ ip6_ctloutput(op, so, level, optname, mp)
error = ENOPROTOOPT;
break;
}
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
if (m)
(void)m_free(m);
-#endif
break;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- case SOPT_GET:
-#else
case PRCO_GETOPT:
-#endif
switch (optname) {
case IPV6_OPTIONS:
case IPV6_RETOPTS:
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-#if 0
- if (in6p->in6p_options) {
- error = sooptcopyout(sopt,
- mtod(in6p->in6p_options,
- char *),
- in6p->in6p_options->m_len);
- } else
- sopt->sopt_valsize = 0;
- break;
-#else
- error = ENOPROTOOPT;
- break;
-#endif
-#else
#if 0
*mp = m = m_get(M_WAIT, MT_SOOPTS);
if (in6p->in6p_options) {
@@ -1626,16 +1336,8 @@ ip6_ctloutput(op, so, level, optname, mp)
error = ENOPROTOOPT;
break;
#endif
-#endif
case IPV6_PKTOPTIONS:
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- if (in6p->in6p_options) {
- error = soopt_mcopyout(sopt,
- in6p->in6p_options);
- } else
- sopt->sopt_valsize = 0;
-#elif defined(HAVE_NRL_INPCB)
if (inp->inp_options) {
*mp = m_copym(inp->inp_options, 0,
M_COPYALL, M_WAIT);
@@ -1643,15 +1345,6 @@ ip6_ctloutput(op, so, level, optname, mp)
*mp = m_get(M_WAIT, MT_SOOPTS);
(*mp)->m_len = 0;
}
-#else
- if (in6p->in6p_options) {
- *mp = m_copym(in6p->in6p_options, 0,
- M_COPYALL, M_WAIT);
- } else {
- *mp = m_get(M_WAIT, MT_SOOPTS);
- (*mp)->m_len = 0;
- }
-#endif
break;
case IPV6_HOPOPTS:
@@ -1670,26 +1363,13 @@ ip6_ctloutput(op, so, level, optname, mp)
case IPV6_RTHDR:
case IPV6_CHECKSUM:
case IPV6_FAITH:
-#ifdef MAPPED_ADDR_ENABLED
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- case IPV6_BINDV6ONLY:
-#endif
-#endif /* MAPPED_ADDR_ENABLED */
switch (optname) {
case IPV6_UNICAST_HOPS:
-#ifdef HAVE_NRL_INPCB
optval = inp->inp_hops;
-#else
- optval = in6p->in6p_hops;
-#endif
break;
-#ifdef HAVE_NRL_INPCB
#define OPTBIT(bit) (inp->inp_flags & bit ? 1 : 0)
-#else
-#define OPTBIT(bit) (in6p->in6p_flags & bit ? 1 : 0)
-#endif
case IPV6_RECVOPTS:
optval = OPTBIT(IN6P_RECVOPTS);
@@ -1724,34 +1404,18 @@ ip6_ctloutput(op, so, level, optname, mp)
break;
case IPV6_CHECKSUM:
-#ifdef HAVE_NRL_INPCB
optval = inp->inp_csumoffset;
-#else
- optval = in6p->in6p_cksum;
-#endif
break;
case IPV6_FAITH:
optval = OPTBIT(IN6P_FAITH);
break;
-#ifdef MAPPED_ADDR_ENABLED
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- case IPV6_BINDV6ONLY:
- optval = OPTBIT(IN6P_BINDV6ONLY);
- break;
-#endif
-#endif /* MAPPED_ADDR_ENABLED */
-
-#ifndef __bsdi__
case IPV6_PORTRANGE:
{
int flags;
-#ifdef HAVE_NRL_INPCB
+
flags = inp->inp_flags;
-#else
- flags = in6p->in6p_flags;
-#endif
if (flags & IN6P_HIGHPORT)
optval = IPV6_PORTRANGE_HIGH;
else if (flags & IN6P_LOWPORT)
@@ -1760,16 +1424,10 @@ ip6_ctloutput(op, so, level, optname, mp)
optval = 0;
break;
}
-#endif
}
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- error = sooptcopyout(sopt, &optval,
- sizeof optval);
-#else
*mp = m = m_get(M_WAIT, MT_SOOPTS);
m->m_len = sizeof(int);
*mtod(m, int *) = optval;
-#endif
break;
case IPV6_MULTICAST_IF:
@@ -1777,21 +1435,7 @@ ip6_ctloutput(op, so, level, optname, mp)
case IPV6_MULTICAST_LOOP:
case IPV6_JOIN_GROUP:
case IPV6_LEAVE_GROUP:
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- {
- struct mbuf *m;
- error = ip6_getmoptions(sopt->sopt_name,
- in6p->in6p_moptions, &m);
- if (error == 0)
- error = sooptcopyout(sopt,
- mtod(m, char *), m->m_len);
- m_freem(m);
- }
-#elif defined(HAVE_NRL_INPCB)
error = ip6_getmoptions(optname, inp->inp_moptions6, mp);
-#else
- error = ip6_getmoptions(optname, in6p->in6p_moptions, mp);
-#endif
break;
#ifdef IPSEC
@@ -1799,20 +1443,12 @@ ip6_ctloutput(op, so, level, optname, mp)
{
caddr_t req = NULL;
int len = 0;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- struct mbuf *m;
- struct mbuf **mp = &m;
-#endif
+
if (m != 0) {
req = mtod(m, caddr_t);
len = m->m_len;
}
error = ipsec6_get_policy(in6p, req, mp);
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- if (error == 0)
- error = soopt_mcopyout(sopt, m); /*XXX*/
- m_freem(m);
-#endif
break;
}
#endif /* IPSEC */
@@ -1820,26 +1456,13 @@ ip6_ctloutput(op, so, level, optname, mp)
#ifdef IPV6FIREWALL
case IPV6_FW_GET:
{
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- struct mbuf *m;
- struct mbuf **mp = &m;
-#endif
-
if (ip6_fw_ctl_ptr == NULL)
{
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
if (m)
(void)m_free(m);
-#endif
return EINVAL;
}
error = (*ip6_fw_ctl_ptr)(optname, mp);
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- if (error == 0)
- error = soopt_mcopyout(sopt, m); /* XXX */
- if (m)
- m_freem(m);
-#endif
}
break;
#endif
@@ -1852,10 +1475,8 @@ ip6_ctloutput(op, so, level, optname, mp)
}
} else {
error = EINVAL;
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
if (op == PRCO_SETOPT && *mp)
(void)m_free(*mp);
-#endif
}
return(error);
}
@@ -1866,27 +1487,14 @@ ip6_ctloutput(op, so, level, optname, mp)
* with destination address if source routed.
*/
static int
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-ip6_pcbopts(pktopt, m, so, sopt)
-#else
ip6_pcbopts(pktopt, m, so)
-#endif
struct ip6_pktopts **pktopt;
register struct mbuf *m;
struct socket *so;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- struct sockopt *sopt;
-#endif
{
register struct ip6_pktopts *opt = *pktopt;
int error = 0;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- struct proc *p = sopt->sopt_p;
-#elif defined(__bsdi__) && _BSDI_VERSION >= 199802
- struct proc *p = PCPU(curproc); /* XXX */
-#else
struct proc *p = curproc; /* XXX */
-#endif
int priv = 0;
/* turn off any old options. */
@@ -1937,14 +1545,7 @@ ip6_setmoptions(optname, im6op, m)
struct route_in6 ro;
struct sockaddr_in6 *dst;
struct in6_multi_mship *imm;
-#if defined(__bsdi__) && _BSDI_VERSION >= 199802
- struct proc *p = PCPU(curproc); /* XXX */
-#else
struct proc *p = curproc; /* XXX */
-#endif
-#if defined(__bsdi__) && _BSDI_VERSION < 199802
- struct ifnet *loifp = &loif;
-#endif
if (im6o == NULL) {
/*
@@ -2065,11 +1666,7 @@ ip6_setmoptions(optname, im6op, m)
* XXX: is it a good approach?
*/
if (IN6_IS_ADDR_MC_NODELOCAL(&mreq->ipv6mr_multiaddr)) {
-#if defined(__bsdi__)
- ifp = loifp;
-#else
ifp = &loif[0];
-#endif
}
else {
ro.ro_rt = NULL;
@@ -2227,11 +1824,7 @@ ip6_getmoptions(optname, im6o, mp)
{
u_int *hlim, *loop, *ifindex;
-#ifdef __FreeBSD__
- *mp = m_get(M_WAIT, MT_HEADER); /*XXX*/
-#else
*mp = m_get(M_WAIT, MT_SOOPTS);
-#endif
switch (optname) {
@@ -2461,11 +2054,7 @@ ip6_mloopback(ifp, m, dst)
copym = m_copy(m, 0, M_COPYALL);
if (copym != NULL) {
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- (void)if_simloop(ifp, copym, (struct sockaddr *)dst, NULL);
-#else
(void)looutput(ifp, copym, (struct sockaddr *)dst, NULL);
-#endif
}
}
@@ -2504,10 +2093,9 @@ ip6_splithdr(m, exthdrs)
/*
* Compute IPv6 extension header length.
*/
-#ifdef HAVE_NRL_INPCB
# define in6pcb inpcb
# define in6p_outputopts inp_outputopts6
-#endif
+
int
ip6_optlen(in6p)
struct in6pcb *in6p;
@@ -2528,7 +2116,5 @@ ip6_optlen(in6p)
return len;
#undef elen
}
-#ifdef HAVE_NRL_INPCB
# undef in6pcb
# undef in6p_outputopts
-#endif
diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h
index 6bacf3ccbda..dcac54dd1dc 100644
--- a/sys/netinet6/ip6_var.h
+++ b/sys/netinet6/ip6_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_var.h,v 1.1 1999/12/08 06:50:21 itojun Exp $ */
+/* $OpenBSD: ip6_var.h,v 1.2 1999/12/10 10:04:28 angelos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -210,23 +210,10 @@ extern int ip6_dad_count; /* DupAddrDetectionTransmits */
extern u_int32_t ip6_flow_seq;
extern int ip6_auto_flowlabel;
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
struct in6pcb;
-#endif
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-extern struct pr_usrreqs rip6_usrreqs;
-struct sockopt;
-#endif
-
-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802)
struct inpcb;
-#endif
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-int icmp6_ctloutput __P((struct socket *, struct sockopt *sopt));
-#else
int icmp6_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
-#endif
void ip6_init __P((void));
void ip6intr __P((void));
@@ -237,13 +224,8 @@ char * ip6_get_prevhdr __P((struct mbuf *, int));
int ip6_mforward __P((struct ip6_hdr *, struct ifnet *, struct mbuf *));
int ip6_process_hopopts __P((struct mbuf *, u_int8_t *, int, u_int32_t *,
u_int32_t *));
-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802)
void ip6_savecontrol __P((struct inpcb *, struct mbuf **, struct ip6_hdr *,
struct mbuf *));
-#else
-void ip6_savecontrol __P((struct in6pcb *, struct mbuf **, struct ip6_hdr *,
- struct mbuf *));
-#endif
int ip6_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
void ip6_forward __P((struct mbuf *, int));
@@ -252,17 +234,9 @@ void ip6_mloopback __P((struct ifnet *, struct mbuf *, struct sockaddr_in6 *));
int ip6_output __P((struct mbuf *, struct ip6_pktopts *,
struct route_in6 *, int,
struct ip6_moptions *, struct ifnet **));
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-int ip6_ctloutput __P((struct socket *, struct sockopt *sopt));
-#else
int ip6_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
-#endif
int ip6_setpktoptions __P((struct mbuf *, struct ip6_pktopts *, int));
-#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__OpenBSD__) || (defined(__bsdi__) && _BSDI_VERSION >= 199802)
int ip6_optlen __P((struct inpcb *));
-#else
-int ip6_optlen __P((struct in6pcb *));
-#endif
int route6_input __P((struct mbuf **, int *, int));
@@ -273,11 +247,7 @@ void frag6_drain __P((void));
void rip6_init __P((void));
int rip6_input __P((struct mbuf **mp, int *offp, int proto));
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
-int rip6_ctloutput __P((struct socket *so, struct sockopt *sopt));
-#else
int rip6_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
-#endif
int rip6_output __P((struct mbuf *, ...));
int rip6_usrreq __P((struct socket *,
int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *));
diff --git a/sys/netinet6/ip6protosw.h b/sys/netinet6/ip6protosw.h
index c6cf818c8a4..7797403e251 100644
--- a/sys/netinet6/ip6protosw.h
+++ b/sys/netinet6/ip6protosw.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6protosw.h,v 1.1 1999/12/08 06:50:22 itojun Exp $ */
+/* $OpenBSD: ip6protosw.h,v 1.2 1999/12/10 10:04:28 angelos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -81,9 +81,6 @@ struct socket;
struct domain;
struct proc;
struct ip6_hdr;
-#ifdef __FreeBSD__
-struct pr_usrreqs;
-#endif
/*
* argument type for the last arg of pr_ctlinput().
@@ -96,11 +93,7 @@ struct ip6ctlparam {
};
struct ip6protosw {
-#if (defined(__FreeBSD__) && __FreeBSD__ < 3) || defined(__OpenBSD__)
short pr_type; /* socket type used for */
-#else
- int pr_type; /* socket type used for */
-#endif
struct domain *pr_domain; /* domain protocol a member of */
short pr_protocol; /* protocol number */
short pr_flags; /* see below */
@@ -108,27 +101,17 @@ struct ip6protosw {
/* protocol-protocol hooks */
int (*pr_input) /* input to protocol (from below) */
__P((struct mbuf **, int *, int));
-#ifdef __bsdi__
- int (*pr_output)(); /* output to protocol (from above) */
-#else
int (*pr_output) /* output to protocol (from above) */
__P((struct mbuf *, ...));
-#endif
void (*pr_ctlinput) /* control input (from below) */
__P((int, struct sockaddr *, void *));
int (*pr_ctloutput) /* control output (from above) */
__P((int, struct socket *, int, int, struct mbuf **));
/* user-protocol hook */
-#if !(defined(__FreeBSD__) && __FreeBSD__ < 3) && !defined(__bsdi__)
int (*pr_usrreq) /* user request: see list below */
__P((struct socket *, int, struct mbuf *,
struct mbuf *, struct mbuf *, struct proc *));
-#else
- int (*pr_usrreq) /* user request: see list below */
- __P((struct socket *, int, struct mbuf *,
- struct mbuf *, struct mbuf *));
-#endif
/* utility hooks */
void (*pr_init) /* initialization hook */
@@ -140,12 +123,8 @@ struct ip6protosw {
__P((void));
void (*pr_drain) /* flush any excess space possible */
__P((void));
-#ifdef __FreeBSD__
- struct pr_usrreqs *pr_usrreqs; /* supersedes pr_usrreq() */
-#else
int (*pr_sysctl) /* sysctl for protocol */
__P((int *, u_int, void *, size_t *, void *, size_t));
-#endif
};
#endif /* !_NETINET6_IP6PROTOSW_H_ */
diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c
index 3fd26c77f33..d9066563b6e 100644
--- a/sys/netinet6/mld6.c
+++ b/sys/netinet6/mld6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mld6.c,v 1.1 1999/12/08 06:50:23 itojun Exp $ */
+/* $OpenBSD: mld6.c,v 1.2 1999/12/10 10:04:28 angelos Exp $ */
/*
* Copyright (C) 1998 WIDE Project.
@@ -68,13 +68,6 @@
* @(#)igmp.c 8.1 (Berkeley) 7/19/93
*/
-#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/mbuf.h>
@@ -141,11 +134,7 @@ void
mld6_start_listening(in6m)
struct in6_multi *in6m;
{
-#ifdef __NetBSD__
- int s = splsoftnet();
-#else
int s = splnet();
-#endif
/*
* (draft-ietf-ipngwg-mld, page 10)
@@ -196,9 +185,6 @@ mld6_input(m, off)
struct ifnet *ifp = m->m_pkthdr.rcvif;
struct in6_multi *in6m;
struct in6_ifaddr *ia;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- struct ifmultiaddr *ifma;
-#endif
int timer; /* timer value in the MLD query header */
/* source address validation */
@@ -263,30 +249,15 @@ mld6_input(m, off)
mld6_all_nodes_linklocal.s6_addr16[1] =
htons(ifp->if_index); /* XXX */
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
-#else
for (in6m = ia->ia6_multiaddrs.lh_first;
in6m;
in6m = in6m->in6m_entry.le_next)
-#endif
{
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- if (ifma->ifma_addr->sa_family != AF_INET6)
- continue;
- in6m = (struct in6_multi *)ifma->ifma_protospec;
- if (IN6_ARE_ADDR_EQUAL(&in6m->in6m_addr,
- &mld6_all_nodes_linklocal) ||
- IPV6_ADDR_MC_SCOPE(&in6m->in6m_addr) <
- IPV6_ADDR_SCOPE_LINKLOCAL)
- continue;
-#else
if (IN6_ARE_ADDR_EQUAL(&in6m->in6m_addr,
&mld6_all_nodes_linklocal) ||
IPV6_ADDR_MC_SCOPE(&in6m->in6m_addr) <
IPV6_ADDR_SCOPE_LINKLOCAL)
continue;
-#endif
if (IN6_IS_ADDR_UNSPECIFIED(&mldh->mld6_addr) ||
IN6_ARE_ADDR_EQUAL(&mldh->mld6_addr,
@@ -363,11 +334,8 @@ mld6_fasttimeo()
if (!mld6_timers_are_running)
return;
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
s = splnet();
-#endif
+
mld6_timers_are_running = 0;
IN6_FIRST_MULTI(step, in6m);
while (in6m != NULL) {
@@ -420,11 +388,6 @@ mld6_sendpkt(in6m, type, dst)
}
mh->m_next = md;
-#ifdef IPSEC
-#ifndef __OpenBSD__ /*KAME IPSEC*/
- mh->m_pkthdr.rcvif = NULL;
-#endif
-#endif
mh->m_pkthdr.len = sizeof(struct ip6_hdr) + sizeof(struct mld6_hdr);
mh->m_len = sizeof(struct ip6_hdr);
MH_ALIGN(mh, sizeof(struct ip6_hdr));
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index 1a257abe451..5943de5b238 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6.c,v 1.1 1999/12/08 06:50:23 itojun Exp $ */
+/* $OpenBSD: nd6.c,v 1.2 1999/12/10 10:04:28 angelos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -46,34 +46,19 @@
#include <sys/time.h>
#include <sys/kernel.h>
#include <sys/errno.h>
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
#include <sys/ioctl.h>
-#endif
#include <sys/syslog.h>
#include <sys/queue.h>
#include <net/if.h>
#include <net/if_dl.h>
#include <net/if_types.h>
-#if !(defined(__bsdi__) && _BSDI_VERSION >= 199802)
#include <net/if_atm.h>
-#endif
#include <net/route.h>
#include <netinet/in.h>
-#ifndef __NetBSD__
#include <netinet/if_ether.h>
-#ifdef __FreeBSD__
-#include <netinet/if_fddi.h>
-#endif
-#ifdef __bsdi__
-#include <net/if_fddi.h>
-#endif
-#else /* __NetBSD__ */
-#include <net/if_ether.h>
-#include <netinet/if_inarp.h>
-#include <net/if_fddi.h>
-#endif /* __NetBSD__ */
+
#include <netinet6/in6_var.h>
#include <netinet6/ip6.h>
#include <netinet6/ip6_var.h>
@@ -81,12 +66,9 @@
#include <netinet6/in6_prefix.h>
#include <netinet6/icmp6.h>
-#ifndef __bsdi__
#include "loop.h"
-#endif
-#if defined(__NetBSD__) || defined(__OpenBSD__)
+
extern struct ifnet loif[NLOOP];
-#endif
#include <net/net_osdep.h>
@@ -204,20 +186,9 @@ nd6_setmtu(ifp)
case IFT_ETHER:
ndi->maxmtu = MIN(ETHERMTU, ifp->if_mtu);
break;
-#if defined(__FreeBSD__) || defined(__bsdi__)
- case IFT_FDDI:
-#if defined(__bsdi__) && _BSDI_VERSION >= 199802
- ndi->maxmtu = MIN(FDDIMTU, ifp->if_mtu);
-#else
- ndi->maxmtu = MIN(FDDIIPMTU, ifp->if_mtu);
-#endif
- break;
-#endif
-#if !(defined(__bsdi__) && _BSDI_VERSION >= 199802)
case IFT_ATM:
ndi->maxmtu = MIN(ATMMTU, ifp->if_mtu);
break;
-#endif
default:
ndi->maxmtu = ifp->if_mtu;
break;
@@ -397,15 +368,10 @@ nd6_timer(ignored_arg)
register struct llinfo_nd6 *ln;
register struct nd_defrouter *dr;
register struct nd_prefix *pr;
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
long time_second = time.tv_sec;
-#endif
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
s = splnet();
-#endif
+
timeout(nd6_timer, (caddr_t)0, nd6_prune * hz);
ln = llinfo_nd6.ln_next;
@@ -575,11 +541,7 @@ nd6_lookup(addr6, create, ifp)
sin6.sin6_len = sizeof(struct sockaddr_in6);
sin6.sin6_family = AF_INET6;
sin6.sin6_addr = *addr6;
- rt = rtalloc1((struct sockaddr *)&sin6, create
-#ifdef __FreeBSD__
- , 0UL
-#endif /*__FreeBSD__*/
- );
+ rt = rtalloc1((struct sockaddr *)&sin6, create);
if (rt && (rt->rt_flags & RTF_LLINFO) == 0) {
/*
* This is the case for the default route.
@@ -676,13 +638,9 @@ nd6_is_addr_neighbor(addr, ifp)
* If the address matches one of our addresses,
* it should be a neighbor.
*/
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
- for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next)
-#else
for (ifa = ifp->if_addrlist.tqh_first;
ifa;
ifa = ifa->ifa_list.tqe_next)
-#endif
{
if (ifa->ifa_addr->sa_family != AF_INET6)
next: continue;
@@ -724,11 +682,8 @@ nd6_free(rt)
int s;
in6 = &((struct sockaddr_in6 *)rt_key(rt))->sin6_addr;
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
s = splnet();
-#endif
+
dr = defrouter_lookup(&((struct sockaddr_in6 *)rt_key(rt))->
sin6_addr,
rt->rt_ifp);
@@ -767,9 +722,7 @@ nd6_nud_hint(rt, dst6)
struct in6_addr *dst6;
{
struct llinfo_nd6 *ln;
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
long time_second = time.tv_sec;
-#endif
/*
* If the caller specified "rt", use that. Otherwise, resolve the
@@ -822,9 +775,7 @@ nd6_resolve(ifp, rt, m, dst, desten)
{
struct llinfo_nd6 *ln = (struct llinfo_nd6 *)NULL;
struct sockaddr_dl *sdl;
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
long time_second = time.tv_sec;
-#endif
if (m->m_flags & M_MCAST) {
switch (ifp->if_type) {
@@ -900,26 +851,17 @@ nd6_resolve(ifp, rt, m, dst, desten)
#endif /* OLDIP6OUTPUT */
void
-#if defined(__bsdi__) && _BSDI_VERSION >= 199802
-nd6_rtrequest(req, rt, info)
- int req;
- struct rtentry *rt;
- struct rt_addrinfo *info; /* xxx unused */
-#else
nd6_rtrequest(req, rt, sa)
int req;
struct rtentry *rt;
struct sockaddr *sa; /* xxx unused */
-#endif
{
struct sockaddr *gate = rt->rt_gateway;
struct llinfo_nd6 *ln = (struct llinfo_nd6 *)rt->rt_llinfo;
static struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK};
struct ifnet *ifp = rt->rt_ifp;
struct ifaddr *ifa;
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
long time_second = time.tv_sec;
-#endif
if (rt->rt_flags & RTF_GATEWAY)
return;
@@ -1033,17 +975,7 @@ nd6_rtrequest(req, rt, sa)
SDL(gate)->sdl_alen = ifp->if_addrlen;
}
if (nd6_useloopback) {
-#ifdef __bsdi__
-#if _BSDI_VERSION >= 199802
- extern struct ifnet *loifp;
- rt->rt_ifp = loifp; /*XXX*/
-#else
- extern struct ifnet loif;
- rt->rt_ifp = &loif; /*XXX*/
-#endif
-#else /* non-bsdi */
rt->rt_ifp = &loif[0]; /*XXX*/
-#endif
/*
* Make sure rt_ifa be equal to the ifaddr
* corresponding to the address.
@@ -1081,17 +1013,10 @@ nd6_rtrequest(req, rt, sa)
}
void
-#if defined(__bsdi__) && _BSDI_VERSION >= 199802
-nd6_p2p_rtrequest(req, rt, info)
- int req;
- struct rtentry *rt;
- struct rt_addrinfo *info; /* xxx unused */
-#else
nd6_p2p_rtrequest(req, rt, sa)
int req;
struct rtentry *rt;
struct sockaddr *sa; /* xxx unused */
-#endif
{
struct sockaddr *gate = rt->rt_gateway;
static struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK};
@@ -1139,17 +1064,7 @@ nd6_p2p_rtrequest(req, rt, sa)
&SIN6(rt_key(rt))->sin6_addr);
if (ifa) {
if (nd6_useloopback) {
-#ifdef __bsdi__
-#if _BSDI_VERSION >= 199802
- extern struct ifnet *loifp;
- rt->rt_ifp = loifp; /*XXX*/
-#else
- extern struct ifnet loif;
- rt->rt_ifp = &loif; /*XXX*/
-#endif
-#else
rt->rt_ifp = &loif[0]; /*XXX*/
-#endif /*__bsdi__*/
}
}
break;
@@ -1175,11 +1090,9 @@ nd6_ioctl(cmd, data, ifp)
switch (cmd) {
case SIOCGDRLST_IN6:
bzero(drl, sizeof(*drl));
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
+
s = splnet();
-#endif
+
dr = nd_defrouter.lh_first;
while (dr && i < DRLSTSIZ) {
drl->defrouter[i].rtaddr = dr->rtaddr;
@@ -1204,11 +1117,9 @@ nd6_ioctl(cmd, data, ifp)
break;
case SIOCGPRLST_IN6:
bzero(prl, sizeof(*prl));
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
+
s = splnet();
-#endif
+
pr = nd_prefix.lh_first;
while (pr && i < PRLSTSIZ) {
struct nd_pfxrouter *pfr;
@@ -1287,11 +1198,8 @@ nd6_ioctl(cmd, data, ifp)
/* flush all the prefix advertised by routers */
struct nd_prefix *pr, *next;
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
s = splnet();
-#endif
+
for (pr = nd_prefix.lh_first; pr; pr = next) {
next = pr->ndpr_next;
if (!IN6_IS_ADDR_UNSPECIFIED(&pr->ndpr_addr))
@@ -1306,11 +1214,8 @@ nd6_ioctl(cmd, data, ifp)
/* flush all the default routers */
struct nd_defrouter *dr, *next;
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
s = splnet();
-#endif
+
if ((dr = nd_defrouter.lh_first) != NULL) {
/*
* The first entry of the list may be stored in
@@ -1342,11 +1247,8 @@ nd6_ioctl(cmd, data, ifp)
*idp = htons(ifp->if_index);
}
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
s = splnet();
-#endif
+
if ((rt = nd6_lookup(&nb_addr, 0, ifp)) == NULL) {
error = EINVAL;
break;
@@ -1385,9 +1287,7 @@ nd6_cache_lladdr(ifp, from, lladdr, lladdrlen, type, code)
int olladdr;
int llchange;
int newstate = 0;
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
long time_second = time.tv_sec;
-#endif
if (!ifp)
panic("ifp == NULL in nd6_cache_lladdr");
@@ -1579,11 +1479,8 @@ static void
nd6_slowtimo(ignored_arg)
void *ignored_arg;
{
-#ifdef __NetBSD__
- int s = splsoftnet();
-#else
int s = splnet();
-#endif
+
register int i;
register struct nd_ifinfo *nd6if;
@@ -1617,9 +1514,7 @@ nd6_output(ifp, m0, dst, rt0)
register struct rtentry *rt = rt0;
struct llinfo_nd6 *ln = NULL;
int error = 0;
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
long time_second = time.tv_sec;
-#endif
if (IN6_IS_ADDR_MULTICAST(&dst->sin6_addr))
goto sendpkt;
@@ -1642,13 +1537,8 @@ nd6_output(ifp, m0, dst, rt0)
*/
if (rt) {
if ((rt->rt_flags & RTF_UP) == 0) {
-#ifdef __FreeBSD__
- if ((rt0 = rt = rtalloc1((struct sockaddr *)dst, 1, 0UL)) !=
- NULL)
-#else
if ((rt0 = rt = rtalloc1((struct sockaddr *)dst, 1)) !=
NULL)
-#endif
{
rt->rt_refcnt--;
if (rt->rt_ifp != ifp)
@@ -1661,22 +1551,9 @@ nd6_output(ifp, m0, dst, rt0)
goto lookup;
if (((rt = rt->rt_gwroute)->rt_flags & RTF_UP) == 0) {
rtfree(rt); rt = rt0;
-#ifdef __FreeBSD__
- lookup: rt->rt_gwroute = rtalloc1(rt->rt_gateway, 1, 0UL);
-#else
lookup: rt->rt_gwroute = rtalloc1(rt->rt_gateway, 1);
-#endif
if ((rt = rt->rt_gwroute) == 0)
senderr(EHOSTUNREACH);
-#ifdef __bsdi__
- /* the "G" test below also prevents rt == rt0 */
- if ((rt->rt_flags & RTF_GATEWAY) ||
- (rt->rt_ifp != ifp)) {
- rt->rt_refcnt--;
- rt0->rt_gwroute = 0;
- senderr(EHOSTUNREACH);
- }
-#endif
}
}
if (rt->rt_flags & RTF_REJECT)
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index fe7f6dcb3b3..a6ae910d6cf 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_nbr.c,v 1.3 1999/12/08 19:53:39 deraadt Exp $ */
+/* $OpenBSD: nd6_nbr.c,v 1.4 1999/12/10 10:04:28 angelos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -29,13 +29,6 @@
* SUCH DAMAGE.
*/
-#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>
@@ -45,9 +38,7 @@
#include <sys/time.h>
#include <sys/kernel.h>
#include <sys/errno.h>
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
#include <sys/ioctl.h>
-#endif
#include <sys/syslog.h>
#include <sys/queue.h>
@@ -197,11 +188,7 @@ nd6_ns_input(m, off, icmp6len)
tsin6.sin6_family = AF_INET6;
tsin6.sin6_addr = taddr6;
- rt = rtalloc1((struct sockaddr *)&tsin6, 0
-#ifdef __FreeBSD__
- , 0
-#endif /* __FreeBSD__ */
- );
+ rt = rtalloc1((struct sockaddr *)&tsin6, 0);
if (rt && rt->rt_ifp != ifp) {
/*
* search link local addr for ifp, and use it for
@@ -462,11 +449,6 @@ nd6_ns_output(ifp, daddr6, taddr6, ln, dad)
nd_ns->nd_ns_cksum
= in6_cksum(m, IPPROTO_ICMPV6, sizeof(*ip6), icmp6len);
-#ifdef IPSEC
-#ifndef __OpenBSD__ /*KAME IPSEC*/
- m->m_pkthdr.rcvif = NULL;
-#endif
-#endif /*IPSEC*/
ip6_output(m, NULL, NULL, dad ? IPV6_DADOUTPUT : 0, &im6o, &outif);
if (outif) {
icmp6_ifstat_inc(outif, ifs6_out_msg);
@@ -598,11 +580,7 @@ nd6_na_input(m, off, icmp6len)
if (is_solicited) {
ln->ln_state = ND6_LLINFO_REACHABLE;
if (ln->ln_expire)
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
ln->ln_expire = time.tv_sec +
-#else
- ln->ln_expire = time_second +
-#endif
nd_ifinfo[rt->rt_ifp->if_index].reachable;
} else
ln->ln_state = ND6_LLINFO_STALE;
@@ -671,11 +649,7 @@ nd6_na_input(m, off, icmp6len)
if (is_solicited) {
ln->ln_state = ND6_LLINFO_REACHABLE;
if (ln->ln_expire) {
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
ln->ln_expire = time.tv_sec +
-#else
- ln->ln_expire = time_second +
-#endif
nd_ifinfo[ifp->if_index].reachable;
}
} else {
@@ -695,11 +669,9 @@ nd6_na_input(m, off, icmp6len)
int s;
in6 = &((struct sockaddr_in6 *)rt_key(rt))->sin6_addr;
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
+
s = splnet();
-#endif
+
dr = defrouter_lookup(in6, rt->rt_ifp);
if (dr)
defrtrlist_del(dr);
@@ -831,11 +803,6 @@ nd6_na_output(ifp, daddr6, taddr6, flags, tlladdr)
nd_na->nd_na_cksum =
in6_cksum(m, IPPROTO_ICMPV6, sizeof(struct ip6_hdr), icmp6len);
-#ifdef IPSEC
-#ifndef __OpenBSD__ /*KAME IPSEC*/
- m->m_pkthdr.rcvif = NULL;
-#endif
-#endif /*IPSEC*/
ip6_output(m, NULL, NULL, 0, &im6o, &outif);
if (outif) {
icmp6_ifstat_inc(outif, ifs6_out_msg);
@@ -852,11 +819,7 @@ nd6_ifptomac(ifp)
case IFT_ARCNET:
case IFT_ETHER:
case IFT_FDDI:
-#ifdef __NetBSD__
- return LLADDR(ifp->if_sadl);
-#else
return ((caddr_t)(ifp + 1));
-#endif
break;
default:
return NULL;
@@ -872,9 +835,6 @@ struct dadq {
int dad_ns_ocount; /* NS sent so far */
int dad_ns_icount;
int dad_na_icount;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- struct callout_handle dad_timer;
-#endif
};
static struct dadq_head dadq;
@@ -969,9 +929,6 @@ nd6_dad_start(ifa, tick)
dp->dad_ns_ocount = dp->dad_ns_tcount = 0;
if (!tick) {
nd6_dad_ns_output(dp, ifa);
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- dp->dad_timer =
-#endif
timeout((void (*) __P((void *)))nd6_dad_timer, (void *)ifa,
nd_ifinfo[ifa->ifa_ifp->if_index].retrans * hz / 1000);
} else {
@@ -982,9 +939,6 @@ nd6_dad_start(ifa, tick)
else
ntick = *tick + random() % (hz / 2);
*tick = ntick;
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- dp->dad_timer =
-#endif
timeout((void (*) __P((void *)))nd6_dad_timer, (void *)ifa,
ntick);
}
@@ -998,11 +952,7 @@ nd6_dad_timer(ifa)
struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa;
struct dadq *dp;
-#ifdef __NetBSD__
- s = splsoftnet(); /*XXX*/
-#else
s = splnet(); /*XXX*/
-#endif
/* Sanity check */
if (ia == NULL) {
@@ -1047,9 +997,6 @@ nd6_dad_timer(ifa)
* We have more NS to go. Send NS packet for DAD.
*/
nd6_dad_ns_output(dp, ifa);
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- dp->dad_timer =
-#endif
timeout((void (*) __P((void *)))nd6_dad_timer, (void *)ifa,
nd_ifinfo[ifa->ifa_ifp->if_index].retrans * hz / 1000);
} else {
@@ -1150,11 +1097,7 @@ nd6_dad_duplicated(ifa)
ia->ia6_flags |= IN6_IFF_DUPLICATED;
/* We are done with DAD, with duplicated address found. (failure) */
- untimeout((void (*) __P((void *)))nd6_dad_timer, (void *)ifa
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
- , dp->dad_timer
-#endif
- );
+ untimeout((void (*) __P((void *)))nd6_dad_timer, (void *)ifa);
printf("%s: DAD complete for %s - duplicate found\n",
if_name(ifa->ifa_ifp), ip6_sprintf(&ia->ia_addr.sin6_addr));
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
index b71b16b7eae..3264eb16e84 100644
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6_rtr.c,v 1.1 1999/12/08 06:50:23 itojun Exp $ */
+/* $OpenBSD: nd6_rtr.c,v 1.2 1999/12/10 10:04:28 angelos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -38,9 +38,7 @@
#include <sys/time.h>
#include <sys/kernel.h>
#include <sys/errno.h>
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
#include <sys/ioctl.h>
-#endif
#include <sys/syslog.h>
#include <net/if.h>
@@ -213,9 +211,7 @@ nd6_ra_input(m, off, icmp6len)
{
struct nd_defrouter dr0;
u_int32_t advreachable = nd_ra->nd_ra_reachable;
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
long time_second = time.tv_sec;
-#endif
dr0.rtaddr = saddr6;
dr0.flags = nd_ra->nd_ra_flags_reserved;
@@ -400,11 +396,8 @@ defrouter_addreq(new)
gate.sin6_addr = new->rtaddr;
#if 1
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
s = splnet();
-#endif
+
(void)rtrequest(RTM_ADD, (struct sockaddr *)&def,
(struct sockaddr *)&gate, (struct sockaddr *)&mask,
RTF_GATEWAY, NULL);
@@ -417,16 +410,8 @@ defrouter_addreq(new)
if ((rnh = rt_tables[AF_INET6]) == 0)
return;
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
s = splnet();
-#endif
-#ifdef __NetBSD__
- rt = pool_get(&rtentry_pool, PR_NOWAIT);
-#else
R_Malloc(rt, struct rtentry *, sizeof(*rt));
-#endif
if (!rt)
goto bad;
Bzero(rt, sizeof(*rt));
@@ -549,11 +534,7 @@ defrtrlist_update(new)
struct nd_defrouter *new;
{
struct nd_defrouter *dr, *n;
-#ifdef __NetBSD__
- int s = splsoftnet();
-#else
int s = splnet();
-#endif
if ((dr = defrouter_lookup(&new->rtaddr, new->ifp)) != NULL) {
/* entry exists */
@@ -681,11 +662,8 @@ prelist_add(pr, dr)
/* xxx ND_OPT_PI_FLAG_ONLINK processing */
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
s = splnet();
-#endif
+
/* link ndpr_entry to nd_prefix list */
LIST_INSERT_HEAD(&nd_prefix, new, ndpr_entry);
splx(s);
@@ -703,11 +681,8 @@ prelist_remove(pr)
struct nd_pfxrouter *pfr, *next;
int s;
-#ifdef __NetBSD__
- s = splsoftnet();
-#else
s = splnet();
-#endif
+
/* unlink ndpr_entry from nd_prefix list */
LIST_REMOVE(pr, ndpr_entry);
splx(s);
@@ -737,11 +712,8 @@ prelist_update(new, dr, m)
{
struct in6_ifaddr *ia6 = NULL;
struct nd_prefix *pr;
-#ifdef __NetBSD__
- int s = splsoftnet();
-#else
int s = splnet();
-#endif
+
int error = 0;
int auth;
struct in6_addrlifetime *lt6;
@@ -1134,18 +1106,10 @@ in6_ifadd(ifp, in6, addr, prefixlen)
in6_ifaddr = ia;
/* link to if_addrlist */
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
- if ((ifa = ifp->if_addrlist) != NULL) {
- for ( ; ifa->ifa_next; ifa = ifa->ifa_next)
- continue;
- ifa->ifa_next = (struct ifaddr *)ia;
- }
-#else
if (ifp->if_addrlist.tqh_first != NULL) {
TAILQ_INSERT_TAIL(&ifp->if_addrlist, (struct ifaddr *)ia,
ifa_list);
}
-#endif
#if 0
else {
/*
@@ -1203,10 +1167,8 @@ in6_ifadd(ifp, in6, addr, prefixlen)
int error; /* not used */
struct in6_addr sol6;
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
/* Restore saved multicast addresses(if any). */
in6_restoremkludge(ia, ifp);
-#endif
/* join solicited node multicast address */
bzero(&sol6, sizeof(sol6));
@@ -1242,9 +1204,6 @@ in6_ifdel(ifp, in6)
struct ifnet *ifp;
struct in6_addr *in6;
{
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
- struct ifaddr *ifa;
-#endif
struct in6_ifaddr *ia = (struct in6_ifaddr *)NULL;
struct in6_ifaddr *oia = (struct in6_ifaddr *)NULL;
@@ -1280,21 +1239,7 @@ in6_ifdel(ifp, in6)
ia->ia_flags &= ~IFA_ROUTE;
}
-#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
- if ((ifa = ifp->if_addrlist) == (struct ifaddr *)ia) {
- ifp->if_addrlist = ifa->ifa_next;
- } else {
- while (ifa->ifa_next &&
- (ifa->ifa_next != (struct ifaddr *)ia))
- ifa = ifa->ifa_next;
- if (ifa->ifa_next)
- ifa->ifa_next = ((struct ifaddr *)ia)->ifa_next;
- else
- return -1;
- }
-#else
TAILQ_REMOVE(&ifp->if_addrlist, (struct ifaddr *)ia, ifa_list);
-#endif
/* lladdr is never deleted */
oia = ia;
@@ -1309,9 +1254,7 @@ in6_ifdel(ifp, in6)
return -1;
}
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
in6_savemkludge(oia);
-#endif
IFAFREE((&oia->ia_ifa));
/* xxx
rtrequest(RTM_DELETE,
@@ -1327,9 +1270,7 @@ in6_ifdel(ifp, in6)
int
in6_init_prefix_ltimes(struct nd_prefix *ndpr)
{
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
long time_second = time.tv_sec;
-#endif
/* check if preferred lifetime > valid lifetime */
if (ndpr->ndpr_pltime > ndpr->ndpr_vltime) {
@@ -1355,9 +1296,7 @@ in6_init_address_ltimes(struct nd_prefix *new,
struct in6_addrlifetime *lt6,
int update_vltime)
{
-#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3)
long time_second = time.tv_sec;
-#endif
/* Valid lifetime must not be updated unless explicitly specified. */
if (update_vltime) {
@@ -1398,11 +1337,7 @@ rt6_flush(gateway, ifp)
struct ifnet *ifp;
{
struct radix_node_head *rnh = rt_tables[AF_INET6];
-#ifdef __NetBSD__
- int s = splsoftnet();
-#else
int s = splnet();
-#endif
/* We'll care only link-local addresses */
if (!IN6_IS_ADDR_LINKLOCAL(gateway)) {
diff --git a/sys/netinet6/raw_ipv6.c b/sys/netinet6/raw_ipv6.c
index 3adf99b2002..24d18cae1cf 100644
--- a/sys/netinet6/raw_ipv6.c
+++ b/sys/netinet6/raw_ipv6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ipv6.c,v 1.6 1999/12/10 08:53:18 angelos Exp $ */
+/* $OpenBSD: raw_ipv6.c,v 1.7 1999/12/10 10:04:29 angelos Exp $ */
/*
%%% copyright-nrl-95
This software is Copyright 1995-1998 by Randall Atkinson, Ronald Lee,
@@ -43,7 +43,7 @@ didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
* SUCH DAMAGE.
*
* @(#)raw_ip.c 8.7 (Berkeley) 5/15/95
- * $Id: raw_ipv6.c,v 1.6 1999/12/10 08:53:18 angelos Exp $
+ * $Id: raw_ipv6.c,v 1.7 1999/12/10 10:04:29 angelos Exp $
*/
#include <sys/param.h>
@@ -71,9 +71,7 @@ didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
#include <netinet6/ip6_var.h>
#include <netinet6/icmp6.h>
-#if __OpenBSD__
#undef IPSEC
-#endif /* __OpenBSD__ */
/*
* Globals
@@ -577,13 +575,13 @@ rip6_ctloutput (op, so, level, optname, m)
return ip6_ctloutput(op, so, level, optname, m);
}
-#if __GNUC__ && __GNUC__ >= 2 && __OPTIMIZE__ && !__FreeBSD__
+#if __GNUC__ && __GNUC__ >= 2 && __OPTIMIZE__
#define MAYBESTATIC static
#define MAYBEINLINE __inline__
-#else /* __GNUC__ && __GNUC__ >= 2 && __OPTIMIZE__ && !__FreeBSD__ */
+#else /* __GNUC__ && __GNUC__ >= 2 && __OPTIMIZE__ */
#define MAYBESTATIC
#define MAYBEINLINE
-#endif /* __GNUC__ && __GNUC__ >= 2 && __OPTIMIZE__ && !__FreeBSD__ */
+#endif /* __GNUC__ && __GNUC__ >= 2 && __OPTIMIZE__ */
MAYBESTATIC MAYBEINLINE int rip6_usrreq_attach(struct socket *so, int proto)
{