Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet Make tcp msl (max segment life) tunable via sysc...



details:   https://anonhg.NetBSD.org/src/rev/e010c38da0c9
branches:  trunk
changeset: 747311:e010c38da0c9
user:      darran <darran%NetBSD.org@localhost>
date:      Wed Sep 09 22:41:28 2009 +0000

description:
Make tcp msl (max segment life) tunable via sysctl net.inet.tcp.msl.
Okayed by tls@.

diffstat:

 sys/netinet/tcp_input.c  |  14 ++++++++------
 sys/netinet/tcp_usrreq.c |  10 ++++++++--
 sys/netinet/tcp_var.h    |   7 +++++--
 3 files changed, 21 insertions(+), 10 deletions(-)

diffs (129 lines):

diff -r 724d2fc61bcf -r e010c38da0c9 sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c   Wed Sep 09 22:38:49 2009 +0000
+++ b/sys/netinet/tcp_input.c   Wed Sep 09 22:41:28 2009 +0000
@@ -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;
                }
        }
diff -r 724d2fc61bcf -r e010c38da0c9 sys/netinet/tcp_usrreq.c
--- a/sys/netinet/tcp_usrreq.c  Wed Sep 09 22:38:49 2009 +0000
+++ b/sys/netinet/tcp_usrreq.c  Wed Sep 09 22:41:28 2009 +0000
@@ -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"),
diff -r 724d2fc61bcf -r e010c38da0c9 sys/netinet/tcp_var.h
--- a/sys/netinet/tcp_var.h     Wed Sep 09 22:38:49 2009 +0000
+++ b/sys/netinet/tcp_var.h     Wed Sep 09 22:41:28 2009 +0000
@@ -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 */



Home | Main Index | Thread Index | Old Index