Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Oct 2011 20:02:18 GMT
From:      Catalin Nicutar <cnicutar@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 200208 for review
Message-ID:  <201110142002.p9EK2IZv031291@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@200208?ac=10

Change 200208 by cnicutar@cnicutar_cronos on 2011/10/14 20:02:16

	Fix segment bumping introduced in 198632. (UTO sometimes caused a
	segment to be spilled by TCPOLEN_UTO bytes which meant splitting).
	
	Simplify TF_SND_UTO handling - set it from the retransmit handler.

Affected files ...

.. //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_output.c#5 edit
.. //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_timer.c#5 edit

Differences ...

==== //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_output.c#5 (text+ko) ====

@@ -709,10 +709,12 @@
 		 * UTO. The option is sent with the SYN and with the first
 		 * non-SYN segment.
 		 */
-		if (tp->t_flags & TF_SND_UTO && (flags & TH_SYN ||
-		    FIRST_NON_SYN(tp))) {
+		if (tp->t_flags & TF_SND_UTO) {
 			to.to_uto = tp->snd_uto;
 			to.to_flags |= TOF_UTO;
+
+			if (!(flags & TH_SYN))
+				tp->t_flags &= ~TF_SND_UTO;
 		}
 #ifdef TCP_SIGNATURE
 		/* TCP-MD5 (RFC2385). */
@@ -747,6 +749,16 @@
 	if (len + optlen + ipoptlen > tp->t_maxopd) {
 		flags &= ~TH_FIN;
 
+		/*
+		 * When doing a retransmission that includes UTO, the extra
+		 * TCPOLEN_UTO (4) bytes might cause the segment to spill.
+		 */
+		if (to.to_flags & TOF_UTO && len + optlen + ipoptlen -
+		    TCPOLEN_UTO <= tp->t_maxopd) {
+			len -= TCPOLEN_UTO;
+			goto lenfixed;
+		}
+
 		if (tso) {
 			KASSERT(ipoptlen == 0,
 			    ("%s: TSO can't do IP options", __func__));
@@ -787,6 +799,7 @@
 		}
 	} else
 		tso = 0;
+lenfixed:
 
 	KASSERT(len + hdrlen + ipoptlen <= IP_MAXPACKET,
 	    ("%s: len > IP_MAXPACKET", __func__));

==== //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_timer.c#5 (text+ko) ====

@@ -618,6 +618,11 @@
 	}
 	tp->snd_nxt = tp->snd_una;
 	tp->snd_recover = tp->snd_max;
+	
+	/* Check if we need to push UTO. */
+	if (tp->snd_uto && FIRST_NON_SYN(tp))
+		tp->t_flags |= TF_SND_UTO;
+
 	/*
 	 * Force a segment to be sent.
 	 */



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