svn commit: r252794 - stable/9/sys/netinet

Andre Oppermann andre at FreeBSD.org
Fri Jul 5 15:57:36 UTC 2013


Author: andre
Date: Fri Jul  5 15:57:36 2013
New Revision: 252794
URL: http://svnweb.freebsd.org/changeset/base/252794

Log:
  MFC r242257:
  
   Remove bogus 'else' in #ifdef that prevented the rttvar from being reset
   tcp_timer_rexmt() on retransmit for IPv6 sessions.
  
  MFC r242260:
  
   When retransmitting SYN in TCPS_SYN_SENT state use TCPTV_RTOBASE,
   the default retransmit timeout, as base to calculate the backoff
   time until next try instead of the TCP_REXMTVAL() macro which only
   works correctly when we already have measured an actual RTT+RTTVAR.
  
  MFC r242263, r242264:
  
   Add SACK_PERMIT to the list of TCP options that are switched off after
   retransmitting a SYN three times.
  
  MFC r242267:
  
   If the user has closed the socket then drop a persisting connection
   after a much reduced timeout.
  
   Typically web servers close their sockets quickly under the assumption
   that the TCP connections goes away as well.  That is not entirely true
   however.  If the peer closed the window we're going to wait for a long
   time with lots of data in the send buffer.

Modified:
  stable/9/sys/netinet/tcp_timer.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/netinet/tcp_timer.c
==============================================================================
--- stable/9/sys/netinet/tcp_timer.c	Fri Jul  5 15:47:59 2013	(r252793)
+++ stable/9/sys/netinet/tcp_timer.c	Fri Jul  5 15:57:36 2013	(r252794)
@@ -453,6 +453,16 @@ tcp_timer_persist(void *xtp)
 		tp = tcp_drop(tp, ETIMEDOUT);
 		goto out;
 	}
+	/*
+	 * If the user has closed the socket then drop a persisting
+	 * connection after a much reduced timeout.
+	 */
+	if (tp->t_state > TCPS_CLOSE_WAIT &&
+	    (ticks - tp->t_rcvtime) >= TCPTV_PERSMAX) {
+		TCPSTAT_INC(tcps_persistdrop);
+		tp = tcp_drop(tp, ETIMEDOUT);
+		goto out;
+	}
 	tcp_setpersist(tp);
 	tp->t_flags |= TF_FORCEDATA;
 	(void) tcp_output(tp);
@@ -578,13 +588,13 @@ tcp_timer_rexmt(void * xtp)
 		tp->t_flags &= ~TF_PREVVALID;
 	TCPSTAT_INC(tcps_rexmttimeo);
 	if (tp->t_state == TCPS_SYN_SENT)
-		rexmt = TCP_REXMTVAL(tp) * tcp_syn_backoff[tp->t_rxtshift];
+		rexmt = TCPTV_RTOBASE * tcp_syn_backoff[tp->t_rxtshift];
 	else
 		rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift];
 	TCPT_RANGESET(tp->t_rxtcur, rexmt,
 		      tp->t_rttmin, TCPTV_REXMTMAX);
 	/*
-	 * Disable rfc1323 if we haven't got any response to
+	 * Disable RFC1323 and SACK if we haven't got any response to
 	 * our third SYN to work-around some broken terminal servers
 	 * (most of which have hopefully been retired) that have bad VJ
 	 * header compression code which trashes TCP segments containing
@@ -592,7 +602,7 @@ tcp_timer_rexmt(void * xtp)
 	 */
 	if (tcp_rexmit_drop_options && (tp->t_state == TCPS_SYN_SENT) &&
 	    (tp->t_rxtshift == 3))
-		tp->t_flags &= ~(TF_REQ_SCALE|TF_REQ_TSTMP);
+		tp->t_flags &= ~(TF_REQ_SCALE|TF_REQ_TSTMP|TF_SACK_PERMIT);
 	/*
 	 * If we backed off this far, our srtt estimate is probably bogus.
 	 * Clobber it so we'll take the next rtt measurement as our srtt;
@@ -603,7 +613,6 @@ tcp_timer_rexmt(void * xtp)
 #ifdef INET6
 		if ((tp->t_inpcb->inp_vflag & INP_IPV6) != 0)
 			in6_losing(tp->t_inpcb);
-		else
 #endif
 		tp->t_rttvar += (tp->t_srtt >> TCP_RTT_SHIFT);
 		tp->t_srtt = 0;


More information about the svn-src-stable-9 mailing list