tcp_output.c (235961) | tcp_output.c (236170) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)tcp_output.c 8.4 (Berkeley) 5/24/95 30 */ 31 32#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1995 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)tcp_output.c 8.4 (Berkeley) 5/24/95 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/netinet/tcp_output.c 235961 2012-05-25 02:23:26Z bz $"); | 33__FBSDID("$FreeBSD: head/sys/netinet/tcp_output.c 236170 2012-05-28 09:30:13Z bz $"); |
34 35#include "opt_inet.h" 36#include "opt_inet6.h" 37#include "opt_ipsec.h" 38#include "opt_tcpdebug.h" 39 40#include <sys/param.h> 41#include <sys/systm.h> --- 1000 unchanged lines hidden (view full) --- 1042 } 1043#endif 1044 1045 /* 1046 * Put TCP length in extended header, and then 1047 * checksum extended header and data. 1048 */ 1049 m->m_pkthdr.len = hdrlen + len; /* in6_cksum() need this */ | 34 35#include "opt_inet.h" 36#include "opt_inet6.h" 37#include "opt_ipsec.h" 38#include "opt_tcpdebug.h" 39 40#include <sys/param.h> 41#include <sys/systm.h> --- 1000 unchanged lines hidden (view full) --- 1042 } 1043#endif 1044 1045 /* 1046 * Put TCP length in extended header, and then 1047 * checksum extended header and data. 1048 */ 1049 m->m_pkthdr.len = hdrlen + len; /* in6_cksum() need this */ |
1050 m->m_pkthdr.csum_flags = CSUM_TCP; | |
1051 m->m_pkthdr.csum_data = offsetof(struct tcphdr, th_sum); 1052#ifdef INET6 1053 if (isipv6) { 1054 /* 1055 * ip6_plen is not need to be filled now, and will be filled 1056 * in ip6_output. 1057 */ | 1050 m->m_pkthdr.csum_data = offsetof(struct tcphdr, th_sum); 1051#ifdef INET6 1052 if (isipv6) { 1053 /* 1054 * ip6_plen is not need to be filled now, and will be filled 1055 * in ip6_output. 1056 */ |
1057 m->m_pkthdr.csum_flags = CSUM_TCP_IPV6; |
|
1058 th->th_sum = in6_cksum_pseudo(ip6, sizeof(struct tcphdr) + 1059 optlen + len, IPPROTO_TCP, 0); 1060 } 1061#endif 1062#if defined(INET6) && defined(INET) 1063 else 1064#endif 1065#ifdef INET 1066 { | 1058 th->th_sum = in6_cksum_pseudo(ip6, sizeof(struct tcphdr) + 1059 optlen + len, IPPROTO_TCP, 0); 1060 } 1061#endif 1062#if defined(INET6) && defined(INET) 1063 else 1064#endif 1065#ifdef INET 1066 { |
1067 m->m_pkthdr.csum_flags = CSUM_TCP; |
|
1067 th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, 1068 htons(sizeof(struct tcphdr) + IPPROTO_TCP + len + optlen)); 1069 1070 /* IP version must be set here for ipv4/ipv6 checking later */ 1071 KASSERT(ip->ip_v == IPVERSION, 1072 ("%s: IP version incorrect: %d", __func__, ip->ip_v)); 1073 } 1074#endif --- 444 unchanged lines hidden --- | 1068 th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, 1069 htons(sizeof(struct tcphdr) + IPPROTO_TCP + len + optlen)); 1070 1071 /* IP version must be set here for ipv4/ipv6 checking later */ 1072 KASSERT(ip->ip_v == IPVERSION, 1073 ("%s: IP version incorrect: %d", __func__, ip->ip_v)); 1074 } 1075#endif --- 444 unchanged lines hidden --- |