summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>2000-04-25 02:53:47 +0000
committerJason Wright <jason@cvs.openbsd.org>2000-04-25 02:53:47 +0000
commit3daf0ff9860f69503f134f6fc0b96681256b8ff8 (patch)
tree448968e29cd82238b5f47e2322730f0da31d5191 /sys
parent7ef9d705d6271a867f8322f0fb3cb73a77ad22d3 (diff)
when fixing up the header, copy from the right sized datatype (fixes IPsec
on big-endian machines)
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/ip_ah.c7
-rw-r--r--sys/netinet/ip_esp.c7
2 files changed, 8 insertions, 6 deletions
diff --git a/sys/netinet/ip_ah.c b/sys/netinet/ip_ah.c
index 6473eca75a3..0821daaae26 100644
--- a/sys/netinet/ip_ah.c
+++ b/sys/netinet/ip_ah.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ah.c,v 1.36 2000/03/21 21:00:09 angelos Exp $ */
+/* $OpenBSD: ip_ah.c,v 1.37 2000/04/25 02:53:46 jason Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
@@ -805,6 +805,7 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip,
struct mbuf *mo, *mi;
struct cryptop *crp;
u_int16_t iplen;
+ u_int8_t prot;
int len, rplen;
struct ah *ah;
@@ -1039,8 +1040,8 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip,
tdb->tdb_ref++;
/* Update the Next Protocol field in the IP header and the saved data */
- len = IPPROTO_AH;
- m_copyback(m, protoff, sizeof(u_int8_t), (caddr_t) &len);
+ prot = IPPROTO_AH;
+ m_copyback(m, protoff, sizeof(u_int8_t), (caddr_t) &prot);
((u_int8_t *) crp->crp_opaque4)[protoff] = IPPROTO_AH;
/* "Massage" the packet headers for crypto processing */
diff --git a/sys/netinet/ip_esp.c b/sys/netinet/ip_esp.c
index 0f88bfed327..ccba29bc436 100644
--- a/sys/netinet/ip_esp.c
+++ b/sys/netinet/ip_esp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_esp.c,v 1.40 2000/04/06 16:08:22 deraadt Exp $ */
+/* $OpenBSD: ip_esp.c,v 1.41 2000/04/25 02:53:45 jason Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
@@ -670,6 +670,7 @@ esp_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip,
int ilen, hlen, rlen, plen, padding, blks, alen;
struct mbuf *mi, *mo = (struct mbuf *) NULL;
unsigned char *pad;
+ u_int8_t prot;
struct cryptodesc *crde = NULL, *crda = NULL;
struct cryptop *crp;
@@ -873,8 +874,8 @@ esp_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip,
m_copydata(m, protoff, sizeof(u_int8_t), pad + padding - 1);
/* Fix Next Protocol in IPv4/IPv6 header */
- ilen = IPPROTO_ESP;
- m_copyback(m, protoff, sizeof(u_int8_t), (u_char *) &ilen);
+ prot = IPPROTO_ESP;
+ m_copyback(m, protoff, sizeof(u_int8_t), (u_char *) &prot);
/* Get crypto descriptors */
crp = crypto_getreq(esph && espx ? 2 : 1);