Subject: Re: Wart in tcp_output(), IPv6-related?
To: None <thorpej@wasabisystems.com, tech-net@netbsd.org>
From: None <itojun@iijlab.net>
List: tech-net
Date: 04/27/2002 09:18:33
> i am happy to remove "max_linkhdr + hdrlen + len <= MCLBYTES" line.
> if the line gets removed the "always-copy" behavior will go away.
and if you really want to make sure there'll be no copy in the function,
you can get rid of "if (len <= M_TRAILINGSPACE)" case.
my proposed diff attached.
itojun
Index: tcp_output.c
===================================================================
RCS file: /cvsroot/syssrc/sys/netinet/tcp_output.c,v
retrieving revision 1.78
diff -u -r1.78 tcp_output.c
--- tcp_output.c 2002/03/01 22:54:09 1.78
+++ tcp_output.c 2002/04/27 00:17:04
@@ -384,9 +384,7 @@
m->m_data -= hdrlen;
#else
MGETHDR(m, M_DONTWAIT, MT_HEADER);
- if (m != NULL &&
- (max_linkhdr + hdrlen > MHLEN ||
- max_linkhdr + hdrlen + len <= MCLBYTES)) {
+ if (m != NULL && max_linkhdr + hdrlen > MHLEN) {
MCLGET(m, M_DONTWAIT);
if ((m->m_flags & M_EXT) == 0) {
m_freem(m);
@@ -397,7 +395,7 @@
return (ENOBUFS);
m->m_data += max_linkhdr;
m->m_len = hdrlen;
- if (len <= M_TRAILINGSPACE(m)) {
+ if (0) {
m_copydata(so->so_snd.sb_mb, off, (int) len,
mtod(m, caddr_t) + hdrlen);
m->m_len += len;