summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorBret Lambert <blambert@cvs.openbsd.org>2010-07-02 02:40:18 +0000
committerBret Lambert <blambert@cvs.openbsd.org>2010-07-02 02:40:18 +0000
commitbfc9493d9280a5a8ab43b8df30cd772c910140ba (patch)
tree32334a91bf10c89a8551f90fe6749d45476d9ad8 /sys
parent364840df3893a5f720df05ee307b996c62195a07 (diff)
m_copyback can fail to allocate memory, but is a void fucntion so gymnastics
are required to detect that. Change the function to take a wait argument (used in nfs server, but M_NOWAIT everywhere else for now) and to return an error ok claudio@ henning@ krw@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/via.c6
-rw-r--r--sys/arch/i386/i386/via.c6
-rw-r--r--sys/arch/i386/pci/glxsb.c7
-rw-r--r--sys/crypto/cryptosoft.c6
-rw-r--r--sys/dev/ic/if_wi.c5
-rw-r--r--sys/dev/ic/rtl81x9.c4
-rw-r--r--sys/dev/pci/hifn7751.c9
-rw-r--r--sys/dev/pci/noct.c8
-rw-r--r--sys/dev/pci/safe.c8
-rw-r--r--sys/dev/pci/ubsec.c6
-rw-r--r--sys/dev/sdmmc/sbt.c4
-rw-r--r--sys/dev/usb/ubt.c4
-rw-r--r--sys/kern/uipc_mbuf.c25
-rw-r--r--sys/net/if_bridge.c4
-rw-r--r--sys/net/if_mpe.c6
-rw-r--r--sys/net/if_pflow.c6
-rw-r--r--sys/net/if_vlan.c4
-rw-r--r--sys/net/pf.c60
-rw-r--r--sys/net/pf_norm.c10
-rw-r--r--sys/net/pipex.c5
-rw-r--r--sys/net/rtsock.c6
-rw-r--r--sys/netbt/hci_unit.c4
-rw-r--r--sys/netbt/l2cap_signal.c5
-rw-r--r--sys/netbt/rfcomm_session.c6
-rw-r--r--sys/netinet/ip_ah.c28
-rw-r--r--sys/netinet/ip_esp.c8
-rw-r--r--sys/netinet/ip_ether.c4
-rw-r--r--sys/netinet/ip_ipcomp.c4
-rw-r--r--sys/netinet/ip_mroute.c7
-rw-r--r--sys/netinet/ip_output.c6
-rw-r--r--sys/nfs/nfs_socket.c4
-rw-r--r--sys/sys/mbuf.h4
32 files changed, 152 insertions, 127 deletions
diff --git a/sys/arch/amd64/amd64/via.c b/sys/arch/amd64/amd64/via.c
index 62e50247138..1bbae99dd50 100644
--- a/sys/arch/amd64/amd64/via.c
+++ b/sys/arch/amd64/amd64/via.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: via.c,v 1.5 2010/06/29 22:42:14 deraadt Exp $ */
+/* $OpenBSD: via.c,v 1.6 2010/07/02 02:40:15 blambert Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -379,7 +379,7 @@ viac3_crypto_encdec(struct cryptop *crp, struct cryptodesc *crd,
if ((crd->crd_flags & CRD_F_IV_PRESENT) == 0) {
if (crp->crp_flags & CRYPTO_F_IMBUF)
m_copyback((struct mbuf *)crp->crp_buf,
- crd->crd_inject, 16, sc->op_iv);
+ crd->crd_inject, 16, sc->op_iv, M_NOWAIT);
else if (crp->crp_flags & CRYPTO_F_IOV)
cuio_copyback((struct uio *)crp->crp_buf,
crd->crd_inject, 16, sc->op_iv);
@@ -420,7 +420,7 @@ viac3_crypto_encdec(struct cryptop *crp, struct cryptodesc *crd,
if (crp->crp_flags & CRYPTO_F_IMBUF)
m_copyback((struct mbuf *)crp->crp_buf,
- crd->crd_skip, crd->crd_len, sc->op_buf);
+ crd->crd_skip, crd->crd_len, sc->op_buf, M_NOWAIT);
else if (crp->crp_flags & CRYPTO_F_IOV)
cuio_copyback((struct uio *)crp->crp_buf,
crd->crd_skip, crd->crd_len, sc->op_buf);
diff --git a/sys/arch/i386/i386/via.c b/sys/arch/i386/i386/via.c
index da7206bbf10..5dec39cc89b 100644
--- a/sys/arch/i386/i386/via.c
+++ b/sys/arch/i386/i386/via.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: via.c,v 1.22 2010/06/26 23:24:43 guenther Exp $ */
+/* $OpenBSD: via.c,v 1.23 2010/07/02 02:40:15 blambert Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -380,7 +380,7 @@ viac3_crypto_encdec(struct cryptop *crp, struct cryptodesc *crd,
if ((crd->crd_flags & CRD_F_IV_PRESENT) == 0) {
if (crp->crp_flags & CRYPTO_F_IMBUF)
m_copyback((struct mbuf *)crp->crp_buf,
- crd->crd_inject, 16, sc->op_iv);
+ crd->crd_inject, 16, sc->op_iv, M_NOWAIT);
else if (crp->crp_flags & CRYPTO_F_IOV)
cuio_copyback((struct uio *)crp->crp_buf,
crd->crd_inject, 16, sc->op_iv);
@@ -421,7 +421,7 @@ viac3_crypto_encdec(struct cryptop *crp, struct cryptodesc *crd,
if (crp->crp_flags & CRYPTO_F_IMBUF)
m_copyback((struct mbuf *)crp->crp_buf,
- crd->crd_skip, crd->crd_len, sc->op_buf);
+ crd->crd_skip, crd->crd_len, sc->op_buf, M_NOWAIT);
else if (crp->crp_flags & CRYPTO_F_IOV)
cuio_copyback((struct uio *)crp->crp_buf,
crd->crd_skip, crd->crd_len, sc->op_buf);
diff --git a/sys/arch/i386/pci/glxsb.c b/sys/arch/i386/pci/glxsb.c
index 094483f1fbf..754d500f551 100644
--- a/sys/arch/i386/pci/glxsb.c
+++ b/sys/arch/i386/pci/glxsb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: glxsb.c,v 1.18 2010/01/10 12:43:07 markus Exp $ */
+/* $OpenBSD: glxsb.c,v 1.19 2010/07/02 02:40:15 blambert Exp $ */
/*
* Copyright (c) 2006 Tom Cosgrove <tom@openbsd.org>
@@ -653,7 +653,8 @@ glxsb_crypto_encdec(struct cryptop *crp, struct cryptodesc *crd,
if ((crd->crd_flags & CRD_F_IV_PRESENT) == 0) {
if (crp->crp_flags & CRYPTO_F_IMBUF)
m_copyback((struct mbuf *)crp->crp_buf,
- crd->crd_inject, sizeof(op_iv), op_iv);
+ crd->crd_inject, sizeof(op_iv), op_iv,
+ M_NOWAIT);
else if (crp->crp_flags & CRYPTO_F_IOV)
cuio_copyback((struct uio *)crp->crp_buf,
crd->crd_inject, sizeof(op_iv), op_iv);
@@ -705,7 +706,7 @@ glxsb_crypto_encdec(struct cryptop *crp, struct cryptodesc *crd,
if (crp->crp_flags & CRYPTO_F_IMBUF)
m_copyback((struct mbuf *)crp->crp_buf,
- crd->crd_skip + offset, len, op_dst);
+ crd->crd_skip + offset, len, op_dst, M_NOWAIT);
else if (crp->crp_flags & CRYPTO_F_IOV)
cuio_copyback((struct uio *)crp->crp_buf,
crd->crd_skip + offset, len, op_dst);
diff --git a/sys/crypto/cryptosoft.c b/sys/crypto/cryptosoft.c
index b5627b84ad3..b0d135714ee 100644
--- a/sys/crypto/cryptosoft.c
+++ b/sys/crypto/cryptosoft.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cryptosoft.c,v 1.53 2010/04/20 22:05:41 tedu Exp $ */
+/* $OpenBSD: cryptosoft.c,v 1.54 2010/07/02 02:40:15 blambert Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
@@ -81,7 +81,7 @@ u_int32_t swcr_sesnum = 0;
int32_t swcr_id = -1;
#define COPYBACK(x, a, b, c, d) \
- (x) == CRYPTO_BUF_MBUF ? m_copyback((struct mbuf *)a,b,c,d) \
+ (x) == CRYPTO_BUF_MBUF ? m_copyback((struct mbuf *)a,b,c,d,M_NOWAIT) \
: cuio_copyback((struct uio *)a,b,c,d)
#define COPYDATA(x, a, b, c, d) \
(x) == CRYPTO_BUF_MBUF ? m_copydata((struct mbuf *)a,b,c,d) \
@@ -207,7 +207,7 @@ swcr_encdec(struct cryptodesc *crd, struct swcr_data *sw, caddr_t buf,
}
/* Copy back decrypted block */
- m_copyback(m, k, blks, blk);
+ m_copyback(m, k, blks, blk, M_NOWAIT);
/* Advance pointer */
m = m_getptr(m, k + blks, &k);
diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c
index 7355ce948d6..3911135ed5f 100644
--- a/sys/dev/ic/if_wi.c
+++ b/sys/dev/ic/if_wi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wi.c,v 1.147 2010/05/20 14:03:05 nicm Exp $ */
+/* $OpenBSD: if_wi.c,v 1.148 2010/07/02 02:40:15 blambert Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -805,7 +805,8 @@ wi_rxeof(struct wi_softc *sc)
(len - WI_SNAPHDR_LEN),
sc->wi_rxbuf + sizeof(struct ether_header) +
IEEE80211_WEP_IVLEN +
- IEEE80211_WEP_KIDLEN + WI_SNAPHDR_LEN);
+ IEEE80211_WEP_KIDLEN + WI_SNAPHDR_LEN,
+ M_NOWAIT);
m_adj(m, -(WI_ETHERTYPE_LEN +
IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN +
WI_SNAPHDR_LEN));
diff --git a/sys/dev/ic/rtl81x9.c b/sys/dev/ic/rtl81x9.c
index 5f636c712aa..3fe752fa6b3 100644
--- a/sys/dev/ic/rtl81x9.c
+++ b/sys/dev/ic/rtl81x9.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtl81x9.c,v 1.70 2010/05/19 15:27:35 oga Exp $ */
+/* $OpenBSD: rtl81x9.c,v 1.71 2010/07/02 02:40:16 blambert Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -655,7 +655,7 @@ rl_rxeof(struct rl_softc *sc)
m = m_devget(rxbufpos, wrap, ETHER_ALIGN, ifp, NULL);
if (m != NULL) {
m_copyback(m, wrap, total_len - wrap,
- sc->rl_cdata.rl_rx_buf);
+ sc->rl_cdata.rl_rx_buf, M_NOWAIT);
if (m->m_pkthdr.len < total_len) {
m_freem(m);
m = NULL;
diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c
index e7234e4d68b..241c6edcf4e 100644
--- a/sys/dev/pci/hifn7751.c
+++ b/sys/dev/pci/hifn7751.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hifn7751.c,v 1.160 2010/05/19 15:27:35 oga Exp $ */
+/* $OpenBSD: hifn7751.c,v 1.161 2010/07/02 02:40:16 blambert Exp $ */
/*
* Invertex AEON / Hifn 7751 driver
@@ -2082,7 +2082,7 @@ hifn_process(struct cryptop *crp)
if (crp->crp_flags & CRYPTO_F_IMBUF)
m_copyback(cmd->srcu.src_m,
enccrd->crd_inject,
- ivlen, cmd->iv);
+ ivlen, cmd->iv, M_NOWAIT);
else if (crp->crp_flags & CRYPTO_F_IOV)
cuio_copyback(cmd->srcu.src_io,
enccrd->crd_inject,
@@ -2293,7 +2293,8 @@ hifn_callback(struct hifn_softc *sc, struct hifn_command *cmd,
if (crp->crp_flags & CRYPTO_F_IMBUF)
m_copyback((struct mbuf *)crp->crp_buf,
cmd->src_map->dm_mapsize - cmd->sloplen,
- cmd->sloplen, &dma->slop[cmd->slopidx]);
+ cmd->sloplen, &dma->slop[cmd->slopidx],
+ M_NOWAIT);
else if (crp->crp_flags & CRYPTO_F_IOV)
cuio_copyback((struct uio *)crp->crp_buf,
cmd->src_map->dm_mapsize - cmd->sloplen,
@@ -2366,7 +2367,7 @@ hifn_callback(struct hifn_softc *sc, struct hifn_command *cmd,
if (crp->crp_flags & CRYPTO_F_IMBUF)
m_copyback((struct mbuf *)crp->crp_buf,
- crd->crd_inject, len, macbuf);
+ crd->crd_inject, len, macbuf, M_NOWAIT);
else if ((crp->crp_flags & CRYPTO_F_IOV) && crp->crp_mac)
bcopy((caddr_t)macbuf, crp->crp_mac, len);
break;
diff --git a/sys/dev/pci/noct.c b/sys/dev/pci/noct.c
index e2fab9763c5..5556424a55b 100644
--- a/sys/dev/pci/noct.c
+++ b/sys/dev/pci/noct.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: noct.c,v 1.20 2008/06/09 07:07:16 djm Exp $ */
+/* $OpenBSD: noct.c,v 1.21 2010/07/02 02:40:16 blambert Exp $ */
/*
* Copyright (c) 2002 Jason L. Wright (jason@thought.net)
@@ -911,7 +911,7 @@ noct_ea_thread(vsc)
if (crp->crp_flags & CRYPTO_F_IMBUF)
m_copyback((struct mbuf *)crp->crp_buf,
crd->crd_inject, len,
- q->q_macbuf);
+ q->q_macbuf, M_NOWAIT);
else if (crp->crp_flags & CRYPTO_F_IOV)
bcopy(q->q_macbuf, crp->crp_mac, len);
}
@@ -921,7 +921,7 @@ noct_ea_thread(vsc)
if (crp->crp_flags & CRYPTO_F_IMBUF)
m_copyback((struct mbuf *)crp->crp_buf,
crd->crd_skip, crd->crd_len,
- q->q_buf);
+ q->q_buf, M_NOWAIT);
else if (crp->crp_flags & CRYPTO_F_IOV)
cuio_copyback((struct uio *)crp->crp_buf,
crd->crd_skip, crd->crd_len,
@@ -1144,7 +1144,7 @@ noct_ea_start_des(sc, q, crp, crd)
if (!(crd->crd_flags & CRD_F_IV_PRESENT)) {
if (crp->crp_flags & CRYPTO_F_IMBUF)
m_copyback((struct mbuf *)crp->crp_buf,
- crd->crd_inject, 8, iv);
+ crd->crd_inject, 8, iv, M_NOWAIT);
else if (crp->crp_flags & CRYPTO_F_IOV)
cuio_copyback((struct uio *)crp->crp_buf,
crd->crd_inject, 8, iv);
diff --git a/sys/dev/pci/safe.c b/sys/dev/pci/safe.c
index 189d24ccd1b..98111ccf67a 100644
--- a/sys/dev/pci/safe.c
+++ b/sys/dev/pci/safe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: safe.c,v 1.28 2010/04/06 22:28:07 tedu Exp $ */
+/* $OpenBSD: safe.c,v 1.29 2010/07/02 02:40:16 blambert Exp $ */
/*-
* Copyright (c) 2003 Sam Leffler, Errno Consulting
@@ -476,7 +476,8 @@ safe_process(struct cryptop *crp)
if ((enccrd->crd_flags & CRD_F_IV_PRESENT) == 0) {
if (crp->crp_flags & CRYPTO_F_IMBUF)
m_copyback(re->re_src_m,
- enccrd->crd_inject, ivsize, iv);
+ enccrd->crd_inject, ivsize, iv,
+ M_NOWAIT);
else if (crp->crp_flags & CRYPTO_F_IOV)
cuio_copyback(re->re_src_io,
enccrd->crd_inject, ivsize, iv);
@@ -1719,7 +1720,8 @@ safe_callback(struct safe_softc *sc, struct safe_ringentry *re)
if (crp->crp_flags & CRYPTO_F_IMBUF) {
m_copyback((struct mbuf *)crp->crp_buf,
crd->crd_inject, 12,
- (caddr_t)re->re_sastate.sa_saved_indigest);
+ (caddr_t)re->re_sastate.sa_saved_indigest,
+ M_NOWAIT);
} else if (crp->crp_flags & CRYPTO_F_IOV && crp->crp_mac) {
bcopy((caddr_t)re->re_sastate.sa_saved_indigest,
crp->crp_mac, 12);
diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c
index 5e0beb0dcf6..9a75dc320d4 100644
--- a/sys/dev/pci/ubsec.c
+++ b/sys/dev/pci/ubsec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ubsec.c,v 1.146 2010/04/08 00:23:53 tedu Exp $ */
+/* $OpenBSD: ubsec.c,v 1.147 2010/07/02 02:40:16 blambert Exp $ */
/*
* Copyright (c) 2000 Jason L. Wright (jason@thought.net)
@@ -957,7 +957,7 @@ ubsec_process(struct cryptop *crp)
if (crp->crp_flags & CRYPTO_F_IMBUF)
m_copyback(q->q_src_m,
enccrd->crd_inject,
- ivlen, key.ses_iv);
+ ivlen, key.ses_iv, M_NOWAIT);
else if (crp->crp_flags & CRYPTO_F_IOV)
cuio_copyback(q->q_src_io,
enccrd->crd_inject,
@@ -1463,7 +1463,7 @@ ubsec_callback(struct ubsec_softc *sc, struct ubsec_q *q)
if (crp->crp_flags & CRYPTO_F_IMBUF)
m_copyback((struct mbuf *)crp->crp_buf,
crd->crd_inject, 12,
- dmap->d_dma->d_macbuf);
+ dmap->d_dma->d_macbuf, M_NOWAIT);
else if (crp->crp_flags & CRYPTO_F_IOV && crp->crp_mac)
bcopy((caddr_t)dmap->d_dma->d_macbuf,
crp->crp_mac, 12);
diff --git a/sys/dev/sdmmc/sbt.c b/sys/dev/sdmmc/sbt.c
index a04623d14bf..b66b6023610 100644
--- a/sys/dev/sdmmc/sbt.c
+++ b/sys/dev/sdmmc/sbt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sbt.c,v 1.14 2010/02/11 10:12:19 claudio Exp $ */
+/* $OpenBSD: sbt.c,v 1.15 2010/07/02 02:40:16 blambert Exp $ */
/*
* Copyright (c) 2007 Uwe Stuehler <uwe@openbsd.org>
@@ -372,7 +372,7 @@ sbt_intr(void *arg)
}
m->m_pkthdr.len = m->m_len = MHLEN;
- m_copyback(m, 0, len, sc->sc_buf);
+ m_copyback(m, 0, len, sc->sc_buf, M_NOWAIT);
if (m->m_pkthdr.len == MAX(MHLEN, len)) {
m->m_pkthdr.len = len;
m->m_len = MIN(MHLEN, m->m_pkthdr.len);
diff --git a/sys/dev/usb/ubt.c b/sys/dev/usb/ubt.c
index ee69effd9f5..27d700b777b 100644
--- a/sys/dev/usb/ubt.c
+++ b/sys/dev/usb/ubt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ubt.c,v 1.16 2010/04/22 21:20:22 sthen Exp $ */
+/* $OpenBSD: ubt.c,v 1.17 2010/07/02 02:40:16 blambert Exp $ */
/* $NetBSD: ubt.c,v 1.35 2008/07/28 14:19:26 drochner Exp $ */
/*-
@@ -1287,7 +1287,7 @@ ubt_mbufload(uint8_t *buf, int count, uint8_t type)
*mtod(m, uint8_t *) = type;
m->m_pkthdr.len = m->m_len = MHLEN;
- m_copyback(m, 1, count, buf); // (extends if necessary)
+ m_copyback(m, 1, count, buf, M_NOWAIT); /* extends if this doesn't fail */
if (m->m_pkthdr.len != MAX(MHLEN, count + 1)) {
m_free(m);
return NULL;
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index dcf977c50a4..9940151a3e0 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_mbuf.c,v 1.139 2010/07/01 19:23:51 beck Exp $ */
+/* $OpenBSD: uipc_mbuf.c,v 1.140 2010/07/02 02:40:16 blambert Exp $ */
/* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */
/*
@@ -726,26 +726,30 @@ m_copydata(struct mbuf *m, int off, int len, caddr_t cp)
* chain if necessary. The mbuf needs to be properly initialized
* including the setting of m_len.
*/
-void
-m_copyback(struct mbuf *m0, int off, int len, const void *_cp)
+int
+m_copyback(struct mbuf *m0, int off, int len, const void *_cp, int wait)
{
int mlen, totlen = 0;
struct mbuf *m = m0, *n;
caddr_t cp = (caddr_t)_cp;
+ int error = 0;
if (m0 == NULL)
- return;
+ return (0);
while (off > (mlen = m->m_len)) {
off -= mlen;
totlen += mlen;
if (m->m_next == NULL) {
- if ((n = m_get(M_DONTWAIT, m->m_type)) == NULL)
+ if ((n = m_get(wait, m->m_type)) == NULL) {
+ error = ENOBUFS;
goto out;
+ }
if (off + len > MLEN) {
- MCLGETI(n, M_DONTWAIT, NULL, off + len);
+ MCLGETI(n, wait, NULL, off + len);
if (!(n->m_flags & M_EXT)) {
m_free(n);
+ error = ENOBUFS;
goto out;
}
}
@@ -770,13 +774,16 @@ m_copyback(struct mbuf *m0, int off, int len, const void *_cp)
off = 0;
if (m->m_next == NULL) {
- if ((n = m_get(M_DONTWAIT, m->m_type)) == NULL)
+ if ((n = m_get(wait, m->m_type)) == NULL) {
+ error = ENOBUFS;
goto out;
+ }
if (len > MLEN) {
- MCLGETI(n, M_DONTWAIT, NULL, len);
+ MCLGETI(n, wait, NULL, len);
if (!(n->m_flags & M_EXT)) {
m_free(n);
+ error = ENOBUFS;
goto out;
}
}
@@ -788,6 +795,8 @@ m_copyback(struct mbuf *m0, int off, int len, const void *_cp)
out:
if (((m = m0)->m_flags & M_PKTHDR) && (m->m_pkthdr.len < totlen))
m->m_pkthdr.len = totlen;
+
+ return (error);
}
/*
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 3ffd4a4bc98..5dd8b2e9217 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bridge.c,v 1.180 2010/07/01 02:09:45 reyk Exp $ */
+/* $OpenBSD: if_bridge.c,v 1.181 2010/07/02 02:40:16 blambert Exp $ */
/*
* Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
@@ -2845,7 +2845,7 @@ bridge_ifenqueue(struct bridge_softc *sc, struct ifnet *ifp, struct mbuf *m)
sc->sc_if.if_oerrors++;
return (ENOBUFS);
}
- m_copyback(m, 0, sizeof(evh), &evh);
+ m_copyback(m, 0, sizeof(evh), &evh, M_NOWAIT);
m->m_flags &= ~M_VLANTAG;
}
#endif
diff --git a/sys/net/if_mpe.c b/sys/net/if_mpe.c
index 1527222b033..509bd795882 100644
--- a/sys/net/if_mpe.c
+++ b/sys/net/if_mpe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mpe.c,v 1.20 2010/05/31 11:46:02 claudio Exp $ */
+/* $OpenBSD: if_mpe.c,v 1.21 2010/07/02 02:40:16 blambert Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -248,7 +248,7 @@ mpeoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
}
*mtod(m, sa_family_t *) = AF_INET;
m_copyback(m, sizeof(sa_family_t), sizeof(in_addr_t),
- (caddr_t)&((satosin(dst)->sin_addr)));
+ (caddr_t)&((satosin(dst)->sin_addr)), M_NOWAIT);
break;
#endif
default:
@@ -257,7 +257,7 @@ mpeoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
goto out;
}
- m_copyback(m, off, sizeof(shim), (caddr_t)&shim);
+ m_copyback(m, off, sizeof(shim), (caddr_t)&shim, M_NOWAIT);
s = splnet();
IFQ_ENQUEUE(&ifp->if_snd, m, NULL, error);
diff --git a/sys/net/if_pflow.c b/sys/net/if_pflow.c
index 9b513c8202a..f2b6a3d5bc5 100644
--- a/sys/net/if_pflow.c
+++ b/sys/net/if_pflow.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pflow.c,v 1.13 2010/04/20 22:05:43 tedu Exp $ */
+/* $OpenBSD: if_pflow.c,v 1.14 2010/07/02 02:40:16 blambert Exp $ */
/*
* Copyright (c) 2008 Henning Brauer <henning@openbsd.org>
@@ -325,7 +325,7 @@ pflow_get_mbuf(struct pflow_softc *sc)
h.flow_sequence = htonl(sc->sc_gcounter);
h.engine_type = PFLOW_ENGINE_TYPE;
h.engine_id = PFLOW_ENGINE_ID;
- m_copyback(m, 0, PFLOW_HDRLEN, &h);
+ m_copyback(m, 0, PFLOW_HDRLEN, &h, M_NOWAIT);
sc->sc_count = 0;
timeout_add_sec(&sc->sc_tmo, PFLOW_TIMEOUT);
@@ -442,7 +442,7 @@ copy_flow_to_m(struct pflow_flow *flow, struct pflow_softc *sc)
}
m_copyback(sc->sc_mbuf, PFLOW_HDRLEN +
(sc->sc_count * sizeof (struct pflow_flow)),
- sizeof (struct pflow_flow), flow);
+ sizeof (struct pflow_flow), flow, M_NOWAIT);
if (pflowstats.pflow_flows == sc->sc_gcounter)
pflowstats.pflow_flows++;
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index ab678a65d76..57326ad5d2e 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_vlan.c,v 1.84 2010/06/03 16:15:00 naddy Exp $ */
+/* $OpenBSD: if_vlan.c,v 1.85 2010/07/02 02:40:16 blambert Exp $ */
/*
* Copyright 1998 Massachusetts Institute of Technology
@@ -243,7 +243,7 @@ vlan_start(struct ifnet *ifp)
continue;
}
- m_copyback(m, 0, sizeof(evh), &evh);
+ m_copyback(m, 0, sizeof(evh), &evh, M_NOWAIT);
}
/*
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 9ff5571c0fe..5077800d7e4 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.694 2010/07/01 19:45:29 henning Exp $ */
+/* $OpenBSD: pf.c,v 1.695 2010/07/02 02:40:16 blambert Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1929,7 +1929,7 @@ pf_modulate_sack(struct mbuf *m, int off, struct pf_pdesc *pd,
}
if (copyback)
- m_copyback(m, off + sizeof(*th), thoptlen, opts);
+ m_copyback(m, off + sizeof(*th), thoptlen, opts, M_NOWAIT);
return (copyback);
}
@@ -3047,7 +3047,7 @@ pf_test_rule(struct pf_rule **rm, struct pf_state **sm, int direction,
/* copy back packet headers if we performed NAT operations */
if (rewrite)
- m_copyback(m, off, hdrlen, pd->hdr.any);
+ m_copyback(m, off, hdrlen, pd->hdr.any, M_NOWAIT);
#if NPFSYNC > 0
if (*sm != NULL && !ISSET((*sm)->state_flags, PFSTATE_NOSYNC) &&
@@ -4008,7 +4008,7 @@ pf_test_state_tcp(struct pf_state **state, int direction, struct pfi_kif *kif,
/* Copyback sequence modulation or stateful scrub changes if needed */
if (copyback)
- m_copyback(m, off, sizeof(*th), th);
+ m_copyback(m, off, sizeof(*th), th, M_NOWAIT);
return (PF_PASS);
}
@@ -4078,7 +4078,7 @@ pf_test_state_udp(struct pf_state **state, int direction, struct pfi_kif *kif,
&uh->uh_sum, &nk->addr[pd->didx],
nk->port[pd->didx], 1, pd->af);
m->m_pkthdr.rdomain = nk->rdomain;
- m_copyback(m, off, sizeof(*uh), uh);
+ m_copyback(m, off, sizeof(*uh), uh, M_NOWAIT);
}
return (PF_PASS);
@@ -4228,7 +4228,7 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kif *kif,
}
m_copyback(m, off, ICMP_MINLEN,
- pd->hdr.icmp);
+ pd->hdr.icmp, M_NOWAIT);
break;
#endif /* INET */
#ifdef INET6
@@ -4249,7 +4249,7 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kif *kif,
m_copyback(m, off,
sizeof(struct icmp6_hdr),
- pd->hdr.icmp6);
+ pd->hdr.icmp6, M_NOWAIT);
break;
#endif /* INET6 */
}
@@ -4481,22 +4481,22 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kif *kif,
#ifdef INET
case AF_INET:
m_copyback(m, off, ICMP_MINLEN,
- pd->hdr.icmp);
+ pd->hdr.icmp, M_NOWAIT);
m_copyback(m, ipoff2, sizeof(h2),
- &h2);
+ &h2, M_NOWAIT);
break;
#endif /* INET */
#ifdef INET6
case AF_INET6:
m_copyback(m, off,
sizeof(struct icmp6_hdr),
- pd->hdr.icmp6);
+ pd->hdr.icmp6, M_NOWAIT);
m_copyback(m, ipoff2, sizeof(h2_6),
- &h2_6);
+ &h2_6, M_NOWAIT);
break;
#endif /* INET6 */
}
- m_copyback(m, off2, 8, &th);
+ m_copyback(m, off2, 8, &th, M_NOWAIT);
}
return (PF_PASS);
@@ -4556,21 +4556,22 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kif *kif,
#ifdef INET
case AF_INET:
m_copyback(m, off, ICMP_MINLEN,
- pd->hdr.icmp);
- m_copyback(m, ipoff2, sizeof(h2), &h2);
+ pd->hdr.icmp, M_NOWAIT);
+ m_copyback(m, ipoff2, sizeof(h2), &h2,
+ M_NOWAIT);
break;
#endif /* INET */
#ifdef INET6
case AF_INET6:
m_copyback(m, off,
sizeof(struct icmp6_hdr),
- pd->hdr.icmp6);
+ pd->hdr.icmp6, M_NOWAIT);
m_copyback(m, ipoff2, sizeof(h2_6),
- &h2_6);
+ &h2_6, M_NOWAIT);
break;
#endif /* INET6 */
}
- m_copyback(m, off2, sizeof(uh), &uh);
+ m_copyback(m, off2, sizeof(uh), &uh, M_NOWAIT);
}
return (PF_PASS);
break;
@@ -4627,9 +4628,12 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kif *kif,
pd2.ip_sum, icmpsum,
pd->ip_sum, 0, AF_INET);
- m_copyback(m, off, ICMP_MINLEN, pd->hdr.icmp);
- m_copyback(m, ipoff2, sizeof(h2), &h2);
- m_copyback(m, off2, ICMP_MINLEN, &iih);
+ m_copyback(m, off, ICMP_MINLEN, pd->hdr.icmp,
+ M_NOWAIT);
+ m_copyback(m, ipoff2, sizeof(h2), &h2,
+ M_NOWAIT);
+ m_copyback(m, off2, ICMP_MINLEN, &iih,
+ M_NOWAIT);
}
return (PF_PASS);
break;
@@ -4698,10 +4702,11 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kif *kif,
pd->ip_sum, 0, AF_INET6);
m_copyback(m, off, sizeof(struct icmp6_hdr),
- pd->hdr.icmp6);
- m_copyback(m, ipoff2, sizeof(h2_6), &h2_6);
+ pd->hdr.icmp6, M_NOWAIT);
+ m_copyback(m, ipoff2, sizeof(h2_6), &h2_6,
+ M_NOWAIT);
m_copyback(m, off2, sizeof(struct icmp6_hdr),
- &iih);
+ &iih, M_NOWAIT);
}
return (PF_PASS);
break;
@@ -4747,17 +4752,18 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kif *kif,
#ifdef INET
case AF_INET:
m_copyback(m, off, ICMP_MINLEN,
- pd->hdr.icmp);
- m_copyback(m, ipoff2, sizeof(h2), &h2);
+ pd->hdr.icmp, M_NOWAIT);
+ m_copyback(m, ipoff2, sizeof(h2), &h2,
+ M_NOWAIT);
break;
#endif /* INET */
#ifdef INET6
case AF_INET6:
m_copyback(m, off,
sizeof(struct icmp6_hdr),
- pd->hdr.icmp6);
+ pd->hdr.icmp6, M_NOWAIT);
m_copyback(m, ipoff2, sizeof(h2_6),
- &h2_6);
+ &h2_6, M_NOWAIT);
break;
#endif /* INET6 */
}
diff --git a/sys/net/pf_norm.c b/sys/net/pf_norm.c
index c3708d724da..1c46a4b2da5 100644
--- a/sys/net/pf_norm.c
+++ b/sys/net/pf_norm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_norm.c,v 1.121 2010/01/18 23:52:46 mcbride Exp $ */
+/* $OpenBSD: pf_norm.c,v 1.122 2010/07/02 02:40:16 blambert Exp $ */
/*
* Copyright 2001 Niels Provos <provos@citi.umich.edu>
@@ -817,7 +817,7 @@ pf_normalize_tcp(int dir, struct pfi_kif *kif, struct mbuf *m, int ipoff,
/* copy back packet headers if we sanitized */
if (rewrite)
- m_copyback(m, off, sizeof(*th), th);
+ m_copyback(m, off, sizeof(*th), th, M_NOWAIT);
return (PF_PASS);
@@ -1040,7 +1040,7 @@ pf_normalize_tcp_stateful(struct mbuf *m, int off, struct pf_pdesc *pd,
*writeback = 1;
m_copyback(m, off + sizeof(struct tcphdr),
(th->th_off << 2) - sizeof(struct tcphdr), hdr +
- sizeof(struct tcphdr));
+ sizeof(struct tcphdr), M_NOWAIT);
}
}
@@ -1357,8 +1357,8 @@ pf_normalize_mss(struct mbuf *m, int off, struct pf_pdesc *pd, u_int16_t maxmss)
*mss, htons(maxmss), 0);
*mss = htons(maxmss);
m_copyback(m, off + sizeof(*th),
- thoff - sizeof(*th), opts);
- m_copyback(m, off, sizeof(*th), th);
+ thoff - sizeof(*th), opts, M_NOWAIT);
+ m_copyback(m, off, sizeof(*th), th, M_NOWAIT);
}
break;
default:
diff --git a/sys/net/pipex.c b/sys/net/pipex.c
index 5727121ab5c..fbf512aef05 100644
--- a/sys/net/pipex.c
+++ b/sys/net/pipex.c
@@ -1,4 +1,4 @@
-/* $Id: pipex.c,v 1.3 2010/01/13 07:23:38 yasuoka Exp $ */
+/* $Id: pipex.c,v 1.4 2010/07/02 02:40:16 blambert Exp $ */
/*-
* Copyright (c) 2009 Internet Initiative Japan Inc.
* All rights reserved.
@@ -1180,7 +1180,8 @@ pipex_pppoe_output(struct mbuf *m0, struct pipex_session *session)
}
padlen = ETHERMIN - m0->m_pkthdr.len;
if (padlen > 0)
- m_copyback(m0, m0->m_pkthdr.len, padlen, pipex_pppoe_padding);
+ m_copyback(m0, m0->m_pkthdr.len, padlen, pipex_pppoe_padding,
+ M_NOWAIT);
/* setup pppoe header information */
pppoe = mtod(m0, struct pipex_pppoe_header *);
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 2c9afdf3887..0617ad5cf38 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtsock.c,v 1.101 2010/06/28 18:50:37 claudio Exp $ */
+/* $OpenBSD: rtsock.c,v 1.102 2010/07/02 02:40:16 blambert Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
@@ -760,7 +760,7 @@ flush:
if (dst)
route_proto.sp_protocol = dst->sa_family;
if (rtm) {
- m_copyback(m, 0, rtm->rtm_msglen, rtm);
+ m_copyback(m, 0, rtm->rtm_msglen, rtm, M_NOWAIT);
if (m->m_pkthdr.len < rtm->rtm_msglen) {
m_freem(m);
m = NULL;
@@ -860,7 +860,7 @@ rt_msg1(int type, struct rt_addrinfo *rtinfo)
continue;
rtinfo->rti_addrs |= (1 << i);
dlen = ROUNDUP(sa->sa_len);
- m_copyback(m, len, dlen, sa);
+ m_copyback(m, len, dlen, sa, M_NOWAIT);
len += dlen;
}
if (m->m_pkthdr.len != len) {
diff --git a/sys/netbt/hci_unit.c b/sys/netbt/hci_unit.c
index 10700775447..7a04936fbf8 100644
--- a/sys/netbt/hci_unit.c
+++ b/sys/netbt/hci_unit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hci_unit.c,v 1.10 2008/11/22 16:56:39 uwe Exp $ */
+/* $OpenBSD: hci_unit.c,v 1.11 2010/07/02 02:40:16 blambert Exp $ */
/* $NetBSD: hci_unit.c,v 1.12 2008/06/26 14:17:27 plunky Exp $ */
/*-
@@ -316,7 +316,7 @@ hci_send_cmd(struct hci_unit *unit, uint16_t opcode, void *buf, uint8_t len)
if (len) {
KASSERT(buf != NULL);
- m_copyback(m, sizeof(hci_cmd_hdr_t), len, buf);
+ m_copyback(m, sizeof(hci_cmd_hdr_t), len, buf, M_NOWAIT);
if (m->m_pkthdr.len != (sizeof(hci_cmd_hdr_t) + len)) {
m_freem(m);
return ENOMEM;
diff --git a/sys/netbt/l2cap_signal.c b/sys/netbt/l2cap_signal.c
index a10706728ae..5d4f0dc6da5 100644
--- a/sys/netbt/l2cap_signal.c
+++ b/sys/netbt/l2cap_signal.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: l2cap_signal.c,v 1.5 2009/01/14 08:10:05 grange Exp $ */
+/* $OpenBSD: l2cap_signal.c,v 1.6 2010/07/02 02:40:16 blambert Exp $ */
/* $NetBSD: l2cap_signal.c,v 1.9 2007/11/10 23:12:23 plunky Exp $ */
/*-
@@ -959,7 +959,8 @@ l2cap_send_signal(struct hci_link *link, uint8_t code, uint8_t ident,
/* Command Data */
if (length > 0)
- m_copyback(m, sizeof(*hdr) + sizeof(*cmd), length, data);
+ m_copyback(m, sizeof(*hdr) + sizeof(*cmd), length, data,
+ M_NOWAIT);
/* Command Header */
cmd->code = code;
diff --git a/sys/netbt/rfcomm_session.c b/sys/netbt/rfcomm_session.c
index a91958111c5..d0a14a8c5e0 100644
--- a/sys/netbt/rfcomm_session.c
+++ b/sys/netbt/rfcomm_session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rfcomm_session.c,v 1.5 2008/11/22 04:42:58 uwe Exp $ */
+/* $OpenBSD: rfcomm_session.c,v 1.6 2010/07/02 02:40:16 blambert Exp $ */
/* $NetBSD: rfcomm_session.c,v 1.14 2008/08/06 15:01:24 plunky Exp $ */
/*-
@@ -1580,7 +1580,7 @@ rfcomm_session_send_uih(struct rfcomm_session *rs, struct rfcomm_dlc *dlc,
/* Append FCS */
fcs = 0xff - fcs; /* ones complement */
len = m0->m_pkthdr.len;
- m_copyback(m0, len, sizeof(fcs), &fcs);
+ m_copyback(m0, len, sizeof(fcs), &fcs, M_NOWAIT);
if (m0->m_pkthdr.len != len + sizeof(fcs))
goto nomem;
@@ -1668,7 +1668,7 @@ rfcomm_session_send_mcc(struct rfcomm_session *rs, int cr,
if (len > 0) {
m->m_pkthdr.len = m->m_len = MHLEN;
- m_copyback(m, hlen, len, data);
+ m_copyback(m, hlen, len, data, M_NOWAIT);
if (m->m_pkthdr.len != max(MHLEN, hlen + len)) {
m_freem(m);
return ENOMEM;
diff --git a/sys/netinet/ip_ah.c b/sys/netinet/ip_ah.c
index caa6d66ce5a..1a9bf0cbd95 100644
--- a/sys/netinet/ip_ah.c
+++ b/sys/netinet/ip_ah.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ah.c,v 1.95 2010/07/01 02:09:45 reyk Exp $ */
+/* $OpenBSD: ip_ah.c,v 1.96 2010/07/02 02:40:16 blambert Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -369,7 +369,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out)
ip6.ip6_dst.s6_addr16[1] = 0;
/* Done with IPv6 header. */
- m_copyback(m, 0, sizeof(struct ip6_hdr), &ip6);
+ m_copyback(m, 0, sizeof(struct ip6_hdr), &ip6, M_NOWAIT);
/* Let's deal with the remaining headers (if any). */
if (skip - sizeof(struct ip6_hdr) > 0) {
@@ -496,7 +496,8 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out)
(caddr_t)&ip6);
addr[0] = ip6.ip6_dst;
ip6.ip6_dst = finaldst;
- m_copyback(m, 0, sizeof(ip6), &ip6);
+ m_copyback(m, 0, sizeof(ip6), &ip6,
+ M_NOWAIT);
rh0->ip6r0_segleft = 0;
}
@@ -521,7 +522,7 @@ ah_massage_headers(struct mbuf **m0, int proto, int skip, int alg, int out)
/* Copyback and free, if we allocated. */
if (alloc) {
m_copyback(m, sizeof(struct ip6_hdr),
- skip - sizeof(struct ip6_hdr), ptr);
+ skip - sizeof(struct ip6_hdr), ptr, M_NOWAIT);
free(ptr, M_XDATA);
}
@@ -693,7 +694,8 @@ ah_input(struct mbuf *m, struct tdb *tdb, int skip, int protoff)
(caddr_t) (tc + 1));
/* Zeroize the authenticator on the packet. */
- m_copyback(m, skip + rplen, ahx->authsize, ipseczeroes);
+ m_copyback(m, skip + rplen, ahx->authsize, ipseczeroes,
+ M_NOWAIT);
/* "Massage" the packet headers for crypto processing. */
if ((btsx = ah_massage_headers(&m, tdb->tdb_dst.sa.sa_family,
@@ -827,11 +829,11 @@ ah_input_cb(void *op)
((u_int8_t *) ptr)[protoff] = ((u_int8_t *) ptr)[skip];
/* Copyback the saved (uncooked) network headers. */
- m_copyback(m, 0, skip, ptr);
+ m_copyback(m, 0, skip, ptr, M_NOWAIT);
} else {
/* Fix the Next Protocol field. */
m_copydata(m, skip, sizeof(u_int8_t), &prot);
- m_copyback(m, protoff, sizeof(u_int8_t), &prot);
+ m_copyback(m, protoff, sizeof(u_int8_t), &prot, M_NOWAIT);
}
free(tc, M_XDATA);
@@ -1137,7 +1139,7 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip,
ah->ah_spi = tdb->tdb_spi;
/* Zeroize authenticator. */
- m_copyback(m, skip + rplen, ahx->authsize, ipseczeroes);
+ m_copyback(m, skip + rplen, ahx->authsize, ipseczeroes, M_NOWAIT);
if (!(tdb->tdb_flags & TDBF_NOREPLAY)) {
ah->ah_rpl = htonl(tdb->tdb_rpl++);
@@ -1197,7 +1199,7 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip,
(caddr_t) &iplen, sizeof(u_int16_t));
iplen = htons(ntohs(iplen) + rplen + ahx->authsize);
m_copyback(m, offsetof(struct ip, ip_len),
- sizeof(u_int16_t), &iplen);
+ sizeof(u_int16_t), &iplen, M_NOWAIT);
break;
#endif /* INET */
@@ -1208,7 +1210,7 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip,
(caddr_t) &iplen, sizeof(u_int16_t));
iplen = htons(ntohs(iplen) + rplen + ahx->authsize);
m_copyback(m, offsetof(struct ip6_hdr, ip6_plen),
- sizeof(u_int16_t), &iplen);
+ sizeof(u_int16_t), &iplen, M_NOWAIT);
break;
#endif /* INET6 */
}
@@ -1218,7 +1220,7 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip,
/* Update the Next Protocol field in the IP header. */
prot = IPPROTO_AH;
- m_copyback(m, protoff, sizeof(u_int8_t), &prot);
+ m_copyback(m, protoff, sizeof(u_int8_t), &prot, M_NOWAIT);
/* "Massage" the packet headers for crypto processing. */
if ((len = ah_massage_headers(&m, tdb->tdb_dst.sa.sa_family,
@@ -1231,7 +1233,7 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip,
} else {
/* Update the Next Protocol field in the IP header. */
prot = IPPROTO_AH;
- m_copyback(m, protoff, sizeof(u_int8_t), &prot);
+ m_copyback(m, protoff, sizeof(u_int8_t), &prot, M_NOWAIT);
}
/* Crypto operation descriptor. */
@@ -1317,7 +1319,7 @@ ah_output_cb(void *op)
* in place.
*/
if ((tdb->tdb_flags & TDBF_SKIPCRYPTO) == 0)
- m_copyback(m, 0, skip, ptr);
+ m_copyback(m, 0, skip, ptr, M_NOWAIT);
free(tc, M_XDATA);
diff --git a/sys/netinet/ip_esp.c b/sys/netinet/ip_esp.c
index 21af051a513..1ca5f791e7e 100644
--- a/sys/netinet/ip_esp.c
+++ b/sys/netinet/ip_esp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_esp.c,v 1.108 2010/07/01 02:09:45 reyk Exp $ */
+/* $OpenBSD: ip_esp.c,v 1.109 2010/07/02 02:40:16 blambert Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -695,7 +695,7 @@ esp_input_cb(void *op)
m_adj(m, -(lastthree[1] + 2));
/* Restore the Next Protocol field */
- m_copyback(m, protoff, sizeof(u_int8_t), lastthree + 2);
+ m_copyback(m, protoff, sizeof(u_int8_t), lastthree + 2, M_NOWAIT);
/* Back to generic IPsec input processing */
error = ipsec_common_input_cb(m, tdb, skip, protoff, mtag);
@@ -906,7 +906,7 @@ esp_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip,
/* Fix Next Protocol in IPv4/IPv6 header. */
prot = IPPROTO_ESP;
- m_copyback(m, protoff, sizeof(u_int8_t), &prot);
+ m_copyback(m, protoff, sizeof(u_int8_t), &prot, M_NOWAIT);
/* Get crypto descriptors. */
crp = crypto_getreq(esph && espx ? 2 : 1);
@@ -931,7 +931,7 @@ esp_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip,
if (tdb->tdb_flags & TDBF_HALFIV) {
/* Copy half-iv in the packet. */
m_copyback(m, crde->crd_inject, tdb->tdb_ivlen,
- tdb->tdb_iv);
+ tdb->tdb_iv, M_NOWAIT);
/* Cook half-iv. */
bcopy(tdb->tdb_iv, crde->crd_iv, tdb->tdb_ivlen);
diff --git a/sys/netinet/ip_ether.c b/sys/netinet/ip_ether.c
index 1a40db89819..cf52c76e011 100644
--- a/sys/netinet/ip_ether.c
+++ b/sys/netinet/ip_ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ether.c,v 1.54 2010/05/11 09:36:07 claudio Exp $ */
+/* $OpenBSD: ip_ether.c,v 1.55 2010/07/02 02:40:16 blambert Exp $ */
/*
* The author of this code is Angelos D. Keromytis (kermit@adk.gr)
*
@@ -550,7 +550,7 @@ etherip_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int proto)
eip.eip_ver = ETHERIP_VERSION & ETHERIP_VER_VERS_MASK;
eip.eip_pad = 0;
m_copyback(m, hlen - sizeof(struct etherip_header),
- sizeof(struct etherip_header), &eip);
+ sizeof(struct etherip_header), &eip, M_NOWAIT);
}
*mp = m;
diff --git a/sys/netinet/ip_ipcomp.c b/sys/netinet/ip_ipcomp.c
index 0b98d6e28d7..af855f0d7cb 100644
--- a/sys/netinet/ip_ipcomp.c
+++ b/sys/netinet/ip_ipcomp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ipcomp.c,v 1.25 2010/07/01 02:09:45 reyk Exp $ */
+/* $OpenBSD: ip_ipcomp.c,v 1.26 2010/07/02 02:40:16 blambert Exp $ */
/*
* Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org)
@@ -346,7 +346,7 @@ ipcomp_input_cb(op)
crypto_freereq(crp);
/* Restore the Next Protocol field */
- m_copyback(m, protoff, sizeof(u_int8_t), &nproto);
+ m_copyback(m, protoff, sizeof(u_int8_t), &nproto, M_NOWAIT);
/* Back to generic IPsec input processing */
error = ipsec_common_input_cb(m, tdb, skip, protoff, NULL);
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
index f31a172a6f6..12b94ebbb1f 100644
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_mroute.c,v 1.57 2010/04/20 22:05:43 tedu Exp $ */
+/* $OpenBSD: ip_mroute.c,v 1.58 2010/07/02 02:40:16 blambert Exp $ */
/* $NetBSD: ip_mroute.c,v 1.85 2004/04/26 01:31:57 matt Exp $ */
/*
@@ -2475,8 +2475,9 @@ bw_upcalls_send(void)
}
m->m_len = m->m_pkthdr.len = 0;
- m_copyback(m, 0, sizeof(struct igmpmsg), (caddr_t)&igmpmsg);
- m_copyback(m, sizeof(struct igmpmsg), len, (caddr_t)&bw_upcalls[0]);
+ m_copyback(m, 0, sizeof(struct igmpmsg), (caddr_t)&igmpmsg, M_NOWAIT);
+ m_copyback(m, sizeof(struct igmpmsg), len, (caddr_t)&bw_upcalls[0],
+ M_NOWAIT);
/*
* Send the upcalls
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 63fc01c870d..fc8ebc17d1d 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_output.c,v 1.207 2010/07/01 02:09:45 reyk Exp $ */
+/* $OpenBSD: ip_output.c,v 1.208 2010/07/02 02:40:16 blambert Exp $ */
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
/*
@@ -1634,7 +1634,7 @@ ip_ctloutput(op, so, level, optname, mp)
m->m_len = len;
*mtod(m, u_int16_t *) = ipr->ref_type;
m_copyback(m, sizeof(u_int16_t), ipr->ref_len,
- ipr + 1);
+ ipr + 1, M_NOWAIT);
}
#endif
break;
@@ -2151,7 +2151,7 @@ in_delayed_cksum(struct mbuf *m)
}
if ((offset + sizeof(u_int16_t)) > m->m_len)
- m_copyback(m, offset, sizeof(csum), &csum);
+ m_copyback(m, offset, sizeof(csum), &csum, M_NOWAIT);
else
*(u_int16_t *)(mtod(m, caddr_t) + offset) = csum;
}
diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c
index e3135766eb1..ca9babb4aeb 100644
--- a/sys/nfs/nfs_socket.c
+++ b/sys/nfs/nfs_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_socket.c,v 1.96 2009/10/19 22:24:18 jsg Exp $ */
+/* $OpenBSD: nfs_socket.c,v 1.97 2010/07/02 02:40:17 blambert Exp $ */
/* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */
/*
@@ -1406,7 +1406,7 @@ nfs_realign(struct mbuf **pm, int hsiz)
if (n != NULL) {
++nfs_realign_count;
while (m) {
- m_copyback(n, off, m->m_len, mtod(m, caddr_t));
+ m_copyback(n, off, m->m_len, mtod(m, caddr_t), M_WAIT);
/*
* If an unaligned amount of memory was copied, fix up
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index f4abccd3c37..5b87f72c109 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mbuf.h,v 1.140 2010/01/11 03:50:56 yasuoka Exp $ */
+/* $OpenBSD: mbuf.h,v 1.141 2010/07/02 02:40:17 blambert Exp $ */
/* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */
/*
@@ -410,7 +410,7 @@ void m_clcount(struct ifnet *, int);
void m_cluncount(struct mbuf *, int);
void m_clinitifp(struct ifnet *);
void m_adj(struct mbuf *, int);
-void m_copyback(struct mbuf *, int, int, const void *);
+int m_copyback(struct mbuf *, int, int, const void *, int);
void m_freem(struct mbuf *);
void m_reclaim(void *, int);
void m_copydata(struct mbuf *, int, int, caddr_t);