Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Dec 2016 12:23:49 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r310212 - in stable/11/sys/netinet: . tcp_stacks
Message-ID:  <201612181223.uBICNn7s058088@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tuexen
Date: Sun Dec 18 12:23:48 2016
New Revision: 310212
URL: https://svnweb.freebsd.org/changeset/base/310212

Log:
  MFC r308832:
  
  Ensure that TCP state changes to state-closing are reported via dtrace.
  This does not cover state changes from TIME-WAIT.
  
  Sponsored by:	Netflix, Inc.

Modified:
  stable/11/sys/netinet/tcp_input.c
  stable/11/sys/netinet/tcp_stacks/fastpath.c
  stable/11/sys/netinet/tcp_subr.c
  stable/11/sys/netinet/tcp_timewait.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/tcp_input.c
==============================================================================
--- stable/11/sys/netinet/tcp_input.c	Sun Dec 18 12:20:22 2016	(r310211)
+++ stable/11/sys/netinet/tcp_input.c	Sun Dec 18 12:23:48 2016	(r310212)
@@ -2189,7 +2189,6 @@ tcp_do_segment(struct mbuf *m, struct tc
 				case TCPS_LAST_ACK:
 					so->so_error = ECONNRESET;
 				close:
-					tcp_state_change(tp, TCPS_CLOSED);
 					/* FALLTHROUGH */
 				default:
 					tp = tcp_close(tp);

Modified: stable/11/sys/netinet/tcp_stacks/fastpath.c
==============================================================================
--- stable/11/sys/netinet/tcp_stacks/fastpath.c	Sun Dec 18 12:20:22 2016	(r310211)
+++ stable/11/sys/netinet/tcp_stacks/fastpath.c	Sun Dec 18 12:23:48 2016	(r310212)
@@ -738,7 +738,6 @@ tcp_do_slowpath(struct mbuf *m, struct t
 				case TCPS_LAST_ACK:
 					so->so_error = ECONNRESET;
 				close:
-					tcp_state_change(tp, TCPS_CLOSED);
 					/* FALLTHROUGH */
 				default:
 					tp = tcp_close(tp);

Modified: stable/11/sys/netinet/tcp_subr.c
==============================================================================
--- stable/11/sys/netinet/tcp_subr.c	Sun Dec 18 12:20:22 2016	(r310211)
+++ stable/11/sys/netinet/tcp_subr.c	Sun Dec 18 12:23:48 2016	(r310212)
@@ -1483,6 +1483,7 @@ tcp_discardcb(struct tcpcb *tp)
 	inp->inp_ppcb = NULL;
 	if (tp->t_timers->tt_draincnt == 0) {
 		/* We own the last reference on tcpcb, let's free it. */
+		TCPSTATES_DEC(tp->t_state);
 		if (tp->t_fb->tfb_tcp_fb_fini)
 			(*tp->t_fb->tfb_tcp_fb_fini)(tp);
 		refcount_release(&tp->t_fb->tfb_refcnt);
@@ -1512,6 +1513,7 @@ tcp_timer_discard(void *ptp)
 	tp->t_timers->tt_draincnt--;
 	if (tp->t_timers->tt_draincnt == 0) {
 		/* We own the last reference on this tcpcb, let's free it. */
+		TCPSTATES_DEC(tp->t_state);
 		if (tp->t_fb->tfb_tcp_fb_fini)
 			(*tp->t_fb->tfb_tcp_fb_fini)(tp);
 		refcount_release(&tp->t_fb->tfb_refcnt);
@@ -1558,7 +1560,8 @@ tcp_close(struct tcpcb *tp)
 #endif
 	in_pcbdrop(inp);
 	TCPSTAT_INC(tcps_closed);
-	TCPSTATES_DEC(tp->t_state);
+	if (tp->t_state != TCPS_CLOSED)
+		tcp_state_change(tp, TCPS_CLOSED);
 	KASSERT(inp->inp_socket != NULL, ("tcp_close: inp_socket NULL"));
 	so = inp->inp_socket;
 	soisdisconnected(so);

Modified: stable/11/sys/netinet/tcp_timewait.c
==============================================================================
--- stable/11/sys/netinet/tcp_timewait.c	Sun Dec 18 12:20:22 2016	(r310211)
+++ stable/11/sys/netinet/tcp_timewait.c	Sun Dec 18 12:23:48 2016	(r310212)
@@ -340,6 +340,7 @@ tcp_twstart(struct tcpcb *tp)
 		tcp_twrespond(tw, TH_ACK);
 	inp->inp_ppcb = tw;
 	inp->inp_flags |= INP_TIMEWAIT;
+	TCPSTATES_INC(TCPS_TIME_WAIT);
 	tcp_tw_2msl_reset(tw, 0);
 
 	/*



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