PERFORCE change 197905 for review

Catalin Nicutar cnicutar at FreeBSD.org
Sat Aug 20 09:41:33 UTC 2011


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

Change 197905 by cnicutar at cnicutar_cronos on 2011/08/20 09:40:36

	Take uto_enable into account when handling connections.

Affected files ...

.. //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_input.c#4 edit
.. //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_usrreq.c#4 edit
.. //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_var.h#7 edit

Differences ...

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

@@ -3196,8 +3196,6 @@
 		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));

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

@@ -1330,7 +1330,8 @@
 				return (error);
 
 			INP_WLOCK_RECHECK(inp);
-			if (optval == 0) {
+			/* Silently turn it off if !V_uto_enable. */
+			if (!V_uto_enable || optval <= 0) {
 				/* Disable sending the option. */
 				tp->t_flags &= ~TF_SND_UTO;
 				tp->snd_uto = 0;
@@ -1353,16 +1354,18 @@
 				return (error);
 
 			INP_WLOCK_RECHECK(inp);
-			if (optval <= 0)
+			if (!V_uto_enable || optval <= 0)
 				/* This connection will ignore suggestions. */
 				tp->t_flags &= ~TF_RCV_UTO;
 			else {
 				tp->t_flags |= TF_RCV_UTO;
 				/*
 				 * If optval > 1, we'll use it as the max
-				 * acceptable suggestion.
+				 * acceptable suggestion (or silently truncate
+				 * it to V_uto_max_timeout).
 				 */
-				tp->max_uto = (optval > 1) ?
+				tp->max_uto = (optval > 1 &&
+				    optval < V_uto_max_timeout) ?
 				    optval : V_uto_max_timeout;
 			}
 			INP_WUNLOCK(inp);

==== //depot/projects/soc2011/cnicutar_tcputo_9/src/sys/netinet/tcp_var.h#7 (text+ko) ====

@@ -262,8 +262,8 @@
 
 #define	BYTES_THIS_ACK(tp, th)	(th->th_ack - tp->snd_una)
 
-#define USING_UTO(tp)	(tp)->snd_uto ||		\
-    (((tp)->t_flags & TF_RCV_UTO) && (tp)->rcv_uto)
+#define USING_UTO(tp) V_uto_enable && ((tp)->snd_uto ||	\
+    (((tp)->t_flags & TF_RCV_UTO) && (tp)->rcv_uto))
 
 #define UTO_VALUE(to)	((to).to_uto & UTO_MINS) ?	\
     ((to).to_uto & ~(UTO_MINS)) * 60 : (to).to_uto


More information about the p4-projects mailing list