Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 May 2016 03:31:51 +0000
From:      Phabricator <phabric-noreply@FreeBSD.org>
To:        freebsd-net@freebsd.org
Subject:   [Differential] D5872: tcp: Don't prematurely drop receiving-only connections
Message-ID:  <32e175bd971d5eb339edae7b5bf9a8f1@localhost.localdomain>
In-Reply-To: <differential-rev-PHID-DREV-5vu7wrfibtoing77xfvt-req@FreeBSD.org>
References:  <differential-rev-PHID-DREV-5vu7wrfibtoing77xfvt-req@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

diff --git a/head/sys/netinet/tcp_output.c b/head/sys/netinet/tcp_output.c
--- a/head/sys/netinet/tcp_output.c
+++ b/head/sys/netinet/tcp_output.c
@@ -130,6 +130,16 @@
 	&VNET_NAME(tcp_autosndbuf_max), 0,
 	"Max size of automatic send buffer");
 
+/*
+ * Make sure that either retransmit or persist timer is set for SYN, FIN and
+ * non-ACK.
+ */
+#define TCP_XMIT_TIMER_ASSERT(tp, len, th_flags)			\
+	KASSERT(((len) == 0 && ((th_flags) & (TH_SYN | TH_FIN)) == 0) ||\
+	    tcp_timer_active((tp), TT_REXMT) ||				\
+	    tcp_timer_active((tp), TT_PERSIST),				\
+	    ("neither rexmt nor persist timer is set"))
+
 static void inline	hhook_run_tcp_est_out(struct tcpcb *tp,
 			    struct tcphdr *th, struct tcpopt *to,
 			    long len, int tso);
@@ -1545,9 +1555,7 @@
 			tp->t_softerror = error;
 			return (error);
 		case ENOBUFS:
-	                if (!tcp_timer_active(tp, TT_REXMT) &&
-			    !tcp_timer_active(tp, TT_PERSIST))
-	                        tcp_timer_activate(tp, TT_REXMT, tp->t_rxtcur);
+			TCP_XMIT_TIMER_ASSERT(tp, len, flags);
 			tp->snd_cwnd = tp->t_maxseg;
 			return (0);
 		case EMSGSIZE:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?32e175bd971d5eb339edae7b5bf9a8f1>