Fix a bug in tcp_input reported by Rick Jones <raj@hpisrdq.cup.hp.com>.

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
This commit is contained in:
Andras Olah 1995-04-05 10:32:14 +00:00
parent 3df0a1ed3f
commit 755c1f07c8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=7634
2 changed files with 16 additions and 22 deletions

View File

@ -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
@ -323,6 +323,12 @@ tcp_input(m, iphlen)
NTOHS(ti->ti_win);
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.
*/
@ -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);
/*
@ -537,12 +540,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.

View File

@ -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
@ -323,6 +323,12 @@ tcp_input(m, iphlen)
NTOHS(ti->ti_win);
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.
*/
@ -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);
/*
@ -537,12 +540,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.