From 2ae2f9bbb7502589f279c329815d55ec526baffd Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Fri, 5 Dec 2014 22:10:37 +0100 Subject: [PATCH] Send ACKs without a payload upon receiving an out-of-order packet. This is necessary so the peer can detect "triplicate ACKs", which signal dropped packets, and at the same time keeps the TCP self-clocking active. --- utcp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utcp.c b/utcp.c index 2ef56ea..db775a9 100644 --- a/utcp.c +++ b/utcp.c @@ -587,12 +587,13 @@ ssize_t utcp_recv(struct utcp *utcp, const void *data, size_t len) { #endif if(!acceptable) { - debug("Packet not acceptable, %u <= %u + %zu < %u\n", c->rcv.nxt, hdr.seq, len, c->rcv.nxt + c->rcv.wnd); + debug("Packet not acceptable, %u <= %u + %zu < %u\n", c->rcv.nxt, hdr.seq, len, c->rcv.nxt + c->rcv.wnd); // Ignore unacceptable RST packets. if(hdr.ctl & RST) return 0; // Otherwise, send an ACK back in the hope things improve. - goto ack; + ack(c, true); + return 0; } c->snd.wnd = hdr.wnd; // TODO: move below -- 2.39.5