Re: /proc/sys/net patch

Mike Shaver (shaver@neon.ingenia.com)
Tue, 2 Apr 1996 13:59:59 -0500 (EST)


Thus spake Miguel de Icaza:
> > This patch adds /proc/sys/net, and subdirectories based on your
> > configuration. Nothing terribly complex, but I wanted to get some
> > feedback before I invested too much effort in the format.
> >
> > Comments welcome...
>
> I think you forgot to send the patch :-).

I think so too. =)

Mike

diff -u --recursive --new-file linux-1.3.81/include/linux/sysctl.h linux/include/linux/sysctl.h
--- linux-1.3.81/include/linux/sysctl.h Sun Mar 10 03:06:09 1996
+++ linux/include/linux/sysctl.h Mon Apr 1 18:41:11 1996
@@ -69,6 +69,33 @@

/* CTL_NET names: */

+/* /proc/sys/net/core */
+#define NET_CORE 0x01000000
+
+/* /proc/sys/net/ethernet */
+#define NET_ETHER 0x02000000
+
+/* /proc/sys/net/802 */
+#define NET_802 0x03000000
+
+/* /proc/sys/net/unix */
+#define NET_UNIX 0x04000000
+
+/* /proc/sys/net/ipv4 */
+#define NET_IPV4 0x05000000
+
+/* /proc/sys/net/ipx */
+#define NET_IPX 0x06000000
+
+/* /proc/sys/net/appletalk */
+#define NET_ATALK 0x07000000
+
+/* /proc/sys/net/netrom */
+#define NET_NETROM 0x08000000
+
+/* /proc/sys/net/ax25 */
+#define NET_AX25 0x09000000
+
/* CTL_PROC names: */

/* CTL_FS names: */
diff -u --recursive --new-file linux-1.3.81/kernel/sysctl.c linux/kernel/sysctl.c
--- linux-1.3.81/kernel/sysctl.c Fri Mar 15 03:21:12 1996
+++ linux/kernel/sysctl.c Mon Apr 1 15:51:42 1996
@@ -4,6 +4,7 @@
* Begun 24 March 1995, Stephen Tweedie
* Added /proc support, Dec 1995
* Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
+ * Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
*/

#include <linux/config.h>
@@ -38,6 +39,7 @@

static ctl_table kern_table[];
static ctl_table vm_table[];
+extern ctl_table net_table[];

/* /proc declarations: */

@@ -100,6 +102,7 @@
static ctl_table root_table[] = {
{CTL_KERN, "kernel", NULL, 0, 0555, kern_table},
{CTL_VM, "vm", NULL, 0, 0555, vm_table},
+ {CTL_NET, "net", NULL, 0, 0555, net_table},
{0}
};

diff -u --recursive --new-file linux-1.3.81/net/802/Makefile linux/net/802/Makefile
--- linux-1.3.81/net/802/Makefile Sat Mar 30 06:20:33 1996
+++ linux/net/802/Makefile Mon Apr 1 16:52:16 1996
@@ -8,7 +8,7 @@
# Note 2! The CFLAGS definition is now in the main makefile...

O_TARGET := 802.o
-O_OBJS = p8023.o
+O_OBJS = p8023.o sysctl_net_802.o

ifdef CONFIG_TR
O_OBJS += tr.o
diff -u --recursive --new-file linux-1.3.81/net/802/sysctl_net_802.c linux/net/802/sysctl_net_802.c
--- linux-1.3.81/net/802/sysctl_net_802.c Wed Dec 31 19:00:00 1969
+++ linux/net/802/sysctl_net_802.c Mon Apr 1 18:28:31 1996
@@ -0,0 +1,14 @@
+/* -*- linux-c -*-
+ * sysctl_net_802.c: sysctl interface to net 802 subsystem.
+ *
+ * Begun April 1, 1996, Mike Shaver.
+ * Added /proc/sys/net/802 directory entry (empty =) ). [MS]
+ */
+
+#include <linux/config.h>
+#include <linux/mm.h>
+#include <linux/sysctl.h>
+
+ctl_table e802_table[] = {
+ {0}
+};
diff -u --recursive --new-file linux-1.3.81/net/Makefile linux/net/Makefile
--- linux-1.3.81/net/Makefile Mon Mar 25 01:58:23 1996
+++ linux/net/Makefile Mon Apr 1 16:28:12 1996
@@ -41,7 +41,7 @@
endif

L_TARGET := network.a
-L_OBJS := socket.o protocols.o $(join $(SUB_DIRS),$(SUB_DIRS:%=/%.o))
+L_OBJS := socket.o protocols.o sysctl_net.o $(join $(SUB_DIRS),$(SUB_DIRS:%=/%.o))
ifeq ($(CONFIG_MODULES),y)
LX_OBJS = netsyms.o
endif
diff -u --recursive --new-file linux-1.3.81/net/appletalk/Makefile linux/net/appletalk/Makefile
--- linux-1.3.81/net/appletalk/Makefile Mon Mar 25 01:58:23 1996
+++ linux/net/appletalk/Makefile Mon Apr 1 16:39:54 1996
@@ -8,7 +8,7 @@
# Note 2! The CFLAGS definition is now in the main makefile...

O_TARGET := appletalk.o
-O_OBJS := aarp.o ddp.o
+O_OBJS := aarp.o ddp.o sysctl_net_atalk.o
M_OBJS := $(O_TARGET)

include $(TOPDIR)/Rules.make
diff -u --recursive --new-file linux-1.3.81/net/appletalk/sysctl_net_atalk.c linux/net/appletalk/sysctl_net_atalk.c
--- linux-1.3.81/net/appletalk/sysctl_net_atalk.c Wed Dec 31 19:00:00 1969
+++ linux/net/appletalk/sysctl_net_atalk.c Mon Apr 1 18:34:09 1996
@@ -0,0 +1,14 @@
+/* -*- linux-c -*-
+ * sysctl_net_atalk.c: sysctl interface to net Appletalk subsystem.
+ *
+ * Begun April 1, 1996, Mike Shaver.
+ * Added /proc/sys/net/atalk directory entry (empty =) ). [MS]
+ */
+
+#include <linux/config.h>
+#include <linux/mm.h>
+#include <linux/sysctl.h>
+
+ctl_table atalk_table[] = {
+ {0}
+};
diff -u --recursive --new-file linux-1.3.81/net/ax25/Makefile linux/net/ax25/Makefile
--- linux-1.3.81/net/ax25/Makefile Wed Aug 16 06:03:17 1995
+++ linux/net/ax25/Makefile Mon Apr 1 16:40:35 1996
@@ -9,7 +9,7 @@


O_TARGET := ax25.o
-O_OBJS := af_ax25.o
+O_OBJS := af_ax25.o sysctl_net_ax25.o

ifdef CONFIG_AX25
O_OBJS += ax25_in.o ax25_out.o ax25_route.o ax25_subr.o ax25_timer.o
diff -u --recursive --new-file linux-1.3.81/net/ax25/sysctl_net_ax25.c linux/net/ax25/sysctl_net_ax25.c
--- linux-1.3.81/net/ax25/sysctl_net_ax25.c Wed Dec 31 19:00:00 1969
+++ linux/net/ax25/sysctl_net_ax25.c Mon Apr 1 18:34:35 1996
@@ -0,0 +1,14 @@
+/* -*- linux-c -*-
+ * sysctl_net_ax25.c: sysctl interface to net AX.25 subsystem.
+ *
+ * Begun April 1, 1996, Mike Shaver.
+ * Added /proc/sys/net/ax25 directory entry (empty =) ). [MS]
+ */
+
+#include <linux/config.h>
+#include <linux/mm.h>
+#include <linux/sysctl.h>
+
+ctl_table ax25_table[] = {
+ {0}
+};
diff -u --recursive --new-file linux-1.3.81/net/core/Makefile linux/net/core/Makefile
--- linux-1.3.81/net/core/Makefile Tue Dec 12 00:05:07 1995
+++ linux/net/core/Makefile Mon Apr 1 16:41:51 1996
@@ -9,7 +9,7 @@

O_TARGET := core.o

-O_OBJS := sock.o skbuff.o iovec.o datagram.o
+O_OBJS := sock.o skbuff.o iovec.o datagram.o sysctl_net_core.o

ifdef CONFIG_NET

diff -u --recursive --new-file linux-1.3.81/net/core/sysctl_net_core.c linux/net/core/sysctl_net_core.c
--- linux-1.3.81/net/core/sysctl_net_core.c Wed Dec 31 19:00:00 1969
+++ linux/net/core/sysctl_net_core.c Mon Apr 1 18:35:26 1996
@@ -0,0 +1,14 @@
+/* -*- linux-c -*-
+ * sysctl_net_core.c: sysctl interface to net core subsystem.
+ *
+ * Begun April 1, 1996, Mike Shaver.
+ * Added /proc/sys/net/core directory entry (empty =) ). [MS]
+ */
+
+#include <linux/config.h>
+#include <linux/mm.h>
+#include <linux/sysctl.h>
+
+ctl_table core_table[] = {
+ {0}
+};
diff -u --recursive --new-file linux-1.3.81/net/ethernet/Makefile linux/net/ethernet/Makefile
--- linux-1.3.81/net/ethernet/Makefile Tue Aug 15 08:07:03 1995
+++ linux/net/ethernet/Makefile Mon Apr 1 16:43:15 1996
@@ -9,7 +9,7 @@

O_TARGET := ethernet.o

-OBJS := eth.o
+OBJS := eth.o sysctl_net_ether.o

ifdef CONFIG_IPX
OBJ2 := pe2.o
diff -u --recursive --new-file linux-1.3.81/net/ethernet/sysctl_net_ether.c linux/net/ethernet/sysctl_net_ether.c
--- linux-1.3.81/net/ethernet/sysctl_net_ether.c Wed Dec 31 19:00:00 1969
+++ linux/net/ethernet/sysctl_net_ether.c Mon Apr 1 18:35:54 1996
@@ -0,0 +1,14 @@
+/* -*- linux-c -*-
+ * sysctl_net_ether.c: sysctl interface to net Ethernet subsystem.
+ *
+ * Begun April 1, 1996, Mike Shaver.
+ * Added /proc/sys/net/ether directory entry (empty =) ). [MS]
+ */
+
+#include <linux/config.h>
+#include <linux/mm.h>
+#include <linux/sysctl.h>
+
+ctl_table ether_table[] = {
+ {0}
+};
diff -u --recursive --new-file linux-1.3.81/net/ipv4/Makefile linux/net/ipv4/Makefile
--- linux-1.3.81/net/ipv4/Makefile Sat Mar 30 06:20:34 1996
+++ linux/net/ipv4/Makefile Mon Apr 1 16:31:12 1996
@@ -12,7 +12,8 @@
ip_input.o ip_fragment.o ip_forward.o ip_options.o \
ip_output.o ip_sockglue.o \
tcp.o tcp_input.o tcp_output.o tcp_timer.o \
- raw.o udp.o arp.o icmp.o devinet.o af_inet.o igmp.o ip_fw.o
+ raw.o udp.o arp.o icmp.o devinet.o af_inet.o igmp.o ip_fw.o \
+ sysctl_net_ipv4.o

MOD_LIST_NAME := IPV4_MODULES
M_OBJS :=
diff -u --recursive --new-file linux-1.3.81/net/ipv4/sysctl_net_ipv4.c linux/net/ipv4/sysctl_net_ipv4.c
--- linux-1.3.81/net/ipv4/sysctl_net_ipv4.c Wed Dec 31 19:00:00 1969
+++ linux/net/ipv4/sysctl_net_ipv4.c Mon Apr 1 18:36:06 1996
@@ -0,0 +1,14 @@
+/* -*- linux-c -*-
+ * sysctl_net_ipv4.c: sysctl interface to net IPV4 subsystem.
+ *
+ * Begun April 1, 1996, Mike Shaver.
+ * Added /proc/sys/net/ipv4 directory entry (empty =) ). [MS]
+ */
+
+#include <linux/config.h>
+#include <linux/mm.h>
+#include <linux/sysctl.h>
+
+ctl_table ipv4_table[] = {
+ {0}
+};
diff -u --recursive --new-file linux-1.3.81/net/ipx/Makefile linux/net/ipx/Makefile
--- linux-1.3.81/net/ipx/Makefile Mon Mar 25 01:58:25 1996
+++ linux/net/ipx/Makefile Mon Apr 1 16:44:13 1996
@@ -8,7 +8,7 @@
# Note 2! The CFLAGS definition is now in the main makefile...

O_TARGET := ipx.o
-O_OBJS := af_ipx.o
+O_OBJS := af_ipx.o sysctl_net_ipx.o
M_OBJS := $(O_TARGET)

include $(TOPDIR)/Rules.make
diff -u --recursive --new-file linux-1.3.81/net/ipx/sysctl_net_ipx.c linux/net/ipx/sysctl_net_ipx.c
--- linux-1.3.81/net/ipx/sysctl_net_ipx.c Wed Dec 31 19:00:00 1969
+++ linux/net/ipx/sysctl_net_ipx.c Mon Apr 1 18:36:23 1996
@@ -0,0 +1,14 @@
+/* -*- linux-c -*-
+ * sysctl_net_ipx.c: sysctl interface to net IPX subsystem.
+ *
+ * Begun April 1, 1996, Mike Shaver.
+ * Added /proc/sys/net/ipx directory entry (empty =) ). [MS]
+ */
+
+#include <linux/config.h>
+#include <linux/mm.h>
+#include <linux/sysctl.h>
+
+ctl_table ipx_table[] = {
+ {0}
+};
diff -u --recursive --new-file linux-1.3.81/net/netrom/Makefile linux/net/netrom/Makefile
--- linux-1.3.81/net/netrom/Makefile Wed Sep 27 07:07:34 1995
+++ linux/net/netrom/Makefile Mon Apr 1 18:06:48 1996
@@ -8,7 +8,7 @@
# Note 2! The CFLAGS definition is now in the main makefile...

O_TARGET := netrom.o
-O_OBJS := af_netrom.o
+O_OBJS := af_netrom.o sysctl_net_netrom.o

ifdef CONFIG_NETROM
O_OBJS += nr_dev.o nr_in.o nr_out.o nr_route.o nr_subr.o nr_timer.o
diff -u --recursive --new-file linux-1.3.81/net/netrom/sysctl_net_netrom.c linux/net/netrom/sysctl_net_netrom.c
--- linux-1.3.81/net/netrom/sysctl_net_netrom.c Wed Dec 31 19:00:00 1969
+++ linux/net/netrom/sysctl_net_netrom.c Mon Apr 1 18:36:37 1996
@@ -0,0 +1,14 @@
+/* -*- linux-c -*-
+ * sysctl_net_netrom.c: sysctl interface to net NETROM subsystem.
+ *
+ * Begun April 1, 1996, Mike Shaver.
+ * Added /proc/sys/net/netrom directory entry (empty =) ). [MS]
+ */
+
+#include <linux/config.h>
+#include <linux/mm.h>
+#include <linux/sysctl.h>
+
+ctl_table netrom_table[] = {
+ {0}
+};
diff -u --recursive --new-file linux-1.3.81/net/sysctl_net.c linux/net/sysctl_net.c
--- linux-1.3.81/net/sysctl_net.c Wed Dec 31 19:00:00 1969
+++ linux/net/sysctl_net.c Mon Apr 1 18:50:01 1996
@@ -0,0 +1,55 @@
+/* -*- linux-c -*-
+ * sysctl_net.c: sysctl interface to net subsystem.
+ *
+ * Begun April 1, 1996, Mike Shaver.
+ * Added /proc/sys/net directories for each protocol family. [MS]
+ */
+
+#include <linux/config.h>
+#include <linux/mm.h>
+#include <linux/sysctl.h>
+
+#ifdef CONFIG_INET
+extern ctl_table ipv4_table[];
+#endif
+
+#ifdef CONFIG_IPX
+extern ctl_table ipx_table[];
+#endif
+
+#ifdef CONFIG_ATALK
+extern ctl_table atalk_table[];
+#endif
+
+#ifdef CONFIG_NETROM
+extern ctl_table netrom_table[];
+#endif
+
+#ifdef CONFIG_AX25
+extern ctl_table ax25_table[];
+#endif
+
+extern ctl_table core_table[], ether_table[], e802_table[], unix_table[];
+
+ctl_table net_table[] = {
+ {NET_CORE, "core", NULL, 0, 0555, core_table},
+ {NET_ETHER, "ethernet", NULL, 0, 0555, ether_table},
+ {NET_802, "802", NULL, 0, 0555, e802_table},
+ {NET_UNIX, "unix", NULL, 0, 0555, unix_table},
+#ifdef CONFIG_INET
+ {NET_IPV4, "ipv4", NULL, 0, 0555, ipv4_table},
+#endif
+#ifdef CONFIG_IPX
+ {NET_IPX, "ipx", NULL, 0, 0555, ipx_table},
+#endif
+#ifdef CONFIG_ATALK
+ {NET_ATALK, "appletalk", NULL, 0, 0555, atalk_table},
+#endif
+#ifdef CONFIG_NETROM
+ {NET_NETROM, "netrom", NULL, 0, 0555, netrom_table},
+#endif
+#ifdef CONFIG_AX25
+ {NET_AX25, "ax25", NULL, 0, 0555, ax25_table},
+#endif
+ {0}
+};
diff -u --recursive --new-file linux-1.3.81/net/unix/Makefile linux/net/unix/Makefile
--- linux-1.3.81/net/unix/Makefile Mon Mar 4 02:16:41 1996
+++ linux/net/unix/Makefile Mon Apr 1 16:45:06 1996
@@ -8,7 +8,7 @@
# Note 2! The CFLAGS definition is now in the main makefile...

O_TARGET := unix.o
-O_OBJS := af_unix.o garbage.o
+O_OBJS := af_unix.o garbage.o sysctl_net_unix.o

include $(TOPDIR)/Rules.make

diff -u --recursive --new-file linux-1.3.81/net/unix/sysctl_net_unix.c linux/net/unix/sysctl_net_unix.c
--- linux-1.3.81/net/unix/sysctl_net_unix.c Wed Dec 31 19:00:00 1969
+++ linux/net/unix/sysctl_net_unix.c Mon Apr 1 18:36:48 1996
@@ -0,0 +1,14 @@
+/* -*- linux-c -*-
+ * sysctl_net_unix.c: sysctl interface to net af_unix subsystem.
+ *
+ * Begun April 1, 1996, Mike Shaver.
+ * Added /proc/sys/net/unix directory entry (empty =) ). [MS]
+ */
+
+#include <linux/config.h>
+#include <linux/mm.h>
+#include <linux/sysctl.h>
+
+ctl_table unix_table[] = {
+ {0}
+};