From ccccd069f4ff70a758caf7c0e749a3bc36534b0b Mon Sep 17 00:00:00 2001 From: olah Date: Wed, 5 Apr 1995 10:32:14 +0000 Subject: Fix a bug in tcp_input reported by Rick Jones . If a goto findpcb occurred during the processing of a segment, the TCP and IP headers were dropped twice from the mbuf which resulted in data acked by TCP but not delivered to the user. Reviewed by: davidg --- sys/netinet/tcp_reass.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'sys/netinet/tcp_reass.c') diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c index c35f038..d9f287d 100644 --- a/sys/netinet/tcp_reass.c +++ b/sys/netinet/tcp_reass.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * From: @(#)tcp_input.c 8.5 (Berkeley) 4/10/94 - * $Id: tcp_input.c,v 1.16 1995/03/16 18:15:04 bde Exp $ + * $Id: tcp_input.c,v 1.17 1995/03/27 07:12:24 davidg Exp $ */ #ifndef TUBA_INCLUDE @@ -324,6 +324,12 @@ tcp_input(m, iphlen) NTOHS(ti->ti_urp); /* + * Drop TCP, IP headers and TCP options. + */ + m->m_data += sizeof(struct tcpiphdr)+off-sizeof(struct tcphdr); + m->m_len -= sizeof(struct tcpiphdr)+off-sizeof(struct tcphdr); + + /* * Locate pcb for segment. */ findpcb: @@ -515,11 +521,8 @@ findpcb: tcpstat.tcps_rcvpack++; tcpstat.tcps_rcvbyte += ti->ti_len; /* - * Drop TCP, IP headers and TCP options then add data - * to socket buffer. + * Add data to socket buffer. */ - m->m_data += sizeof(struct tcpiphdr)+off-sizeof(struct tcphdr); - m->m_len -= sizeof(struct tcpiphdr)+off-sizeof(struct tcphdr); sbappend(&so->so_rcv, m); sorwakeup(so); /* @@ -538,12 +541,6 @@ findpcb: } /* - * Drop TCP, IP headers and TCP options. - */ - m->m_data += sizeof(struct tcpiphdr)+off-sizeof(struct tcphdr); - m->m_len -= sizeof(struct tcpiphdr)+off-sizeof(struct tcphdr); - - /* * Calculate amount of space in receive window, * and then do TCP input processing. * Receive window is amount of space in rcv queue, -- cgit v1.1