diff options
author | 2013-10-19 10:38:54 +0000 | |
---|---|---|
committer | 2013-10-19 10:38:54 +0000 | |
commit | b90d0bccdbd6f2e566fffeb1450490a75b9d8dd0 (patch) | |
tree | 48f9c7cf958edcb289fc9129638513307c6c4e1f /sys/netinet/tcp_output.c | |
parent | sync (diff) | |
download | wireguard-openbsd-b90d0bccdbd6f2e566fffeb1450490a75b9d8dd0.tar.xz wireguard-openbsd-b90d0bccdbd6f2e566fffeb1450490a75b9d8dd0.zip |
make in_proto_cksum_out not rely on the pseudo header checksum to be
already there, just compute it - it's dirt cheap. since that happens
very late in ip_output, the rest of the stack doesn't have to care about
checksums at all any more, if something needs to be checksummed, just
set the flag on the pkthdr mbuf to indicate so.
stop pre-computing the pseudo header checksum and incrementally updating it
in the tcp and udp stacks.
ok lteo florian
Diffstat (limited to 'sys/netinet/tcp_output.c')
-rw-r--r-- | sys/netinet/tcp_output.c | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 9d5b469a51f..d3b8c768bd9 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_output.c,v 1.99 2013/08/12 21:57:16 bluhm Exp $ */ +/* $OpenBSD: tcp_output.c,v 1.100 2013/10/19 10:38:55 henning Exp $ */ /* $NetBSD: tcp_output.c,v 1.16 1997/06/03 16:17:09 kml Exp $ */ /* @@ -947,28 +947,8 @@ send: } #endif /* TCP_SIGNATURE */ - /* - * Put TCP length in extended header, and then - * checksum extended header and data. - */ - switch (tp->pf) { - case 0: /*default to PF_INET*/ -#ifdef INET - case AF_INET: - /* Defer checksumming until later (ip_output() or hardware) */ - m->m_pkthdr.csum_flags |= M_TCP_CSUM_OUT; - if (len + optlen) - th->th_sum = in_cksum_addword(th->th_sum, - htons((u_int16_t)(len + optlen))); - break; -#endif /* INET */ -#ifdef INET6 - case AF_INET6: - th->th_sum = in6_cksum(m, IPPROTO_TCP, sizeof(struct ip6_hdr), - hdrlen - sizeof(struct ip6_hdr) + len); - break; -#endif /* INET6 */ - } + /* Defer checksumming until later (ip_output() or hardware) */ + m->m_pkthdr.csum_flags |= M_TCP_CSUM_OUT; /* * In transmit state, time the transmission and arrange for |