summaryrefslogtreecommitdiffstats
path: root/sys/netipsec
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2002-12-30 20:22:40 +0000
committersam <sam@FreeBSD.org>2002-12-30 20:22:40 +0000
commitb16cb0a948acd6a3b5f47aa494607a001944c194 (patch)
tree984c2041a8941be016b4cab972816b51adcc818d /sys/netipsec
parent83fcaa45a1be401bd2ecafa45dbfb492a71532b7 (diff)
downloadFreeBSD-src-b16cb0a948acd6a3b5f47aa494607a001944c194.zip
FreeBSD-src-b16cb0a948acd6a3b5f47aa494607a001944c194.tar.gz
Correct mbuf packet header propagation. Previously, packet headers
were sometimes propagated using M_COPY_PKTHDR which actually did something between a "move" and a "copy" operation. This is replaced by M_MOVE_PKTHDR (which copies the pkthdr contents and "removes" it from the source mbuf) and m_dup_pkthdr which copies the packet header contents including any m_tag chain. This corrects numerous problems whereby mbuf tags could be lost during packet manipulations. These changes also introduce arguments to m_tag_copy and m_tag_copy_chain to specify if the tag copy work should potentially block. This introduces an incompatibility with openbsd which we may want to revisit. Note that move/dup of packet headers does not handle target mbufs that have a cluster bound to them. We may want to support this; for now we watch for it with an assert. Finally, M_COPYFLAGS was updated to include M_FIRSTFRAG|M_LASTFRAG. Supported by: Vernier Networks Reviewed by: Robert Watson <rwatson@FreeBSD.org>
Diffstat (limited to 'sys/netipsec')
-rw-r--r--sys/netipsec/ipsec_mbuf.c2
-rw-r--r--sys/netipsec/ipsec_output.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/netipsec/ipsec_mbuf.c b/sys/netipsec/ipsec_mbuf.c
index 4cf1c7c..b2969ae 100644
--- a/sys/netipsec/ipsec_mbuf.c
+++ b/sys/netipsec/ipsec_mbuf.c
@@ -101,7 +101,7 @@ m_clone(struct mbuf *m0)
m_freem(m0);
return (NULL);
}
- M_COPY_PKTHDR(n, m);
+ M_MOVE_PKTHDR(n, m);
MCLGET(n, M_DONTWAIT);
if ((n->m_flags & M_EXT) == 0) {
m_free(n);
diff --git a/sys/netipsec/ipsec_output.c b/sys/netipsec/ipsec_output.c
index 836e17b..3748747 100644
--- a/sys/netipsec/ipsec_output.c
+++ b/sys/netipsec/ipsec_output.c
@@ -474,7 +474,7 @@ ipsec6_splithdr(struct mbuf *m)
m_freem(m);
return NULL;
}
- M_COPY_PKTHDR(mh, m);
+ M_MOVE_PKTHDR(mh, m);
MH_ALIGN(mh, hlen);
m->m_len -= hlen;
m->m_data += hlen;
OpenPOWER on IntegriCloud