diff options
Diffstat (limited to 'sys/netinet/tcp_input.c')
-rw-r--r-- | sys/netinet/tcp_input.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index cd63922fe2b..aee2240007e 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.224 2008/11/02 10:37:29 claudio Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.225 2009/06/03 18:22:44 naddy Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -522,9 +522,20 @@ tcp_input(struct mbuf *m, ...) /* * Checksum extended TCP header and data. */ - if (in6_cksum(m, IPPROTO_TCP, sizeof(struct ip6_hdr), tlen)) { - tcpstat.tcps_rcvbadsum++; - goto drop; + if ((m->m_pkthdr.csum_flags & M_TCP_CSUM_IN_OK) == 0) { + if (m->m_pkthdr.csum_flags & M_TCP_CSUM_IN_BAD) { + tcpstat.tcps_inhwcsum++; + tcpstat.tcps_rcvbadsum++; + goto drop; + } + if (in6_cksum(m, IPPROTO_TCP, sizeof(struct ip6_hdr), + tlen)) { + tcpstat.tcps_rcvbadsum++; + goto drop; + } + } else { + m->m_pkthdr.csum_flags &= ~M_TCP_CSUM_IN_OK; + tcpstat.tcps_inhwcsum++; } break; #endif |