Michael Brown
2016-Jul-04 07:23 UTC
[syslinux] [PATCH] core/lwip: Avoid 3-second delay for a half-open connection
If lwIP encounters a half-open connection (e.g. due to a restarted
application reusing the same port numbers) it will correctly send a
RST but will not resend the SYN until one retransmission timeout later
(approximately three seconds). This can increase the time taken by
lpxelinux.0 to fetch its configuration file from a few milliseconds to
around 30 seconds.
Fix by immediately retransmitting the SYN whenever a half-open
connection is detected.
Signed-off-by: Michael Brown <mcb30 at ipxe.org>
---
core/lwip/src/core/tcp_in.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/core/lwip/src/core/tcp_in.c b/core/lwip/src/core/tcp_in.c
index 9095264..d410dab 100644
--- a/core/lwip/src/core/tcp_in.c
+++ b/core/lwip/src/core/tcp_in.c
@@ -675,6 +675,9 @@ tcp_process(struct tcp_pcb *pcb)
/* send a RST to bring the other side in a non-synchronized state. */
tcp_rst(ackno, seqno + tcplen, ip_current_dest_addr(),
ip_current_src_addr(),
tcphdr->dest, tcphdr->src);
+ /* Resend SYN immediately to establish connection */
+ pcb->rtime = 0;
+ tcp_rexmit_rto(pcb);
}
break;
case SYN_RCVD:
--
2.3.8
Michael Brown
2016-Jul-04 10:32 UTC
[syslinux] [PATCH] core/lwip: Avoid 3-second delay for a half-open connection
On 04/07/16 08:23, Michael Brown wrote:> If lwIP encounters a half-open connection (e.g. due to a restarted > application reusing the same port numbers) it will correctly send a > RST but will not resend the SYN until one retransmission timeout later > (approximately three seconds). This can increase the time taken by > lpxelinux.0 to fetch its configuration file from a few milliseconds to > around 30 seconds. > > Fix by immediately retransmitting the SYN whenever a half-open > connection is detected.FYI: this patch has been accepted by upstream lwIP: https://savannah.nongnu.org/patch/?9039 http://git.savannah.gnu.org/cgit/lwip.git/commit/?id=2e26fc9 Michael