svn commit: r332177 - stable/11/sys/netinet/tcp_stacks

Michael Tuexen tuexen at FreeBSD.org
Sat Apr 7 15:10:09 UTC 2018


Author: tuexen
Date: Sat Apr  7 15:10:08 2018
New Revision: 332177
URL: https://svnweb.freebsd.org/changeset/base/332177

Log:
  MFC r322812:
  
  Avoid TCP log messages which are false positives.
  
  The check for timestamps are too early to handle SYN-ACK correctly.
  So move it down after the corresponing processing has been done.
  
  MFC r322813:
  
  Avoid TCP log messages which are false positives.
  
  This is https://svnweb.freebsd.org/changeset/base/322812, just for
  alternate TCP stacks.
  
  PR:		216832
  Obtained from:	antonfb at hesiod.org

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

Modified: stable/11/sys/netinet/tcp_stacks/fastpath.c
==============================================================================
--- stable/11/sys/netinet/tcp_stacks/fastpath.c	Sat Apr  7 14:45:55 2018	(r332176)
+++ stable/11/sys/netinet/tcp_stacks/fastpath.c	Sat Apr  7 15:10:08 2018	(r332177)
@@ -1812,24 +1812,6 @@ tcp_do_segment_fastslow(struct mbuf *m, struct tcphdr 
 		if (TSTMP_GT(to.to_tsecr, tcp_ts_getticks()))
 			to.to_tsecr = 0;
 	}
-	/*
-	 * If timestamps were negotiated during SYN/ACK they should
-	 * appear on every segment during this session and vice versa.
-	 */
-	if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) {
-		if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
-			log(LOG_DEBUG, "%s; %s: Timestamp missing, "
-			    "no action\n", s, __func__);
-			free(s, M_TCPLOG);
-		}
-	}
-	if (!(tp->t_flags & TF_RCVD_TSTMP) && (to.to_flags & TOF_TS)) {
-		if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
-			log(LOG_DEBUG, "%s; %s: Timestamp not expected, "
-			    "no action\n", s, __func__);
-			free(s, M_TCPLOG);
-		}
-	}
 
 	/*
 	 * Process options only when we get SYN/ACK back. The SYN case
@@ -1860,6 +1842,26 @@ tcp_do_segment_fastslow(struct mbuf *m, struct tcphdr 
 		    (to.to_flags & TOF_SACKPERM) == 0)
 			tp->t_flags &= ~TF_SACK_PERMIT;
 	}
+
+	/*
+	 * If timestamps were negotiated during SYN/ACK they should
+	 * appear on every segment during this session and vice versa.
+	 */
+	if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) {
+		if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
+			log(LOG_DEBUG, "%s; %s: Timestamp missing, "
+			    "no action\n", s, __func__);
+			free(s, M_TCPLOG);
+		}
+	}
+	if (!(tp->t_flags & TF_RCVD_TSTMP) && (to.to_flags & TOF_TS)) {
+		if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
+			log(LOG_DEBUG, "%s; %s: Timestamp not expected, "
+			    "no action\n", s, __func__);
+			free(s, M_TCPLOG);
+		}
+	}
+
 	can_enter = 0;
 	if (__predict_true((tlen == 0))) {
 		/*
@@ -2284,24 +2286,6 @@ tcp_do_segment_fastack(struct mbuf *m, struct tcphdr *
 		if (TSTMP_GT(to.to_tsecr, tcp_ts_getticks()))
 			to.to_tsecr = 0;
 	}
-	/*
-	 * If timestamps were negotiated during SYN/ACK they should
-	 * appear on every segment during this session and vice versa.
-	 */
-	if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) {
-		if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
-			log(LOG_DEBUG, "%s; %s: Timestamp missing, "
-			    "no action\n", s, __func__);
-			free(s, M_TCPLOG);
-		}
-	}
-	if (!(tp->t_flags & TF_RCVD_TSTMP) && (to.to_flags & TOF_TS)) {
-		if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
-			log(LOG_DEBUG, "%s; %s: Timestamp not expected, "
-			    "no action\n", s, __func__);
-			free(s, M_TCPLOG);
-		}
-	}
 
 	/*
 	 * Process options only when we get SYN/ACK back. The SYN case
@@ -2332,6 +2316,26 @@ tcp_do_segment_fastack(struct mbuf *m, struct tcphdr *
 		    (to.to_flags & TOF_SACKPERM) == 0)
 			tp->t_flags &= ~TF_SACK_PERMIT;
 	}
+
+	/*
+	 * If timestamps were negotiated during SYN/ACK they should
+	 * appear on every segment during this session and vice versa.
+	 */
+	if ((tp->t_flags & TF_RCVD_TSTMP) && !(to.to_flags & TOF_TS)) {
+		if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
+			log(LOG_DEBUG, "%s; %s: Timestamp missing, "
+			    "no action\n", s, __func__);
+			free(s, M_TCPLOG);
+		}
+	}
+	if (!(tp->t_flags & TF_RCVD_TSTMP) && (to.to_flags & TOF_TS)) {
+		if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
+			log(LOG_DEBUG, "%s; %s: Timestamp not expected, "
+			    "no action\n", s, __func__);
+			free(s, M_TCPLOG);
+		}
+	}
+
 	/*
 	 * Header prediction: check for the two common cases
 	 * of a uni-directional data xfer.  If the packet has


More information about the svn-src-all mailing list