Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 May 2016 01:37:34 +0000
From:      "sepherosa_gmail.com (Sepherosa Ziehau)" <phabric-noreply@FreeBSD.org>
To:        freebsd-net@freebsd.org
Subject:   [Differential] D5872: tcp: Don't prematurely drop receiving-only connections
Message-ID:  <56eb15d1f3565ca04fbef7c3c9c286e8@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

[-- Attachment #1 --]
sepherosa_gmail.com updated this revision to Diff 16171.
sepherosa_gmail.com added a comment.


  Change if(..) {panic} into assertion and wrap the assertion using macro.

CHANGES SINCE LAST UPDATE
  https://reviews.freebsd.org/D5872?vs=15642&id=16171

REVISION DETAIL
  https://reviews.freebsd.org/D5872

AFFECTED FILES
  sys/netinet/tcp_output.c

EMAIL PREFERENCES
  https://reviews.freebsd.org/settings/panel/emailpreferences/

To: sepherosa_gmail.com, network, glebius, adrian, delphij, decui_microsoft.com, honzhan_microsoft.com, howard0su_gmail.com, freebsd-net-list, lstewart, hiren, transport, jtl
Cc: gnn, mike-karels.net, jtl

[-- Attachment #2 --]
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
--- a/sys/netinet/tcp_output.c
+++ b/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?56eb15d1f3565ca04fbef7c3c9c286e8>