Subject: kern/813: RFC1323 options are not configurable
To: None <gnats-admin@NetBSD.ORG>
From: John Kohl <jtk@kolvir.blrc.ma.us>
List: netbsd-bugs
Date: 02/21/1995 19:50:10
>Number:         813
>Category:       kern
>Synopsis:       RFC1323 options are not configurable
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 21 19:50:09 1995
>Originator:     John Kohl
>Organization:
NetBSD Kernel Hackers `R` Us
>Release:        -current, 2/19/1995
>Environment:
	
System: NetBSD kolvir 1.0A NetBSD 1.0A (KOLVIR) #91: Tue Feb 21 19:40:15 EST 1995 jtk@kolvir:/u1/NetBSD-current/src/sys/arch/i386/compile/KOLVIR i386


>Description:
The kernel variable tcp_do_rfc1323 is not configurable.  It should be.
>How-To-Repeat:
Try to change it on the fly with sysctl(8).  You can't.
>Fix:

The kernel diff is relative to -current.  The sysctl(8) diffs are
relative to 1.0.

===================================================================
RCS file: sys/netinet/RCS/in_proto.c,v
retrieving revision 1.1
diff -ubw -r1.1 sys/netinet/in_proto.c
--- 1.1	1995/02/22 00:33:28
+++ sys/netinet/in_proto.c	1995/02/22 00:36:54
@@ -94,7 +94,7 @@
 { SOCK_STREAM,	&inetdomain,	IPPROTO_TCP,	PR_CONNREQUIRED|PR_WANTRCVD,
   tcp_input,	0,		tcp_ctlinput,	tcp_ctloutput,
   tcp_usrreq,
-  tcp_init,	tcp_fasttimo,	tcp_slowtimo,	tcp_drain,
+  tcp_init,	tcp_fasttimo,	tcp_slowtimo,	tcp_drain,	tcp_sysctl
 },
 { SOCK_RAW,	&inetdomain,	IPPROTO_RAW,	PR_ATOMIC|PR_ADDR,
   rip_input,	rip_output,	0,		rip_ctloutput,
===================================================================
RCS file: sys/netinet/RCS/tcp_usrreq.c,v
retrieving revision 1.1
diff -ubw -r1.1 sys/netinet/tcp_usrreq.c
--- 1.1	1995/02/22 00:34:34
+++ sys/netinet/tcp_usrreq.c	1995/02/22 00:38:38
@@ -523,3 +523,28 @@
 		soisdisconnected(tp->t_inpcb->inp_socket);
 	return (tp);
 }
+
+/*
+ * Sysctl for tcp variables.
+ */
+tcp_sysctl(name, namelen, oldp, oldlenp, newp, newlen)
+	int *name;
+	u_int namelen;
+	void *oldp;
+	size_t *oldlenp;
+	void *newp;
+	size_t newlen;
+{
+	/* All sysctl names at this level are terminal. */
+	if (namelen != 1)
+		return (ENOTDIR);
+
+	switch (name[0]) {
+	case TCPCTL_RFC1323:
+		return (sysctl_int(oldp, oldlenp, newp, newlen,
+				   &tcp_do_rfc1323));
+	default:
+		return (ENOPROTOOPT);
+	}
+	/* NOTREACHED */
+}
===================================================================
RCS file: sys/netinet/RCS/tcp_var.h,v
retrieving revision 1.1
diff -ubw -r1.1 sys/netinet/tcp_var.h
--- 1.1	1995/02/22 00:36:00
+++ sys/netinet/tcp_var.h	1995/02/22 00:38:36
@@ -233,10 +233,22 @@
 	u_long	tcps_pcbcachemiss;
 };
 
+/*
+ * Names for TCP sysctl objects
+ */
+#define	TCPCTL_RFC1323		1	/* enable RFC1323 timestamps/scaling */
+#define TCPCTL_MAXID		2
+
+#define TCPCTL_NAMES { \
+	{ 0, 0 }, \
+	{ "rfc1323", CTLTYPE_INT }, \
+}
+
 #ifdef KERNEL
 struct	inpcb tcb;		/* head of queue of active tcpcb's */
 struct	tcpstat tcpstat;	/* tcp statistics */
 u_long	tcp_now;		/* for RFC 1323 timestamps */
+extern	int tcp_do_rfc1323;	/* enabled/disabled? */
 
 int	 tcp_attach __P((struct socket *));
 void	 tcp_canceltimers __P((struct tcpcb *));
@@ -274,6 +286,7 @@
 void	 tcp_trace __P((int, int, struct tcpcb *, struct tcpiphdr *, int));
 struct tcpcb *
 	 tcp_usrclosed __P((struct tcpcb *));
+int	 tcp_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
 int	 tcp_usrreq __P((struct socket *,
 	    int, struct mbuf *, struct mbuf *, struct mbuf *));
 void	 tcp_xmit_timer __P((struct tcpcb *, int));
===================================================================
RCS file: usr.sbin/sysctl/RCS/sysctl.8,v
retrieving revision 1.1
diff -ubw -r1.1 usr.sbin/sysctl/sysctl.8
--- 1.1	1995/02/22 01:52:39
+++ usr.sbin/sysctl/sysctl.8	1995/02/22 01:53:08
@@ -133,6 +133,7 @@
 .It net.inet.ip.ttl	integer	yes
 .It net.inet.icmp.maskrepl	integer	yes
 .It net.inet.udp.checksum	integer	yes
+.It net.inet.tcp.rfc1323	integer	yes
 .It hw.machine	string	no
 .It hw.model	string	no
 .It hw.ncpu	integer	no
===================================================================
RCS file: usr.sbin/sysctl/RCS/sysctl.c,v
retrieving revision 1.1
diff -ubw -r1.1 usr.sbin/sysctl/sysctl.c
--- 1.1	1995/02/22 01:47:39
+++ usr.sbin/sysctl/sysctl.c	1995/02/22 01:52:31
@@ -39,7 +39,7 @@
 
 #ifndef lint
 /* from: static char sccsid[] = "@(#)sysctl.c	8.1 (Berkeley) 6/6/93"; */
-static char *rcsid = "$Id: sysctl.c,v 1.1 1995/02/22 01:47:39 jtk Exp $";
+static char *rcsid = "$Id: sysctl.c,v 1.2 1995/02/22 01:52:30 jtk Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -58,6 +58,9 @@
 #include <netinet/ip_var.h>
 #include <netinet/udp.h>
 #include <netinet/udp_var.h>
+#include <netinet/tcp.h>
+#include <netinet/tcp_timer.h>
+#include <netinet/tcp_var.h>
 
 #include <errno.h>
 #include <stdio.h>
@@ -473,6 +476,7 @@
 struct ctlname ipname[] = IPCTL_NAMES;
 struct ctlname icmpname[] = ICMPCTL_NAMES;
 struct ctlname udpname[] = UDPCTL_NAMES;
+struct ctlname tcpname[] = TCPCTL_NAMES;
 struct list inetlist = { inetname, IPPROTO_MAXID };
 struct list inetvars[] = {
 	{ ipname, IPCTL_MAXID },	/* ip */
@@ -481,7 +485,7 @@
 	{ 0, 0 },			/* ggmp */
 	{ 0, 0 },
 	{ 0, 0 },
-	{ 0, 0 },			/* tcp */
+	{ tcpname, TCPCTL_MAXID },			/* tcp */
 	{ 0, 0 },
 	{ 0, 0 },			/* egp */
 	{ 0, 0 },
>Audit-Trail:
>Unformatted: