summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorAngelos D. Keromytis <angelos@cvs.openbsd.org>2001-03-28 20:03:10 +0000
committerAngelos D. Keromytis <angelos@cvs.openbsd.org>2001-03-28 20:03:10 +0000
commit3ddeb82e5920fb4ce16a363a4cdf2ff420fc6f8c (patch)
tree21df0560d7db7bab293cc22bc52b21fd5727de8a /sys/kern
parent59779d47329c2626433e1ab0d847e7d7cd41aa48 (diff)
Allow tdbi's to appear in mbufs throughout the stack; this allows
security properties of the packets to be pushed up to the application (not done yet). Eventually, this will be turned into a packet attributes framework. Make sure tdbi's are free'd/cleared properly whenever drivers (or NFS) does weird things with mbufs.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/uipc_mbuf.c13
-rw-r--r--sys/kern/uipc_mbuf2.c4
2 files changed, 11 insertions, 6 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 1b33e500d99..ae876576c49 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_mbuf.c,v 1.23 2001/03/25 07:07:57 csapuntz Exp $ */
+/* $OpenBSD: uipc_mbuf.c,v 1.24 2001/03/28 20:03:00 angelos Exp $ */
/* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */
/*
@@ -279,6 +279,7 @@ m_prepend(m, len, how)
if (m->m_flags & M_PKTHDR) {
M_COPY_PKTHDR(mn, m);
m->m_flags &= ~M_PKTHDR;
+ m->m_pkthdr.tdbi = NULL;
}
mn->m_next = m;
m = mn;
@@ -621,6 +622,7 @@ m_pullup(n, len)
if (n->m_flags & M_PKTHDR) {
M_COPY_PKTHDR(m, n);
n->m_flags &= ~M_PKTHDR;
+ n->m_pkthdr.tdbi = NULL;
}
}
space = &m->m_dat[MLEN] - (m->m_data + m->m_len);
@@ -691,6 +693,7 @@ m_pullup2(n, len)
m->m_pkthdr = n->m_pkthdr;
m->m_flags = (n->m_flags & M_COPYFLAGS) | M_EXT;
n->m_flags &= ~M_PKTHDR;
+ n->m_pkthdr.tdbi = NULL;
/* n->m_data is cool. */
}
}
@@ -782,9 +785,10 @@ m_inject(m0, len0, siz, wait)
return (NULL);
remain = m->m_len - len;
if (remain == 0) {
- if ((m->m_next) && (M_LEADINGSPACE(m->m_next) >= siz)) {
+ if ((m->m_next) && (M_LEADINGSPACE(m->m_next) >= siz)) {
m->m_next->m_len += siz;
- m0->m_pkthdr.len += siz;
+ if (m0->m_flags & M_PKTHDR)
+ m0->m_pkthdr.len += siz;
m->m_next->m_data -= siz;
return m->m_next;
}
@@ -839,7 +843,7 @@ m_split(m0, len0, wait)
MGETHDR(n, wait, m0->m_type);
if (n == NULL)
return (NULL);
- n->m_pkthdr = m0->m_pkthdr;
+ M_DUP_PKTHDR(n, m0);
n->m_pkthdr.len -= len0;
olen = m0->m_pkthdr.len;
m0->m_pkthdr.len = len0;
@@ -886,6 +890,7 @@ extpacket:
m->m_next = NULL;
return (n);
}
+
/*
* Routine to copy from device local memory into mbufs.
*/
diff --git a/sys/kern/uipc_mbuf2.c b/sys/kern/uipc_mbuf2.c
index 2725dc389bc..d1b437b5944 100644
--- a/sys/kern/uipc_mbuf2.c
+++ b/sys/kern/uipc_mbuf2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_mbuf2.c,v 1.5 2001/02/14 17:04:34 itojun Exp $ */
+/* $OpenBSD: uipc_mbuf2.c,v 1.6 2001/03/28 20:03:00 angelos Exp $ */
/* $KAME: uipc_mbuf2.c,v 1.29 2001/02/14 13:42:10 itojun Exp $ */
/* $NetBSD: uipc_mbuf.c,v 1.40 1999/04/01 00:23:25 thorpej Exp $ */
@@ -261,7 +261,7 @@ m_dup1(m, off, len, wait)
return NULL;
if (copyhdr)
- M_COPY_PKTHDR(n, m);
+ M_DUP_PKTHDR(n, m);
m_copydata(m, off, len, mtod(n, caddr_t));
return n;
}