PERFORCE change 195384 for review

Catalin Nicutar cnicutar at FreeBSD.org
Sun Jun 26 20:25:16 UTC 2011


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

Change 195384 by cnicutar at cnicutar_cronos on 2011/06/26 20:25:08

	Change granularity handling for TCP UTO.
	
	Changing the fields in tcpcb will prove uncomfortable later. It's best to
	let tcp_addoptions handle it when sending the actual segment.

Affected files ...

.. //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_output.c#4 edit
.. //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_usrreq.c#4 edit
.. //depot/projects/soc2011/cnicutar_tcputo_8/src/sys/netinet/tcp_var.h#4 edit

Differences ...

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

@@ -1474,9 +1474,27 @@
 			*optp++ = TCPOPT_UTO;
 			*optp++ = TCPOLEN_UTO;
 
-			to->to_uto = htons(to->to_uto);
-			bcopy((u_char *)&to->to_uto, optp, sizeof(to->to_uto));
-			optp += sizeof(to->to_uto);
+			if (to->to_uto > 3600) {
+				/*
+			 	* If the timeout is larger than 3600
+				* we'll specify minutes.
+				* XXX-CN 3600 is arbitrary.
+			 	*/
+				to->to_uto /= 60;
+				to->to_uto |= 0x8000;
+			}
+			
+			/*
+			 * XXX-CN to_uto is 32b because the user is allowed
+			 * to specify more than 16b of seconds (dividing the
+			 * value by 60 will make it fit).
+			 */
+			{
+				uint16_t uto = to->to_uto;
+				uto = htons(uto);
+				bcopy((u_char *)&uto, optp, sizeof(uto));
+				optp += sizeof(uto);
+			}
 			break;
 		default:
 			panic("%s: unknown TCP option type", __func__);

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

@@ -1312,15 +1312,6 @@
 			    optval <= V_uto_max_timeout) {
 				/* The timeout is acceptable. */
 				tp->snd_uto = optval;
-				if (tp->snd_uto > 3600) {
-					/*
-				 	* If the timeout is larger than 3600
-					* we'll specify minutes.
-					* XXX-CN 3600 is arbitrary.
-				 	*/
-					tp->snd_uto /= 60;
-					tp->snd_uto |= 0x8000;
-				}
 				tp->t_flags |= TF_SND_UTO;
 			} else
 				error = EINVAL;

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

@@ -291,7 +291,7 @@
 	u_int16_t	to_mss;		/* maximum segment size */
 	u_int8_t	to_wscale;	/* window scaling */
 	u_int8_t	to_nsacks;	/* number of SACK blocks */
-	u_int16_t	to_uto;		/* sent user timeout */
+	u_int32_t	to_uto;		/* sent user timeout */
 };
 
 /*


More information about the p4-projects mailing list