Subject: clear h/w csum flags in tcp_respond()
To: None <tech-net@netbsd.org>
From: john heasley <heas@shrubbery.net>
List: tech-net
Date: 01/03/2005 00:14:13
Unless I'm missing something, tcp_respond() always performs the TCP
checksum. Thus, the mbuf pkthdr csum_flags ought to be cleared, since
csum_data is not set for use with h/w checksuming by tcp_respond() and
the checksum does not need to be done twice.
I noticed it when my test box came back after crashing. The connections
that I had open before the crash were not reset. Note, this is an hme(4)
with my changes to ip_output() to stuff the pseudo-hdr checksum for hme's
brand of h/w checksum.
does this look ok/reasonable?
Index: tcp_subr.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/tcp_subr.c,v
retrieving revision 1.176
diff -u -r1.176 tcp_subr.c
--- tcp_subr.c 19 Dec 2004 06:42:24 -0000 1.176
+++ tcp_subr.c 3 Jan 2005 00:02:02 -0000
@@ -689,6 +689,9 @@
m_freem(m);
return EAFNOSUPPORT;
}
+ /* clear h/w csum data from rx packet */
+ m->m_pkthdr.csum_flags = 0;
+
if ((flags & TH_SYN) == 0 || sizeof(*th0) > (th0->th_off << 2))
tlen = sizeof(*th0);
else