Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Jun 2011 07:23:19 GMT
From:      Catalin Nicutar <cnicutar@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 195083 for review
Message-ID:  <201106210723.p5L7NJBP027120@skunkworks.freebsd.org>

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

Change 195083 by cnicutar@cnicutar_cronos on 2011/06/21 07:23:07

	Record the received UTO for a connection. The value can be retrieved using
	TCP_RCVUTO_TIMEOUT.

Affected files ...

.. //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_input.c#2 edit

Differences ...

==== //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_input.c#2 (text+ko) ====

@@ -1082,12 +1082,26 @@
 		 * SYN appears to be valid.  Create compressed TCP state
 		 * for syncache.
 		 */
+
 #ifdef TCPDEBUG
 		if (so->so_options & SO_DEBUG)
 			tcp_trace(TA_INPUT, ostate, tp,
 			    (void *)tcp_saveipgen, &tcp_savetcp, 0);
 #endif
 		tcp_dooptions(&to, optp, optlen, TO_SYN);
+
+		if (to.to_flags & TOF_UTO) {
+			if (tp->t_flags & TF_RCV_UTO)
+				tp->rcv_uto = (to.to_uto & 0x8000) ?
+				    (to.to_uto & 0x7FFF) * 60 : to.to_uto;
+
+			/*
+			 * XXX-CN Using option both for send and receive.
+			 * Clear it for syncache.
+			 */
+			to.to_flags &= ~TOF_UTO;
+		}
+
 		syncache_add(&inc, &to, th, inp, &so, m);
 		/*
 		 * Entry added to syncache and mbuf consumed.
@@ -1270,6 +1284,11 @@
 	    (th->th_off << 2) - sizeof(struct tcphdr),
 	    (thflags & TH_SYN) ? TO_SYN : 0);
 
+	/* Processing received UTO. */
+	if ((to.to_flags & TOF_UTO) && (tp->t_flags & TF_RCV_UTO))
+		tp->rcv_uto = (to.to_uto & 0x8000) ?
+		    (to.to_uto & 0x7FFF) * 60 : to.to_uto;
+
 	/*
 	 * If echoed timestamp is later than the current time,
 	 * fall back to non RFC1323 RTT calculation.  Normalize
@@ -3029,6 +3048,17 @@
 			to->to_sacks = cp + 2;
 			TCPSTAT_INC(tcps_sack_rcv_blocks);
 			break;
+		case TCPOPT_UTO:
+			if (optlen != TCPOLEN_UTO)
+				continue;
+			if (!V_uto_enable)
+				continue;
+			to->to_flags |= TOF_UTO;
+			bcopy((char *)cp + 2,
+			    (char *)&to->to_uto, sizeof(to->to_uto));
+			to->to_uto = htons(to->to_uto);
+			/* Avoid converting to seconds: it might overflow. */
+			break;
 		default:
 			continue;
 		}



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