From e8539d32f07691cc34a2dea66d4d66db7e23410f Mon Sep 17 00:00:00 2001 From: Sam Leffler Date: Fri, 8 Nov 2002 23:37:50 +0000 Subject: [PATCH] FAST_IPSEC fixups: o fix #ifdef typo o must use "bounce functions" when dispatched from the protosw table don't know how this stuff was missed in my testing; must've committed the wrong bits Pointy hat: sam Submitted by: "Doug Ambrisko" --- sys/netinet/in_proto.c | 26 +++++++++++++++++++++----- sys/netipsec/ipsec.h | 3 +++ sys/netipsec/ipsec_input.c | 18 ++++++++++++++++++ 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/sys/netinet/in_proto.c b/sys/netinet/in_proto.c index 5ecbe65f9f7..863b048d14f 100644 --- a/sys/netinet/in_proto.c +++ b/sys/netinet/in_proto.c @@ -76,12 +76,8 @@ #include #endif /* IPSEC */ -#ifdef FAST_IPESC +#ifdef FAST_IPSEC #include -#define ah4_input ipsec4_common_input -#define esp4_input ipsec4_common_input -#define ipcomp4_input ipsec4_common_input -#define IPSEC #endif /* FAST_IPSEC */ #ifdef IPXIP @@ -162,6 +158,26 @@ struct protosw inetsw[] = { &nousrreqs }, #endif /* IPSEC */ +#ifdef FAST_IPSEC +{ SOCK_RAW, &inetdomain, IPPROTO_AH, PR_ATOMIC|PR_ADDR, + ah4_input, 0, 0, 0, + 0, + 0, 0, 0, 0, + &nousrreqs +}, +{ SOCK_RAW, &inetdomain, IPPROTO_ESP, PR_ATOMIC|PR_ADDR, + esp4_input, 0, 0, 0, + 0, + 0, 0, 0, 0, + &nousrreqs +}, +{ SOCK_RAW, &inetdomain, IPPROTO_IPCOMP, PR_ATOMIC|PR_ADDR, + ipcomp4_input, 0, 0, 0, + 0, + 0, 0, 0, 0, + &nousrreqs +}, +#endif /* FAST_IPSEC */ { SOCK_RAW, &inetdomain, IPPROTO_IPV4, PR_ATOMIC|PR_ADDR|PR_LASTHDR, encap4_input, 0, 0, rip_ctloutput, 0, diff --git a/sys/netipsec/ipsec.h b/sys/netipsec/ipsec.h index 93b1e23ae69..7f0a021b23f 100644 --- a/sys/netipsec/ipsec.h +++ b/sys/netipsec/ipsec.h @@ -361,6 +361,9 @@ extern const char *ipsec_logsastr __P((struct secasvar *)); extern void ipsec_dumpmbuf __P((struct mbuf *)); struct m_tag; +extern void ah4_input(struct mbuf *m, int off); +extern void esp4_input(struct mbuf *m, int off); +extern void ipcomp4_input(struct mbuf *m, int off); extern int ipsec4_common_input(struct mbuf *m, ...); extern int ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, int protoff, struct m_tag *mt); diff --git a/sys/netipsec/ipsec_input.c b/sys/netipsec/ipsec_input.c index 1d5a3c9daf0..9ebb518b548 100644 --- a/sys/netipsec/ipsec_input.c +++ b/sys/netipsec/ipsec_input.c @@ -201,6 +201,24 @@ ipsec4_common_input(struct mbuf *m, ...) AF_INET, nxt); } +void +ah4_input(struct mbuf *m, int off) +{ + ipsec4_common_input(m, off, IPPROTO_AH); +} + +void +esp4_input(struct mbuf *m, int off) +{ + ipsec4_common_input(m, off, IPPROTO_ESP); +} + +void +ipcomp4_input(struct mbuf *m, int off) +{ + ipsec4_common_input(m, off, IPPROTO_IPCOMP); +} + /* * IPsec input callback for INET protocols. * This routine is called as the transform callback.