Module Name:    src
Committed By:   darran
Date:           Wed Sep  9 22:41:28 UTC 2009

Modified Files:
        src/sys/netinet: tcp_input.c tcp_usrreq.c tcp_var.h

Log Message:
Make tcp msl (max segment life) tunable via sysctl net.inet.tcp.msl.
Okayed by t...@.


To generate a diff of this commit:
cvs rdiff -u -r1.298 -r1.299 src/sys/netinet/tcp_input.c
cvs rdiff -u -r1.155 -r1.156 src/sys/netinet/tcp_usrreq.c
cvs rdiff -u -r1.160 -r1.161 src/sys/netinet/tcp_var.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.298 src/sys/netinet/tcp_input.c:1.299
--- src/sys/netinet/tcp_input.c:1.298	Sat Jul 18 23:09:53 2009
+++ src/sys/netinet/tcp_input.c	Wed Sep  9 22:41:28 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.298 2009/07/18 23:09:53 minskim Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.299 2009/09/09 22:41:28 darran Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -145,7 +145,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.298 2009/07/18 23:09:53 minskim Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.299 2009/09/09 22:41:28 darran Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -242,6 +242,7 @@
 int	tcp_do_autorcvbuf = 0;
 int	tcp_autorcvbuf_inc = 16 * 1024;
 int	tcp_autorcvbuf_max = 256 * 1024;
+int	tcp_msl = (TCPTV_MSL / PR_SLOWHZ);
 
 static int tcp_rst_ppslim_count = 0;
 static struct timeval tcp_rst_ppslim_last;
@@ -2499,7 +2500,8 @@
 			if (ourfinisacked) {
 				tp->t_state = TCPS_TIME_WAIT;
 				tcp_canceltimers(tp);
-				TCP_TIMER_ARM(tp, TCPT_2MSL, 2 * TCPTV_MSL);
+				TCP_TIMER_ARM(tp, TCPT_2MSL, 
+						2 * PR_SLOWHZ * tcp_msl);
 				soisdisconnected(so);
 			}
 			break;
@@ -2523,7 +2525,7 @@
 		 * it and restart the finack timer.
 		 */
 		case TCPS_TIME_WAIT:
-			TCP_TIMER_ARM(tp, TCPT_2MSL, 2 * TCPTV_MSL);
+			TCP_TIMER_ARM(tp, TCPT_2MSL, 2 * PR_SLOWHZ * tcp_msl);
 			goto dropafterack;
 		}
 	}
@@ -2707,7 +2709,7 @@
 		case TCPS_FIN_WAIT_2:
 			tp->t_state = TCPS_TIME_WAIT;
 			tcp_canceltimers(tp);
-			TCP_TIMER_ARM(tp, TCPT_2MSL, 2 * TCPTV_MSL);
+			TCP_TIMER_ARM(tp, TCPT_2MSL, 2 * PR_SLOWHZ * tcp_msl);
 			soisdisconnected(so);
 			break;
 
@@ -2715,7 +2717,7 @@
 		 * In TIME_WAIT state restart the 2 MSL time_wait timer.
 		 */
 		case TCPS_TIME_WAIT:
-			TCP_TIMER_ARM(tp, TCPT_2MSL, 2 * TCPTV_MSL);
+			TCP_TIMER_ARM(tp, TCPT_2MSL, 2 * PR_SLOWHZ * tcp_msl);
 			break;
 		}
 	}

Index: src/sys/netinet/tcp_usrreq.c
diff -u src/sys/netinet/tcp_usrreq.c:1.155 src/sys/netinet/tcp_usrreq.c:1.156
--- src/sys/netinet/tcp_usrreq.c:1.155	Sun Jun  7 16:20:29 2009
+++ src/sys/netinet/tcp_usrreq.c	Wed Sep  9 22:41:28 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_usrreq.c,v 1.155 2009/06/07 16:20:29 rmind Exp $	*/
+/*	$NetBSD: tcp_usrreq.c,v 1.156 2009/09/09 22:41:28 darran Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -95,7 +95,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.155 2009/06/07 16:20:29 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.156 2009/09/09 22:41:28 darran Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -1689,6 +1689,12 @@
 		       CTL_NET, pf, IPPROTO_TCP, CTL_CREATE, CTL_EOL);
 	sysctl_createv(clog, 0, NULL, NULL,
 		       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+		       CTLTYPE_INT, "msl",
+		       SYSCTL_DESCR("Maximum Segment Life"),
+		       NULL, 0, &tcp_msl, 0,
+		       CTL_NET, pf, IPPROTO_TCP, TCPCTL_MSL, CTL_EOL);
+	sysctl_createv(clog, 0, NULL, NULL,
+		       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
 		       CTLTYPE_INT, "syn_cache_limit",
 		       SYSCTL_DESCR("Maximum number of entries in the TCP "
 				    "compressed state engine"),

Index: src/sys/netinet/tcp_var.h
diff -u src/sys/netinet/tcp_var.h:1.160 src/sys/netinet/tcp_var.h:1.161
--- src/sys/netinet/tcp_var.h:1.160	Wed May 27 17:41:03 2009
+++ src/sys/netinet/tcp_var.h	Wed Sep  9 22:41:28 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_var.h,v 1.160 2009/05/27 17:41:03 pooka Exp $	*/
+/*	$NetBSD: tcp_var.h,v 1.161 2009/09/09 22:41:28 darran Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -686,7 +686,8 @@
 #define	TCPCTL_DEBUG		31	/* TCP debug sockets */
 #define	TCPCTL_DEBX		32	/* # of tcp debug sockets */
 #define	TCPCTL_DROP		33	/* drop tcp connection */
-#define	TCPCTL_MAXID		34
+#define	TCPCTL_MSL		34	/* Max Segment Life */
+#define	TCPCTL_MAXID		35
 
 #define	TCPCTL_NAMES { \
 	{ 0, 0 }, \
@@ -723,6 +724,7 @@
 	{ "debug", CTLTYPE_STRUCT }, \
 	{ "debx", CTLTYPE_INT }, \
 	{ "drop", CTLTYPE_STRUCT }, \
+	{ "msl", CTLTYPE_INT }, \
 }
 
 #ifdef _KERNEL
@@ -734,6 +736,7 @@
 extern	int tcp_do_timestamps;	/* RFC1323 timestamps enabled/disabled? */
 extern	int tcp_mssdflt;	/* default seg size */
 extern	int tcp_minmss;		/* minimal seg size */
+extern  int tcp_msl;		/* max segment life */
 extern	int tcp_init_win;	/* initial window */
 extern	int tcp_init_win_local;	/* initial window for local nets */
 extern	int tcp_mss_ifmtu;	/* take MSS from interface, not in_maxmtu */

Reply via email to