Skip to content

Commit

Permalink
sync with freebsd53 and makes it compilable
Browse files Browse the repository at this point in the history
(their behavior is not confirmed yet...)
  • Loading branch information
suz committed Nov 11, 2004
1 parent fb5256e commit dc63141
Show file tree
Hide file tree
Showing 22 changed files with 337 additions and 111 deletions.
10 changes: 10 additions & 0 deletions kame/kame/v6test/common.h
Expand Up @@ -65,6 +65,16 @@

#include "pathnames.h"

#ifndef HTONS
#define HTONS(x) (x) = htons(x)
#endif
#ifndef HTONL
#define HTONL(x) (x) = htonl(x)
#endif
#ifndef NTOHS
#define NTOHS(x) (x) = ntohs(x)
#endif

extern u_char buf[];

extern int getconfig __P((char *, u_char *));
Expand Down
34 changes: 21 additions & 13 deletions kame/sys/net/if_dummy.c
@@ -1,4 +1,4 @@
/* $KAME: if_dummy.c,v 1.27 2004/05/21 08:46:15 itojun Exp $ */
/* $KAME: if_dummy.c,v 1.28 2004/11/11 22:34:44 suz Exp $ */

/*
* Copyright (c) 1982, 1986, 1993
Expand Down Expand Up @@ -193,13 +193,11 @@ dummyoutput(ifp, m, dst, rt)
struct sockaddr *dst;
struct rtentry *rt;
{
#if (defined(__FreeBSD__) && __FreeBSD_version >= 500000)
int error;
#else
#if !(defined(__FreeBSD__) && __FreeBSD_version >= 500000)
int s;
struct ifqueue *ifq = 0;
#endif
int isr;
struct ifqueue *ifq = 0;

if ((m->m_flags & M_PKTHDR) == 0)
panic("dummyoutput no HDR");
Expand Down Expand Up @@ -248,37 +246,49 @@ dummyoutput(ifp, m, dst, rt)

#ifdef INET
case AF_INET:
#if !(defined(__FreeBSD__) && __FreeBSD_version >= 503000)
ifq = &ipintrq;
#endif
isr = NETISR_IP;
break;
#endif
#ifdef IPX
case AF_IPX:
#if !(defined(__FreeBSD__) && __FreeBSD_version >= 503000)
ifq = &ipxintrq;
#endif
isr = NETISR_IPX;
break;
#endif
#ifdef INET6
case AF_INET6:
#if !(defined(__FreeBSD__) && __FreeBSD_version >= 503000)
ifq = &ip6intrq;
#endif
isr = NETISR_IPV6;
break;
#endif
#ifdef NS
case AF_NS:
#if !(defined(__FreeBSD__) && __FreeBSD_version >= 503000)
ifq = &nsintrq;
#endif
isr = NETISR_NS;
break;
#endif
#ifdef ISO
case AF_ISO:
#if !(defined(__FreeBSD__) && __FreeBSD_version >= 503000)
ifq = &clnlintrq;
#endif
isr = NETISR_ISO;
break;
#endif
#ifdef NETATALK
case AF_APPLETALK:
#if !(defined(__FreeBSD__) && __FreeBSD_version >= 503000)
ifq = &atintrq2;
#endif
isr = NETISR_ATALK;
break;
#endif
Expand All @@ -289,10 +299,10 @@ dummyoutput(ifp, m, dst, rt)
return (EAFNOSUPPORT);
}

#if (defined(__FreeBSD__) && __FreeBSD_version >= 500000)
IFQ_HANDOFF(ifp, m, NULL, error);
if (error)
return (error);
#if (defined(__FreeBSD__) && __FreeBSD_version >= 503000)
ifp->if_ipackets++;
ifp->if_ibytes += m->m_pkthdr.len;
netisr_queue(isr, m);
#else
#ifdef __NetBSD__
s = splnet();
Expand All @@ -306,14 +316,12 @@ dummyoutput(ifp, m, dst, rt)
return (ENOBUFS);
}
IF_ENQUEUE(ifq, m);
#endif /* !FreeBSD5 */

schednetisr(isr);
ifp->if_ipackets++;
ifp->if_ibytes += m->m_pkthdr.len;
#if !(defined(__FreeBSD__) && __FreeBSD_version >= 500000)
splx(s);
#endif
#endif /* !FreeBSD5 */

return (0);
}

Expand Down
26 changes: 13 additions & 13 deletions kame/sys/net/if_faith.c
@@ -1,4 +1,4 @@
/* $KAME: if_faith.c,v 1.39 2004/05/26 09:56:15 itojun Exp $ */
/* $KAME: if_faith.c,v 1.40 2004/11/11 22:34:45 suz Exp $ */

/*
* Copyright (c) 1982, 1986, 1993
Expand Down Expand Up @@ -182,13 +182,11 @@ faithoutput(ifp, m, dst, rt)
struct sockaddr *dst;
struct rtentry *rt;
{
#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
int error;
#else
#if !(defined(__FreeBSD__) && __FreeBSD_version >= 500000)
int s;
struct ifqueue *ifq = NULL;
#endif
int isr;
struct ifqueue *ifq = 0;

if ((m->m_flags & M_PKTHDR) == 0)
panic("faithoutput no HDR");
Expand Down Expand Up @@ -235,13 +233,17 @@ faithoutput(ifp, m, dst, rt)
switch (dst->sa_family) {
#ifdef INET
case AF_INET:
#if !(defined(__FreeBSD__) && __FreeBSD_version >= 503000)
ifq = &ipintrq;
#endif
isr = NETISR_IP;
break;
#endif
#ifdef INET6
case AF_INET6:
#if !(defined(__FreeBSD__) && __FreeBSD_version >= 503000)
ifq = &ip6intrq;
#endif
isr = NETISR_IPV6;
break;
#endif
Expand All @@ -254,10 +256,10 @@ faithoutput(ifp, m, dst, rt)

m->m_pkthdr.rcvif = ifp;

#if (defined(__FreeBSD__) && __FreeBSD_version >= 500000)
IFQ_HANDOFF(ifp, m, NULL, error);
if (error)
return (error);
#if (defined(__FreeBSD__) && __FreeBSD_version >= 503000)
ifp->if_ipackets++;
ifp->if_ibytes += m->m_pkthdr.len;
netisr_queue(isr, m);
#else
#ifdef __NetBSD__
s = splnet();
Expand All @@ -271,14 +273,12 @@ faithoutput(ifp, m, dst, rt)
return (ENOBUFS);
}
IF_ENQUEUE(ifq, m);
#endif /* !FreeBSD5 */

schednetisr(isr);
ifp->if_ipackets++;
ifp->if_ibytes += m->m_pkthdr.len;
#if !(defined(__FreeBSD__) && __FreeBSD_version >= 500000)
splx(s);
#endif
#endif /* !FreeBSD5 */

return (0);
}

Expand Down
41 changes: 32 additions & 9 deletions kame/sys/net/if_gif.c
@@ -1,4 +1,4 @@
/* $KAME: if_gif.c,v 1.110 2004/07/27 13:11:59 suz Exp $ */
/* $KAME: if_gif.c,v 1.111 2004/11/11 22:34:45 suz Exp $ */

/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
Expand Down Expand Up @@ -337,11 +337,24 @@ gif_output(ifp, m, dst, rt)
struct gif_softc *sc = (struct gif_softc*)ifp;
int error = 0;
static int called = 0; /* XXX: MUTEX */
#if !(defined(__FreeBSD__) && __FreeBSD_version >= 503000)
ALTQ_DECL(struct altq_pktattr pktattr;)
#endif
int s;
struct m_tag *mtag;

#if !(defined(__FreeBSD__) && __FreeBSD_version >= 503000)
ALTQ_DECL(struct altq_pktattr pktattr;)
IFQ_CLASSIFY(&ifp->if_snd, m, dst->sa_family, &pktattr);
#endif

#ifdef MAC
error = mac_check_ifnet_transmit(ifp, m);
if (error) {
m_freem(m);
goto end;
}
#endif

/*
* gif may cause infinite recursion calls when misconfigured.
Expand Down Expand Up @@ -407,7 +420,11 @@ gif_output(ifp, m, dst, rt)
*mtod(m, int *) = dst->sa_family;

s = splnet();
#if (defined(__FreeBSD__) && __FreeBSD_version >= 503000)
IFQ_ENQUEUE(&ifp->if_snd, m, error);
#else
IFQ_ENQUEUE(&ifp->if_snd, m, &pktattr, error);
#endif
if (error) {
splx(s);
goto end;
Expand Down Expand Up @@ -523,9 +540,9 @@ gif_input(m, af, ifp)
{
#if !(defined(__FreeBSD__) && __FreeBSD_version >= 500000)
int s;
struct ifqueue *ifq = NULL;
#endif
int isr;
struct ifqueue *ifq = NULL;

if (ifp == NULL) {
/* just in case */
Expand Down Expand Up @@ -574,13 +591,17 @@ gif_input(m, af, ifp)
switch (af) {
#ifdef INET
case AF_INET:
#if !(defined(__FreeBSD__) && __FreeBSD_version >= 503000)
ifq = &ipintrq;
#endif
isr = NETISR_IP;
break;
#endif
#ifdef INET6
case AF_INET6:
#if !(defined(__FreeBSD__) && __FreeBSD_version >= 503000)
ifq = &ip6intrq;
#endif
isr = NETISR_IPV6;
break;
#endif
Expand All @@ -589,7 +610,9 @@ gif_input(m, af, ifp)
m = gif_eon_decap(ifp, m);
if (!m)
return;
#if !(defined(__FreeBSD__) && __FreeBSD_version >= 503000)
ifq = &clnlintrq;
#endif
isr = NETISR_ISO;
break;
#endif
Expand All @@ -598,9 +621,11 @@ gif_input(m, af, ifp)
return;
}

#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
if (!IF_HANDOFF(ifq, m, NULL))
return;
#if defined(__FreeBSD__) && __FreeBSD_version >= 503000
ifp->if_ipackets++;
ifp->if_ibytes += m->m_pkthdr.len;
netisr_queue(isr, m);
return;
#else
#ifdef __NetBSD__
s = splnet();
Expand All @@ -614,16 +639,14 @@ gif_input(m, af, ifp)
return;
}
IF_ENQUEUE(ifq, m);
#endif

ifp->if_ipackets++;
ifp->if_ibytes += m->m_pkthdr.len;

/* we need schednetisr since the address family may change */
schednetisr(isr);

#if !(defined(__FreeBSD__) && __FreeBSD_version >= 500000)
splx(s);
#endif

return;
}
#endif /*!OpenBSD*/
Expand Down
8 changes: 5 additions & 3 deletions kame/sys/net/pfkeyv2.h
@@ -1,4 +1,4 @@
/* $KAME: pfkeyv2.h,v 1.38 2003/09/10 21:10:32 itojun Exp $ */
/* $KAME: pfkeyv2.h,v 1.39 2004/11/11 22:34:45 suz Exp $ */

/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
Expand Down Expand Up @@ -307,7 +307,8 @@ struct sadb_x_tag {
#define SADB_SATYPE_MIP 8
#define SADB_X_SATYPE_IPCOMP 9
/*#define SADB_X_SATYPE_POLICY 10 obsolete, do not reuse */
#define SADB_SATYPE_MAX 11
#define SADB_X_SATYPE_TCPSIGNATURE 11
#define SADB_SATYPE_MAX 12

#define SADB_SASTATE_LARVAL 0
#define SADB_SASTATE_MATURE 1
Expand All @@ -321,7 +322,7 @@ struct sadb_x_tag {
#define SADB_AALG_NONE 0
#define SADB_AALG_MD5HMAC 2
#define SADB_AALG_SHA1HMAC 3
#define SADB_AALG_MAX 251
#define SADB_AALG_MAX 252
/* private allocations - based on RFC2407/IANA assignment */
#define SADB_X_AALG_SHA2_256 5
#define SADB_X_AALG_SHA2_384 6
Expand All @@ -332,6 +333,7 @@ struct sadb_x_tag {
#define SADB_X_AALG_MD5 249 /* Keyed MD5 */
#define SADB_X_AALG_SHA 250 /* Keyed SHA */
#define SADB_X_AALG_NULL 251 /* null authentication */
#define SADB_X_AALG_TCP_MD5 252 /* Keyed TCP-MD5 (RFC2385) */

/* RFC2367 numbers - meets RFC2407 */
#define SADB_EALG_NONE 0
Expand Down
16 changes: 6 additions & 10 deletions kame/sys/netinet6/ah_input.c
@@ -1,4 +1,4 @@
/* $KAME: ah_input.c,v 1.90 2004/06/02 05:53:14 itojun Exp $ */
/* $KAME: ah_input.c,v 1.91 2004/11/11 22:34:45 suz Exp $ */

/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
Expand Down Expand Up @@ -502,8 +502,8 @@ ah4_input(m, va_alist)
s = splimp();
#endif

#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
if (!IF_HANDOFF(&ipintrq, m, NULL)) {
#if defined(__FreeBSD__) && __FreeBSD_version >= 503000
if (netisr_queue(NETISR_IP, m)) { /* (0) on success. */
ipsecstat.in_inval++;
m = NULL;
goto fail;
Expand All @@ -515,12 +515,10 @@ ah4_input(m, va_alist)
goto fail;
}
IF_ENQUEUE(&ipintrq, m);
#endif
m = NULL;
schednetisr(NETISR_IP); /* can be skipped but to make sure */
#if !(defined(__FreeBSD__) && __FreeBSD_version >= 500000)
splx(s);
#endif
m = NULL;
nxt = IPPROTO_DONE;
} else {
/*
Expand Down Expand Up @@ -972,7 +970,7 @@ ah6_input(mp, offp, proto)
s = splimp();
#endif
#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
if (!IF_HANDOFF(&ip6intrq, m, NULL)) {
if (netisr_queue(NETISR_IPV6, m)) { /* (0) on success. */
ipsec6stat.in_inval++;
m = NULL;
goto fail;
Expand All @@ -984,12 +982,10 @@ ah6_input(mp, offp, proto)
goto fail;
}
IF_ENQUEUE(&ip6intrq, m);
#endif
m = NULL;
schednetisr(NETISR_IPV6); /* can be skipped but to make sure */
#if !(defined(__FreeBSD__) && __FreeBSD_version >= 500000)
splx(s);
#endif
m = NULL;
nxt = IPPROTO_DONE;
} else {
/*
Expand Down

0 comments on commit dc63141

Please sign in to comment.