summaryrefslogtreecommitdiffstats
path: root/sys/netipsec
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2009-11-28 21:40:57 +0000
committerbz <bz@FreeBSD.org>2009-11-28 21:40:57 +0000
commit8bebf9e60f3a21908dc031be4cffd6b882a14ae2 (patch)
tree72651ba287dcc2d9c1a38f05abe18c68b7372445 /sys/netipsec
parent3fae6ec1cfa39a9b05af3aa4b01cf5ccdd92c5ca (diff)
downloadFreeBSD-src-8bebf9e60f3a21908dc031be4cffd6b882a14ae2.zip
FreeBSD-src-8bebf9e60f3a21908dc031be4cffd6b882a14ae2.tar.gz
Directly send data uncompressed if the packet payload size is lower than
the compression algorithm threshold. MFC after: 6 days
Diffstat (limited to 'sys/netipsec')
-rw-r--r--sys/netipsec/xform_ipcomp.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/netipsec/xform_ipcomp.c b/sys/netipsec/xform_ipcomp.c
index 4049154..93a157e 100644
--- a/sys/netipsec/xform_ipcomp.c
+++ b/sys/netipsec/xform_ipcomp.c
@@ -343,6 +343,17 @@ ipcomp_output(
ipcompx = sav->tdb_compalgxform;
IPSEC_ASSERT(ipcompx != NULL, ("null compression xform"));
+ /*
+ * Do not touch the packet in case our payload to compress
+ * is lower than the minimal threshold of the compression
+ * alogrithm. We will just send out the data uncompressed.
+ * See RFC 3173, 2.2. Non-Expansion Policy.
+ */
+ if (m->m_pkthdr.len <= ipcompx->minlen) {
+ /* XXX-BZ V_ipcompstat.threshold++; */
+ return ipsec_process_done(m, isr);
+ }
+
ralen = m->m_pkthdr.len - skip; /* Raw payload length before comp. */
hlen = IPCOMP_HLENGTH;
OpenPOWER on IntegriCloud