PERFORCE change 195374 for review

Catalin Nicutar cnicutar at FreeBSD.org
Sun Jun 26 15:59:48 UTC 2011


http://p4web.freebsd.org/@@195374?ac=10

Change 195374 by cnicutar at cnicutar_cronos on 2011/06/26 15:59:08

	Limit the value of the received user timeout according to min_timeout
	and max_timeout.

Affected files ...

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

Differences ...

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

@@ -1091,9 +1091,13 @@
 		tcp_dooptions(&to, optp, optlen, TO_SYN);
 
 		if (to.to_flags & TOF_UTO) {
-			if (tp->t_flags & TF_RCV_UTO)
+			if (tp->t_flags & TF_RCV_UTO) {
 				tp->rcv_uto = (to.to_uto & 0x8000) ?
 				    (to.to_uto & 0x7FFF) * 60 : to.to_uto;
+				/* silently make it fit between min-max */
+				tp->rcv_uto = min(V_uto_max_timeout,
+				    max(V_uto_min_timeout, tp->rcv_uto));
+			}
 
 			/*
 			 * XXX-CN Using option both for send and receive.
@@ -1285,9 +1289,13 @@
 	    (thflags & TH_SYN) ? TO_SYN : 0);
 
 	/* Processing received UTO. */
-	if ((to.to_flags & TOF_UTO) && (tp->t_flags & TF_RCV_UTO))
+	if ((to.to_flags & TOF_UTO) && (tp->t_flags & TF_RCV_UTO)) {
+		/* convert to seconds if granularity is set */
 		tp->rcv_uto = (to.to_uto & 0x8000) ?
 		    (to.to_uto & 0x7FFF) * 60 : to.to_uto;
+		tp->rcv_uto = min(V_uto_max_timeout,
+		    max(V_uto_min_timeout, tp->rcv_uto));
+	}
 
 	/*
 	 * If echoed timestamp is later than the current time,


More information about the p4-projects mailing list