Re: sysctl() considered harmful

Martin von Loewis (martin@mira.isdn.cs.tu-berlin.de)
Tue, 6 Jan 1998 01:47:33 +0100


> I'm willing to provide patches along the lines mentioned above,
> unless somebody tells me that this is rubbish.

Following up to myself, here's a couple of patches to Linux 2.1.77,
which hopefully align the sysctl values to those of 2.0. This patch is
likely to break any program that uses sysctl and has been compiled for
2.1. I still believe this (+- some bugs left) should be in 2.2.

No effort has been taking to give those sysctls which lost their
meaning during 2.1 some reasonable implementation. Most notably,
NET_IPV4_FORWARD can probably implemented on top of
NET_IPV4_FORWARDING. One exception: NET_IPV4_DYNADDR is apparently
the same as NET_IPV4_IP_DYNADDR.

Please review,

Martin

--- linux-2.1.77.1/include/linux/sysctl.h Fri Dec 19 08:55:34 1997
+++ linux-2.1.74.1/include/linux/sysctl.h Tue Jan 6 01:32:25 1998
@@ -58,6 +58,7 @@
KERN_MAXINODE,
KERN_NRFILE,
KERN_MAXFILE,
+ KERN_MAXID_OBSOLETE, /* Linux 2.0 compatibility */
KERN_SECURELVL, /* int: system security level */
KERN_PANIC, /* int: panic timeout */
KERN_REALROOTDEV, /* real root device to mount after initrd */
@@ -78,10 +79,11 @@
enum
{
VM_SWAPCTL=1, /* struct: Set vm swapping control */
- VM_SWAPOUT, /* int: Background pageout interval */
+ VM_KSWAPD, /* Linux 2.0 compatibility, obsolete */
VM_FREEPG, /* struct: Set free page thresholds */
VM_BDFLUSH, /* struct: Control buffer cache flushing */
VM_OVERCOMMIT_MEMORY, /* Turn off the virtual memory safety limit */
+ VM_SWAPOUT, /* int: Background pageout interval */
};


@@ -109,7 +111,8 @@
/* /proc/sys/net/core */
enum
{
- NET_CORE_WMEM_MAX=1,
+ NET_CORE_NET_ALIAS_MAX=1, /* Linux 2.0 compatibility, obsolete */
+ NET_CORE_WMEM_MAX,
NET_CORE_RMEM_MAX,
NET_CORE_WMEM_DEFAULT,
NET_CORE_RMEM_DEFAULT,
@@ -134,11 +137,15 @@
NET_IPV4_ARP_RES_TIME=1,
NET_IPV4_ARP_DEAD_RES_TIME,
NET_IPV4_ARP_MAX_TRIES,
- NET_IPV4_ARP_MAX_PINGS,
NET_IPV4_ARP_TIMEOUT,
NET_IPV4_ARP_CHECK_INTERVAL,
NET_IPV4_ARP_CONFIRM_INTERVAL,
NET_IPV4_ARP_CONFIRM_TIMEOUT,
+ NET_IPV4_FORWARD,
+ NET_IPV4_IP_DYNADDR,
+ /* Linux 2.0 compatibility */
+#define NET_IPV4_DYNADDR NET_IPV4_IP_DYNADDR
+ NET_IPV4_ARP_MAX_PINGS, /* these are new to Linux 2.1 */
NET_IPV4_TCP_HOE_RETRANSMITS,
NET_IPV4_TCP_SACK,
NET_IPV4_TCP_TSACK,
@@ -173,7 +180,6 @@
NET_IPV4_IGMP_MAX_HOST_REPORT_DELAY,
NET_IPV4_IGMP_TIMER_SCALE,
NET_IPV4_IGMP_AGE_THRESHOLD,
- NET_IPV4_IP_DYNADDR,
NET_IPV4_IP_MASQ_DEBUG,
NET_TCP_SYNCOOKIES,
NET_TCP_STDURG,