diff options
author | 2016-09-13 19:56:55 +0000 | |
---|---|---|
committer | 2016-09-13 19:56:55 +0000 | |
commit | 5db30710efad2fc261c0d000da047a3d4bf759c7 (patch) | |
tree | 666db9a1276e56803a47722944569dc8c5e28c7d /sys/netinet/ip_ipcomp.c | |
parent | Do not mention the libiconv module; it has been removed. (diff) | |
download | wireguard-openbsd-5db30710efad2fc261c0d000da047a3d4bf759c7.tar.xz wireguard-openbsd-5db30710efad2fc261c0d000da047a3d4bf759c7.zip |
avoid extensive mbuf allocation for IPsec by replacing m_inject(4)
with m_makespace(4) from freebsd; ok mpi@, bluhm@, mikeb@, dlg@
Diffstat (limited to 'sys/netinet/ip_ipcomp.c')
-rw-r--r-- | sys/netinet/ip_ipcomp.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/netinet/ip_ipcomp.c b/sys/netinet/ip_ipcomp.c index 120511bf37e..721fe0f40e0 100644 --- a/sys/netinet/ip_ipcomp.c +++ b/sys/netinet/ip_ipcomp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipcomp.c,v 1.46 2016/08/18 06:01:10 dlg Exp $ */ +/* $OpenBSD: ip_ipcomp.c,v 1.47 2016/09/13 19:56:55 markus Exp $ */ /* * Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org) @@ -540,7 +540,7 @@ ipcomp_output_cb(struct cryptop *crp) struct tdb_crypto *tc; struct tdb *tdb; struct mbuf *m, *mo; - int error, s, skip, rlen; + int error, s, skip, rlen, roff; u_int16_t cpi; struct ip *ip; #ifdef INET6 @@ -605,7 +605,7 @@ ipcomp_output_cb(struct cryptop *crp) } /* Inject IPCOMP header */ - mo = m_inject(m, skip, IPCOMP_HLENGTH, M_DONTWAIT); + mo = m_makespace(m, skip, IPCOMP_HLENGTH, &roff); if (mo == NULL) { DPRINTF(("ipcomp_output_cb(): failed to inject IPCOMP header " "for IPCA %s/%08x\n", ipsp_address(&tdb->tdb_dst, buf, @@ -616,7 +616,7 @@ ipcomp_output_cb(struct cryptop *crp) } /* Initialize the IPCOMP header */ - ipcomp = mtod(mo, struct ipcomp *); + ipcomp = (struct ipcomp *)(mtod(mo, caddr_t) + roff); memset(ipcomp, 0, sizeof(struct ipcomp)); cpi = (u_int16_t) ntohl(tdb->tdb_spi); ipcomp->ipcomp_cpi = htons(cpi); |