summaryrefslogtreecommitdiff
path: root/sys/netinet/ipsec_output.c
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2015-04-14 14:20:02 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2015-04-14 14:20:02 +0000
commit63675cfb1c78af0c144d56eebf10e405b371b9d8 (patch)
treedeb12b887c6036fa5ab1dfa0371643a65d2fc6d1 /sys/netinet/ipsec_output.c
parente02a1355682b8cfa42063a33a6a10a2eaae840a9 (diff)
make ipsp_address thread safe; ok mpi
Diffstat (limited to 'sys/netinet/ipsec_output.c')
-rw-r--r--sys/netinet/ipsec_output.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/netinet/ipsec_output.c b/sys/netinet/ipsec_output.c
index 95717a3627b..2814ec0327a 100644
--- a/sys/netinet/ipsec_output.c
+++ b/sys/netinet/ipsec_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipsec_output.c,v 1.56 2015/01/24 00:29:06 deraadt Exp $ */
+/* $OpenBSD: ipsec_output.c,v 1.57 2015/04/14 14:20:01 mikeb Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
*
@@ -80,6 +80,10 @@ ipsp_process_packet(struct mbuf *m, struct tdb *tdb, int af, int tunalready)
struct ip6_hdr *ip6;
#endif /* INET6 */
+#ifdef ENCDEBUG
+ char buf[INET6_ADDRSTRLEN];
+#endif
+
/* Check that the transform is allowed by the administrator. */
if ((tdb->tdb_sproto == IPPROTO_ESP && !esp_enable) ||
(tdb->tdb_sproto == IPPROTO_AH && !ah_enable) ||
@@ -100,8 +104,8 @@ ipsp_process_packet(struct mbuf *m, struct tdb *tdb, int af, int tunalready)
/* Check if the SPI is invalid. */
if (tdb->tdb_flags & TDBF_INVALID) {
DPRINTF(("ipsp_process_packet(): attempt to use invalid "
- "SA %s/%08x/%u\n", ipsp_address(tdb->tdb_dst),
- ntohl(tdb->tdb_spi), tdb->tdb_sproto));
+ "SA %s/%08x/%u\n", ipsp_address(&tdb->tdb_dst, buf,
+ sizeof(buf)), ntohl(tdb->tdb_spi), tdb->tdb_sproto));
m_freem(m);
return ENXIO;
}
@@ -119,8 +123,9 @@ ipsp_process_packet(struct mbuf *m, struct tdb *tdb, int af, int tunalready)
default:
DPRINTF(("ipsp_process_packet(): attempt to use "
"SA %s/%08x/%u for protocol family %d\n",
- ipsp_address(tdb->tdb_dst), ntohl(tdb->tdb_spi),
- tdb->tdb_sproto, tdb->tdb_dst.sa.sa_family));
+ ipsp_address(&tdb->tdb_dst, buf, sizeof(buf)),
+ ntohl(tdb->tdb_spi), tdb->tdb_sproto,
+ tdb->tdb_dst.sa.sa_family));
m_freem(m);
return ENXIO;
}
@@ -576,7 +581,7 @@ ipsec_adjust_mtu(struct mbuf *m, u_int32_t mtu)
tdbp->tdb_mtu = mtu;
tdbp->tdb_mtutimeout = time_second + ip_mtudisc_timeout;
DPRINTF(("ipsec_adjust_mtu: "
- "spi %08x mtu %d adjust %d mbuf %p\n",
+ "spi %08x mtu %d adjust %ld mbuf %p\n",
ntohl(tdbp->tdb_spi), tdbp->tdb_mtu,
adjust, m));
}