From: Guus Sliepen Date: Tue, 29 Sep 2020 20:38:55 +0000 (+0200) Subject: Send RST packets when receiving data after we closed a UDP channel. X-Git-Url: http://git.meshlink.io/?p=meshlink;a=commitdiff_plain;h=1a023116b9d5e9a8fa93e81fcef725fd7b343593;hp=819884b6a5c5dc5514df2bfed6725e72c4eac840 Send RST packets when receiving data after we closed a UDP channel. If the application closed a channel, we keep the UTCP connection alive for a bit longer to handle resends of FIN packets. However, if this is missed for some reason, either because the FIN got lost or the peer ignored the receive callback, and the peer is sending new data, we need to inform it that we are no longer listening. To do this, send a RST back. --- diff --git a/src/utcp.c b/src/utcp.c index 65e6be7a..c1add218 100644 --- a/src/utcp.c +++ b/src/utcp.c @@ -1559,6 +1559,11 @@ synack: advanced = seqdiff(hdr.ack, c->snd.una); if(advanced) { + if(c->reapable && !is_reliable(c)) { + // TODO: we should also send RST for reliable connections + goto reset; + } + // RTT measurement if(c->rtt_start.tv_sec) { if(c->rtt_seq == hdr.ack) {