NetBSD-Bugs archive

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

kern/44254: sysctl -w net.inet.tcp.timestamps=0 does not work



>Number:         44254
>Category:       kern
>Synopsis:       sysctl -w net.inet.tcp.timestamps=0 does not work
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 20 07:35:00 +0000 2010
>Originator:     yasuoka%iij.ad.jp@localhost
>Release:        NetBSD 5.1
>Organization:
Internet Initiative Japan Inc.
>Environment:
System: NetBSD yasuoka-nb2 5.1 NetBSD 5.1 (GENERIC) #0: Sun Nov 7 14:39:56 UTC 
2010 
builds%b6.netbsd.org@localhost:/home/builds/ab/netbsd-5-1-RELEASE/i386/201011061943Z-obj/home/builds/ab/netbsd-5-1-RELEASE/src/sys/arch/i386/compile/GENERIC
 i386
Architecture: i386
Machine: i386
>Description:
        "sysctl -w net.inet.tcp.timestamps=0" does not disable TCP
        timestamp option.
>How-To-Repeat:
        1. sysctl -w net.inet.tcp.timestamps=0
        2. tcpdump -vni lo0 port 22 &&
        3. telnet 127.0.0.1 22
        Captured packets will be using tcp timestamp option.
>Fix:
Index: tcp_usrreq.c
===================================================================
RCS file: /cvsroot/NetBSD/src/sys/netinet/tcp_usrreq.c,v
retrieving revision 1.149.4.2
diff -u -p -r1.149.4.2 tcp_usrreq.c
--- tcp_usrreq.c        26 Sep 2009 18:34:29 -0000      1.149.4.2
+++ tcp_usrreq.c        20 Dec 2010 06:18:58 -0000
@@ -1038,6 +1038,7 @@ sysctl_net_inet_tcp_mssdflt(SYSCTLFN_ARG
        if (mssdflt < 32)
                return (EINVAL);
        tcp_mssdflt = mssdflt;
+       tcp_tcpcb_template();           /* update the template */
 
        return (0);
 }
@@ -1634,6 +1635,20 @@ sysctl_net_inet_tcp_stats(SYSCTLFN_ARGS)
        return (NETSTAT_SYSCTL(tcpstat_percpu, TCP_NSTATS));
 }
 
+static int
+sysctl_update_tcpcb_template(SYSCTLFN_ARGS)
+{
+       int error;
+
+       error = sysctl_lookup(SYSCTLFN_CALL(rnode));
+       if (error || newp == NULL)
+               return (error);
+
+       tcp_tcpcb_template();           /* update the template */
+
+       return (0);
+}
+
 /*
  * this (second stage) setup routine is a replacement for tcp_sysctl()
  * (which is currently used for ipv4 and ipv6)
@@ -1672,7 +1687,7 @@ sysctl_net_inet_tcp_setup2(struct sysctl
                       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,
@@ -1772,13 +1787,13 @@ sysctl_net_inet_tcp_setup2(struct sysctl
                       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