Deleted Added
full compact
tcp_input.c (57904) tcp_input.c (58698)
1/*
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994, 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

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)tcp_input.c 8.12 (Berkeley) 5/24/95
1/*
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994, 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

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)tcp_input.c 8.12 (Berkeley) 5/24/95
34 * $FreeBSD: head/sys/netinet/tcp_input.c 57903 2000-03-11 11:17:24Z shin $
34 * $FreeBSD: head/sys/netinet/tcp_input.c 58698 2000-03-27 19:14:27Z jlemon $
35 */
36
37#include "opt_ipfw.h" /* for ipfw_fwd */
38#include "opt_inet6.h"
39#include "opt_ipsec.h"
40#include "opt_tcpdebug.h"
41#include "opt_tcp_input.h"
42

--- 52 unchanged lines hidden (view full) ---

95#ifdef IPSEC
96#include <netinet6/ipsec.h>
97#ifdef INET6
98#include <netinet6/ipsec6.h>
99#endif
100#include <netkey/key.h>
101#endif /*IPSEC*/
102
35 */
36
37#include "opt_ipfw.h" /* for ipfw_fwd */
38#include "opt_inet6.h"
39#include "opt_ipsec.h"
40#include "opt_tcpdebug.h"
41#include "opt_tcp_input.h"
42

--- 52 unchanged lines hidden (view full) ---

95#ifdef IPSEC
96#include <netinet6/ipsec.h>
97#ifdef INET6
98#include <netinet6/ipsec6.h>
99#endif
100#include <netkey/key.h>
101#endif /*IPSEC*/
102
103#include <machine/in_cksum.h>
104
103MALLOC_DEFINE(M_TSEGQ, "tseg_qent", "TCP segment queue entry");
104
105static int tcprexmtthresh = 3;
106tcp_seq tcp_iss;
107tcp_cc tcp_ccgen;
108
109struct tcpstat tcpstat;
110SYSCTL_STRUCT(_net_inet_tcp, TCPCTL_STATS, stats, CTLFLAG_RD,

--- 309 unchanged lines hidden (view full) ---

420 if (m->m_len < sizeof (struct tcpiphdr)) {
421 if ((m = m_pullup(m, sizeof (struct tcpiphdr))) == 0) {
422 tcpstat.tcps_rcvshort++;
423 return;
424 }
425 }
426 ip = mtod(m, struct ip *);
427 ipov = (struct ipovly *)ip;
105MALLOC_DEFINE(M_TSEGQ, "tseg_qent", "TCP segment queue entry");
106
107static int tcprexmtthresh = 3;
108tcp_seq tcp_iss;
109tcp_cc tcp_ccgen;
110
111struct tcpstat tcpstat;
112SYSCTL_STRUCT(_net_inet_tcp, TCPCTL_STATS, stats, CTLFLAG_RD,

--- 309 unchanged lines hidden (view full) ---

422 if (m->m_len < sizeof (struct tcpiphdr)) {
423 if ((m = m_pullup(m, sizeof (struct tcpiphdr))) == 0) {
424 tcpstat.tcps_rcvshort++;
425 return;
426 }
427 }
428 ip = mtod(m, struct ip *);
429 ipov = (struct ipovly *)ip;
428
429 /*
430 * Checksum extended TCP header and data.
431 */
432 tlen = ip->ip_len;
433 len = sizeof (struct ip) + tlen;
434 bzero(ipov->ih_x1, sizeof(ipov->ih_x1));
435 ipov->ih_len = (u_short)tlen;
436 HTONS(ipov->ih_len);
437 th = (struct tcphdr *)((caddr_t)ip + off0);
430 th = (struct tcphdr *)((caddr_t)ip + off0);
438 th->th_sum = in_cksum(m, len);
431 tlen = ip->ip_len;
432
433 if (m->m_pkthdr.csum_flags & CSUM_DATA_VALID) {
434 if (m->m_pkthdr.csum_flags & CSUM_PSEUDO_HDR)
435 th->th_sum = m->m_pkthdr.csum_data;
436 else
437 th->th_sum = in_pseudo(ip->ip_src.s_addr,
438 ip->ip_dst.s_addr, htonl(m->m_pkthdr.csum_data +
439 ip->ip_len + IPPROTO_TCP));
440 th->th_sum ^= 0xffff;
441 } else {
442 /*
443 * Checksum extended TCP header and data.
444 */
445 len = sizeof (struct ip) + tlen;
446 bzero(ipov->ih_x1, sizeof(ipov->ih_x1));
447 ipov->ih_len = (u_short)tlen;
448 HTONS(ipov->ih_len);
449 th->th_sum = in_cksum(m, len);
450 }
439 if (th->th_sum) {
440 tcpstat.tcps_rcvbadsum++;
441 goto drop;
442 }
443#ifdef INET6
444 /* Re-initialization for later version check */
445 ip->ip_v = IPVERSION;
446#endif

--- 2336 unchanged lines hidden ---
451 if (th->th_sum) {
452 tcpstat.tcps_rcvbadsum++;
453 goto drop;
454 }
455#ifdef INET6
456 /* Re-initialization for later version check */
457 ip->ip_v = IPVERSION;
458#endif

--- 2336 unchanged lines hidden ---