From 4ddd5aadea88277330217cec8deb6de6ff74224a Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Fri, 2 Dec 2016 08:02:31 +0000 Subject: [PATCH] Fix the handling of TCP FIN-segments in the CLOSED state When a TCP segment with the FIN bit set was received in the CLOSED state, a TCP RST-ACK-segment is sent. When computing SEG.ACK for this, the FIN counts as one byte. This accounting was missing and is fixed by this patch. Reviewed by: hiren MFC after: 1 month Sponsored by: Netflix, Inc. Differential Revision: https://svn.freebsd.org/base/head --- sys/netinet/tcp_input.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index dbd27ef1b252..c7fbb98e481f 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -3357,6 +3357,8 @@ tcp_dropwithreset(struct mbuf *m, struct tcphdr *th, struct tcpcb *tp, } else { if (th->th_flags & TH_SYN) tlen++; + if (th->th_flags & TH_FIN) + tlen++; tcp_respond(tp, mtod(m, void *), th, m, th->th_seq+tlen, (tcp_seq)0, TH_RST|TH_ACK); }