From a603f61e7dc92e31d3fd7fb51a846123804b88e0 Mon Sep 17 00:00:00 2001 From: Daniel Libenson Date: Wed, 1 Nov 2017 04:47:21 +0000 Subject: [PATCH] issue: 1181379 Fix TCP zero window probe when there is data in-flight TCP zero-window probe message should not be sent when there is data in-flight (unacked packets, pcb->unacked != NULL). Signed-off-by: Daniel Libenson --- src/vma/lwip/tcp.c | 2 +- src/vma/lwip/tcp_in.c | 2 +- src/vma/lwip/tcp_out.c | 8 +++----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/vma/lwip/tcp.c b/src/vma/lwip/tcp.c index 7777411095..f53581411b 100644 --- a/src/vma/lwip/tcp.c +++ b/src/vma/lwip/tcp.c @@ -728,7 +728,7 @@ tcp_slowtmr(struct tcp_pcb* pcb) LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: max DATA retries reached\n")); } else { if (pcb->persist_backoff > 0) { - /* If snd_wnd is zero, use persist timer to send 1 byte probes + /* If snd_wnd is zero and pcb->unacked is NULL , use persist timer to send 1 byte probes * instead of using the standard retransmission mechanism. */ pcb->persist_cnt++; if (pcb->persist_cnt >= tcp_persist_backoff[pcb->persist_backoff-1]) { diff --git a/src/vma/lwip/tcp_in.c b/src/vma/lwip/tcp_in.c index b75d8fa306..b19dab4f8d 100644 --- a/src/vma/lwip/tcp_in.c +++ b/src/vma/lwip/tcp_in.c @@ -763,7 +763,7 @@ tcp_receive(struct tcp_pcb *pcb, tcp_in_data* in_data) pcb->snd_wl1 = in_data->seqno; pcb->snd_wl2 = in_data->ackno; if (pcb->snd_wnd == 0) { - if (pcb->persist_backoff == 0) { + if (pcb->persist_backoff == 0 && pcb->unacked == NULL) { /* start persist timer */ pcb->persist_cnt = 0; pcb->persist_backoff = 1; diff --git a/src/vma/lwip/tcp_out.c b/src/vma/lwip/tcp_out.c index 5f33f0fda6..57bfa3a611 100644 --- a/src/vma/lwip/tcp_out.c +++ b/src/vma/lwip/tcp_out.c @@ -1564,12 +1564,10 @@ tcp_zero_window_probe(struct tcp_pcb *pcb) " pcb->tmr %"U32_F" pcb->keep_cnt_sent %"U16_F"\n", tcp_ticks, pcb->tmr, pcb->keep_cnt_sent)); - seg = pcb->unacked; - - if(seg == NULL) { - seg = pcb->unsent; - } + /* Only consider unsent, persist timer should be off when there data is in-flight */ + seg = pcb->unsent; if(seg == NULL) { + /* Not expected, persist timer should be off when the send buffer is empty */ return; }