summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2004-02-16 21:51:04 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2004-02-16 21:51:04 +0000
commitbb9b34b7ecd09765f7c4e20efca25275883bd7a5 (patch)
treed75bfc26da55ccf3f6e4e2b443244f9eaee15b36
parent41c22c0898dd66a64db01a03ef97b066fb8a3a9b (diff)
don't allocate a cluster if the header fits into a mbuf;
ok itojun@, henning@, mcbride@
-rw-r--r--sys/netinet/tcp_output.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index 9a8f9fba4ec..ceeac82cdb9 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_output.c,v 1.64 2004/02/10 10:30:24 markus Exp $ */
+/* $OpenBSD: tcp_output.c,v 1.65 2004/02/16 21:51:03 markus Exp $ */
/* $NetBSD: tcp_output.c,v 1.16 1997/06/03 16:17:09 kml Exp $ */
/*
@@ -705,7 +705,7 @@ send:
m->m_data -= hdrlen;
#else
MGETHDR(m, M_DONTWAIT, MT_HEADER);
- if (m != NULL) {
+ if (m != NULL && max_linkhdr + hdrlen > MHLEN) {
MCLGET(m, M_DONTWAIT);
if ((m->m_flags & M_EXT) == 0) {
m_freem(m);
@@ -718,7 +718,7 @@ send:
}
m->m_data += max_linkhdr;
m->m_len = hdrlen;
- if (len <= MCLBYTES - hdrlen - max_linkhdr) {
+ if (len <= M_TRAILINGSPACE(m)) {
m_copydata(so->so_snd.sb_mb, off, (int) len,
mtod(m, caddr_t) + hdrlen);
m->m_len += len;
@@ -750,7 +750,7 @@ send:
tcpstat.tcps_sndwinup++;
MGETHDR(m, M_DONTWAIT, MT_HEADER);
- if (m != NULL) {
+ if (m != NULL && max_linkhdr + hdrlen > MHLEN) {
MCLGET(m, M_DONTWAIT);
if ((m->m_flags & M_EXT) == 0) {
m_freem(m);