summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>1999-12-25 07:09:44 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>1999-12-25 07:09:44 +0000
commit3a07de35f8cbb40c0d89df12d80bfbc4de0bcb6a (patch)
treebce79d979890ed81a8b555a6e5eddff5ccf0022b /sys
parent094791be4d235c40b2f3721658af000361b03dac (diff)
Change some function prototypes, dont unnecessarily initialize some
variables.
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/ip_ah.h4
-rw-r--r--sys/netinet/ip_esp.h4
-rw-r--r--sys/netinet/ip_ipsp.c21
-rw-r--r--sys/netinet/ipsec_input.c26
4 files changed, 30 insertions, 25 deletions
diff --git a/sys/netinet/ip_ah.h b/sys/netinet/ip_ah.h
index bebee36834c..090d6e48195 100644
--- a/sys/netinet/ip_ah.h
+++ b/sys/netinet/ip_ah.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ah.h,v 1.19 1999/12/09 10:11:11 angelos Exp $ */
+/* $OpenBSD: ip_ah.h,v 1.20 1999/12/25 07:09:42 angelos Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
@@ -103,7 +103,7 @@ int ah_output __P((struct mbuf *, struct tdb *, struct mbuf **));
int ah_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
#ifdef INET6
-void ah6_input __P((struct mbuf *, ...));
+int ah6_input __P((struct mbuf *, ...));
#endif /* INET6 */
extern int ah_enable;
diff --git a/sys/netinet/ip_esp.h b/sys/netinet/ip_esp.h
index e2279094f32..3cd5c4b1902 100644
--- a/sys/netinet/ip_esp.h
+++ b/sys/netinet/ip_esp.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_esp.h,v 1.26 1999/12/09 00:33:29 angelos Exp $ */
+/* $OpenBSD: ip_esp.h,v 1.27 1999/12/25 07:09:42 angelos Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
@@ -97,7 +97,7 @@ int esp_output __P((struct mbuf *, struct tdb *, struct mbuf **));
int esp_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
#ifdef INET6
-void esp6_input __P((struct mbuf *, ...));
+int esp6_input __P((struct mbuf *, ...));
#endif /* INET6 */
extern int esp_enable;
diff --git a/sys/netinet/ip_ipsp.c b/sys/netinet/ip_ipsp.c
index 8f6b4a6bcc7..80c36fbb6af 100644
--- a/sys/netinet/ip_ipsp.c
+++ b/sys/netinet/ip_ipsp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ipsp.c,v 1.60 1999/12/25 04:48:16 angelos Exp $ */
+/* $OpenBSD: ip_ipsp.c,v 1.61 1999/12/25 07:09:42 angelos Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
@@ -1619,29 +1619,26 @@ ipsp_process_packet(struct mbuf *m, struct mbuf **mp, struct tdb *tdb, int *af,
{
ip->ip_len = htons(m->m_pkthdr.len);
ip->ip_sum = in_cksum(m, ip->ip_hl << 2);
- i = ip->ip_hl << 2;
- off = offsetof(struct ip, ip_p);
}
#endif /* INET */
#ifdef INET6
/* Fix IPv6 header payload length */
if ((*af) == AF_INET6)
- {
- ip6->ip6_plen = htons(m->m_pkthdr.len);
- i = sizeof(struct ip6_hdr);
- off = offsetof(struct ip6_hdr, ip6_nxt);
- }
+ ip6->ip6_plen = htons(m->m_pkthdr.len);
#endif /* INET6 */
- /* Encapsulate */
- error = ipe4_output(m, tdb, mp, i, off);
- if ((*mp) == NULL)
+ /* Encapsulate -- the last two arguments are unused */
+ error = ipe4_output(m, tdb, mp, 0, 0);
+ if (((*mp) == NULL) && (!error))
error = EFAULT;
if (error)
{
if (*mp)
- m_freem(*mp);
+ {
+ m_freem(*mp);
+ *mp = NULL;
+ }
return error;
}
diff --git a/sys/netinet/ipsec_input.c b/sys/netinet/ipsec_input.c
index b9921bda314..aada36e372e 100644
--- a/sys/netinet/ipsec_input.c
+++ b/sys/netinet/ipsec_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipsec_input.c,v 1.1 1999/12/09 10:15:23 angelos Exp $ */
+/* $OpenBSD: ipsec_input.c,v 1.2 1999/12/25 07:09:43 angelos Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
@@ -569,34 +569,42 @@ esp_input(struct mbuf *m, ...)
#ifdef INET6
/* IPv6 AH wrapper */
-void
+int
ah6_input(struct mbuf *m, ...)
{
- int skip, protoff;
+ int *skip, protoff;
va_list ap;
va_start(ap, m);
- skip = va_arg(ap, int);
+ skip = va_arg(ap, int *);
protoff = va_arg(ap, int);
va_end(ap);
- ipsec_common_input(m, skip, protoff, AF_INET6, IPPROTO_AH);
+ ipsec_common_input(m, *skip, protoff, AF_INET6, IPPROTO_AH);
+
+ /* Retrieve new protocol */
+ m_copydata(m, protoff, sizeof(u_int8_t), (caddr_t) &protoff);
+ return protoff;
}
/* IPv6 ESP wrapper */
-void
+int
esp6_input(struct mbuf *m, ...)
{
- int skip, protoff;
+ int *skip, protoff;
va_list ap;
va_start(ap, m);
- skip = va_arg(ap, int);
+ skip = va_arg(ap, int *);
protoff = va_arg(ap, int);
va_end(ap);
- ipsec_common_input(m, skip, protoff, AF_INET6, IPPROTO_ESP);
+ ipsec_common_input(m, *skip, protoff, AF_INET6, IPPROTO_ESP);
+
+ /* Retrieve new protocol */
+ m_copydata(m, protoff, sizeof(u_int8_t), (caddr_t) &protoff);
+ return protoff;
}
#endif /* INET6 */