From cceea73c3f32f433f3d6b5c8212a8ca1f06cddab Mon Sep 17 00:00:00 2001 From: Joel Cunningham Date: Fri, 9 Dec 2016 18:10:24 -0600 Subject: [PATCH] bug #49631: handle zero-window probe and refused_data This commit adds support for responding to a zero-window probe when the refused_data pointer is set A zero-window probe is a data segment received when rcv_ann_wnd is 0. This corrects a standards violation where LwIP would not respond to a zero-window probe with its current ACK value (RCV.NXT) when it has refused data, thus leading to the probing TCP closing out the connection --- src/core/tcp_in.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c index 3d3ae33a..fbbdc729 100644 --- a/src/core/tcp_in.c +++ b/src/core/tcp_in.c @@ -358,6 +358,11 @@ tcp_input(struct pbuf *p, struct netif *inp) ((pcb->refused_data != NULL) && (tcplen > 0))) { /* pcb has been aborted or refused data is still refused and the new segment contains data */ + if (pcb->rcv_ann_wnd == 0) { + /* this is a zero-window probe, we respond to it with current RCV.NXT + and drop the data segment */ + tcp_send_empty_ack(pcb); + } TCP_STATS_INC(tcp.drop); MIB2_STATS_INC(mib2.tcpinerrs); goto aborted;