summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2005-12-20 13:36:28 +0000
committermarkus <markus@openbsd.org>2005-12-20 13:36:28 +0000
commit38d7d608976e357bdab36501396c6dc495edb34e (patch)
treeb5f2de62872e9689e42fb5832aa828c3f2102bbc
parentformat according to Notes; (diff)
downloadwireguard-openbsd-38d7d608976e357bdab36501396c6dc495edb34e.tar.xz
wireguard-openbsd-38d7d608976e357bdab36501396c6dc495edb34e.zip
use M_READONLY when trying to find out whether we have to copy
the mbuf before encryption. otherwise mbufs with M_EXT but w/o M_CLUSTER get modified; ok hshoexer
-rw-r--r--sys/netinet/ip_ah.c9
-rw-r--r--sys/netinet/ip_esp.c9
-rw-r--r--sys/netinet/ip_ipcomp.c9
3 files changed, 12 insertions, 15 deletions
diff --git a/sys/netinet/ip_ah.c b/sys/netinet/ip_ah.c
index c673c37d366..4b2a1ba82d7 100644
--- a/sys/netinet/ip_ah.c
+++ b/sys/netinet/ip_ah.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ah.c,v 1.82 2005/07/31 03:52:19 pascoe Exp $ */
+/* $OpenBSD: ip_ah.c,v 1.83 2005/12/20 13:36:28 markus Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -1046,13 +1046,12 @@ ah_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip,
}
/*
- * Loop through mbuf chain; if we find an M_EXT mbuf with
- * more than one reference, replace the rest of the chain.
+ * Loop through mbuf chain; if we find a readonly mbuf,
+ * replace the rest of the chain.
*/
mo = NULL;
mi = m;
- while (mi != NULL &&
- (!(mi->m_flags & M_EXT) || !MCLISREFERENCED(mi))) {
+ while (mi != NULL && !M_READONLY(mi)) {
mo = mi;
mi = mi->m_next;
}
diff --git a/sys/netinet/ip_esp.c b/sys/netinet/ip_esp.c
index e21b373d14b..bf3e4aab7ad 100644
--- a/sys/netinet/ip_esp.c
+++ b/sys/netinet/ip_esp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_esp.c,v 1.95 2005/08/05 12:16:13 markus Exp $ */
+/* $OpenBSD: ip_esp.c,v 1.96 2005/12/20 13:36:28 markus Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -835,13 +835,12 @@ esp_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip,
}
/*
- * Loop through mbuf chain; if we find an M_EXT mbuf with
- * more than one reference, replace the rest of the chain.
+ * Loop through mbuf chain; if we find a readonly mbuf,
+ * replace the rest of the chain.
*/
mo = NULL;
mi = m;
- while (mi != NULL &&
- (!(mi->m_flags & M_EXT) || !MCLISREFERENCED(mi))) {
+ while (mi != NULL && !M_READONLY(mi)) {
mo = mi;
mi = mi->m_next;
}
diff --git a/sys/netinet/ip_ipcomp.c b/sys/netinet/ip_ipcomp.c
index a1a1f2d0f4d..a7a52dd1bc6 100644
--- a/sys/netinet/ip_ipcomp.c
+++ b/sys/netinet/ip_ipcomp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_ipcomp.c,v 1.18 2005/07/31 03:52:19 pascoe Exp $ */
+/* $OpenBSD: ip_ipcomp.c,v 1.19 2005/12/20 13:36:28 markus Exp $ */
/*
* Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org)
@@ -464,13 +464,12 @@ ipcomp_output(m, tdb, mp, skip, protoff)
tdb->tdb_flags &= ~TDBF_SOFT_BYTES; /* Turn off checking */
}
/*
- * Loop through mbuf chain; if we find an M_EXT mbuf with
- * more than one reference, replace the rest of the chain.
+ * Loop through mbuf chain; if we find a readonly mbuf,
+ * replace the rest of the chain.
*/
mo = NULL;
mi = m;
- while (mi != NULL &&
- (!(mi->m_flags & M_EXT) || !MCLISREFERENCED(mi))) {
+ while (mi != NULL && !M_READONLY(mi)) {
mo = mi;
mi = mi->m_next;
}