Added check on entire sequence number of received packet being less than the rcv_nxt variable.

(see http://www.sics.se/mailing-lists/lwip.html/msg01409.html)
This commit is contained in:
kieranm 2002-10-24 13:34:36 +00:00
parent aa69784495
commit 8b5fcad039

View File

@ -825,8 +825,8 @@ tcp_receive(struct tcp_pcb *pcb)
this if the sequence number of the incoming segment is less
than rcv_nxt, and the sequence number plus the length of the
segment is larger than rcv_nxt. */
if(TCP_SEQ_LT(seqno, pcb->rcv_nxt) &&
TCP_SEQ_LT(pcb->rcv_nxt, seqno + tcplen)) {
if(TCP_SEQ_LT(seqno, pcb->rcv_nxt)){
if(TCP_SEQ_LT(pcb->rcv_nxt, seqno + tcplen)) {
/* Trimming the first edge is done by pushing the payload
pointer in the pbuf downwards. This is somewhat tricky since
we do not want to discard the full contents of the pbuf up to
@ -863,6 +863,13 @@ tcp_receive(struct tcp_pcb *pcb)
inseg.len -= pcb->rcv_nxt - seqno;
inseg.tcphdr->seqno = seqno = pcb->rcv_nxt;
}
else{
/* the whole segment is < rcv_nxt */
/* must be a duplicate of a packet that has already been correctly handled */
DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: duplicate seqno %ld\n", seqno));
}
}
/* The sequence number must be within the window (above rcv_nxt
and below rcv_nxt + rcv_wnd) in order to be further