Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet Update TCP CB with new values on rfc1323 and mss...



details:   https://anonhg.NetBSD.org/src/rev/ef6b4ae72b7d
branches:  trunk
changeset: 325056:ef6b4ae72b7d
user:      kefren <kefren%NetBSD.org@localhost>
date:      Mon Dec 02 09:39:54 2013 +0000

description:
Update TCP CB with new values on rfc1323 and mssdflt sysctl updates
>From yasuoka%iij.ad.jp@localhost in kern/44254

diffstat:

 sys/netinet/tcp_usrreq.c |  43 ++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 38 insertions(+), 5 deletions(-)

diffs (87 lines):

diff -r 03c8277a4128 -r ef6b4ae72b7d sys/netinet/tcp_usrreq.c
--- a/sys/netinet/tcp_usrreq.c  Mon Dec 02 06:07:22 2013 +0000
+++ b/sys/netinet/tcp_usrreq.c  Mon Dec 02 09:39:54 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_usrreq.c,v 1.169 2013/11/23 14:20:21 christos Exp $        */
+/*     $NetBSD: tcp_usrreq.c,v 1.170 2013/12/02 09:39:54 kefren 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.169 2013/11/23 14:20:21 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.170 2013/12/02 09:39:54 kefren Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -1044,10 +1044,43 @@
                return (EINVAL);
        tcp_mssdflt = mssdflt;
 
+       mutex_enter(softnet_lock);
+       tcp_tcpcb_template();
+       mutex_exit(softnet_lock);
+
        return (0);
 }
 
 /*
+ * sysctl helper for TCP CB template update
+ */
+static int
+sysctl_update_tcpcb_template(SYSCTLFN_ARGS)
+{
+       int t, error;
+       struct sysctlnode node;
+
+       /* follow procedures in sysctl(9) manpage */
+       t = *(int *)rnode->sysctl_data;
+       node = *rnode;
+       node.sysctl_data = &t;
+       error = sysctl_lookup(SYSCTLFN_CALL(&node));
+       if (error || newp == NULL)
+               return error;
+
+       if (t < 0)
+               return EINVAL;
+
+       *(int *)rnode->sysctl_data = t;
+
+       mutex_enter(softnet_lock);
+       tcp_tcpcb_template();
+       mutex_exit(softnet_lock);
+
+       return 0;
+}
+
+/*
  * sysctl helper routine for setting port related values under
  * net.inet.ip and net.inet6.ip6.  does basic range checking and does
  * additional checks for each type.  this code has placed in
@@ -1686,7 +1719,7 @@
                       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
                       CTLTYPE_INT, "rfc1323",
                       SYSCTL_DESCR("Enable RFC1323 TCP extensions"),
-                      NULL, 0, &tcp_do_rfc1323, 0,
+                      sysctl_update_tcpcb_template, 0, &tcp_do_rfc1323, 0,
                       CTL_NET, pf, IPPROTO_TCP, TCPCTL_RFC1323, CTL_EOL);
        sysctl_createv(clog, 0, NULL, NULL,
                       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
@@ -1786,13 +1819,13 @@
                       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
                       CTLTYPE_INT, "win_scale",
                       SYSCTL_DESCR("Use RFC1323 window scale options"),
-                      NULL, 0, &tcp_do_win_scale, 0,
+                      sysctl_update_tcpcb_template, 0, &tcp_do_win_scale, 0,
                       CTL_NET, pf, IPPROTO_TCP, TCPCTL_WSCALE, CTL_EOL);
        sysctl_createv(clog, 0, NULL, NULL,
                       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
                       CTLTYPE_INT, "timestamps",
                       SYSCTL_DESCR("Use RFC1323 time stamp options"),
-                      NULL, 0, &tcp_do_timestamps, 0,
+                      sysctl_update_tcpcb_template, 0, &tcp_do_timestamps, 0,
                       CTL_NET, pf, IPPROTO_TCP, TCPCTL_TSTAMP, CTL_EOL);
        sysctl_createv(clog, 0, NULL, NULL,
                       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,



Home | Main Index | Thread Index | Old Index