mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-03-12 22:14:25 +00:00
tcp: do not keep sending SYNs when getting ACKs
If a locally generated TCP SYN packet is replied to with an ACK packet, lwIP immediately sends a RST packet followed by resending the SYN packet. This is expected, but on loopback interfaces the resent SYN packet may immediately get another ACK reply, typically when the other endpoint is in TIME_WAIT state (which ignores the RSTs). The result is an endless loop of SYN, ACK, RST packets. This patch applies the normal SYN retransmission limit in this scenario, such that the endless loop is limited to a brief storm.
This commit is contained in:
parent
b90a54f989
commit
5827c168c2
@ -810,9 +810,12 @@ tcp_process(struct tcp_pcb *pcb)
|
||||
tcp_rst(ackno, seqno + tcplen, ip_current_dest_addr(),
|
||||
ip_current_src_addr(), tcphdr->dest, tcphdr->src);
|
||||
/* Resend SYN immediately (don't wait for rto timeout) to establish
|
||||
connection faster */
|
||||
pcb->rtime = 0;
|
||||
tcp_rexmit_rto(pcb);
|
||||
connection faster, but do not send more SYNs than we otherwise would
|
||||
have, or we might get caught in a loop on loopback interfaces. */
|
||||
if (pcb->nrtx < TCP_SYNMAXRTX) {
|
||||
pcb->rtime = 0;
|
||||
tcp_rexmit_rto(pcb);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SYN_RCVD:
|
||||
|
Loading…
x
Reference in New Issue
Block a user