patch-2.1.15 linux/net/ipv4/sysctl_net_ipv4.c
Next file: linux/net/ipv4/tcp.c
Previous file: linux/net/ipv4/route.c
Back to the patch index
Back to the overall index
- Lines: 104
- Date:
Thu Dec 12 16:54:24 1996
- Orig file:
v2.1.14/linux/net/ipv4/sysctl_net_ipv4.c
- Orig date:
Tue Nov 19 15:54:01 1996
diff -u --recursive --new-file v2.1.14/linux/net/ipv4/sysctl_net_ipv4.c linux/net/ipv4/sysctl_net_ipv4.c
@@ -1,4 +1,4 @@
-/* -*- linux-c -*-
+/*
* sysctl_net_ipv4.c: sysctl interface to net IPV4 subsystem.
*
* Begun April 1, 1996, Mike Shaver.
@@ -7,6 +7,9 @@
#include <linux/mm.h>
#include <linux/sysctl.h>
+#include <net/snmp.h>
+#include <net/ip.h>
+#include <net/route.h>
#include <net/tcp.h>
/*
@@ -35,9 +38,31 @@
extern int tcp_sysctl_congavoid(ctl_table *ctl, int write, struct file * filp,
void *buffer, size_t *lenp);
+struct ipv4_config ipv4_config = { 1, 1, 1, 1, };
+struct ipv4_config ipv4_def_router_config = { 0, 1, 1, 1, 1, 1, 1, };
+struct ipv4_config ipv4_def_host_config = { 1, 1, 1, 1, };
+
+int ipv4_sysctl_forwarding(ctl_table *ctl, int write, struct file * filp,
+ void *buffer, size_t *lenp)
+{
+ int val = IS_ROUTER;
+ int ret;
+
+ ret = proc_dointvec(ctl, write, filp, buffer, lenp);
+
+ if (write && IS_ROUTER != val) {
+ if (IS_ROUTER)
+ ipv4_config = ipv4_def_router_config;
+ else
+ ipv4_config = ipv4_def_host_config;
+ rt_cache_flush(0);
+ }
+ return ret;
+}
+
ctl_table ipv4_table[] = {
{NET_IPV4_ARP_RES_TIME, "arp_res_time",
- &sysctl_arp_res_time, sizeof(int), 0644, NULL, &proc_dointvec},
+ &sysctl_arp_res_time, sizeof(int), 0644, NULL, &proc_dointvec},
{NET_IPV4_ARP_DEAD_RES_TIME, "arp_dead_res_time",
&sysctl_arp_dead_res_time, sizeof(int), 0644, NULL, &proc_dointvec},
{NET_IPV4_ARP_MAX_TRIES, "arp_max_tries",
@@ -52,15 +77,47 @@
{NET_IPV4_ARP_CONFIRM_TIMEOUT, "arp_confirm_timeout",
&sysctl_arp_confirm_timeout, sizeof(int), 0644, NULL,
&proc_dointvec},
-#if 0
- {TCP_PMTU_DISC, "tcp_pmtu_discovery",
- &ipv4_pmtu_discovery, sizeof(int), 644,
- NULL, &proc_dointvec, &sysctl_intvec_minmax,
- &boolean_min, &boolean_max},
-#endif
-
{NET_IPV4_TCP_VEGAS_CONG_AVOID, "tcp_vegas_cong_avoid",
&sysctl_tcp_cong_avoidance, sizeof(int), 0644,
NULL, &tcp_sysctl_congavoid },
+ {NET_IPV4_FORWARDING, "ip_forwarding",
+ &ip_statistics.IpForwarding, sizeof(int), 0644, NULL,
+ &ipv4_sysctl_forwarding},
+ {NET_IPV4_DEFAULT_TTL, "ip_default_ttl",
+ &ip_statistics.IpDefaultTTL, sizeof(int), 0644, NULL,
+ &proc_dointvec},
+ {NET_IPV4_RFC1812_FILTER, "ip_rfc1812_filter",
+ &ipv4_config.rfc1812_filter, sizeof(int), 0644, NULL,
+ &proc_dointvec},
+ {NET_IPV4_LOG_MARTIANS, "ip_log_martians",
+ &ipv4_config.log_martians, sizeof(int), 0644, NULL,
+ &proc_dointvec},
+ {NET_IPV4_SOURCE_ROUTE, "ip_source_route",
+ &ipv4_config.source_route, sizeof(int), 0644, NULL,
+ &proc_dointvec},
+ {NET_IPV4_ADDRMASK_AGENT, "ip_addrmask_agent",
+ &ipv4_config.addrmask_agent, sizeof(int), 0644, NULL,
+ &proc_dointvec},
+ {NET_IPV4_BOOTP_AGENT, "ip_bootp_agent",
+ &ipv4_config.bootp_agent, sizeof(int), 0644, NULL,
+ &proc_dointvec},
+ {NET_IPV4_BOOTP_RELAY, "ip_bootp_relay",
+ &ipv4_config.bootp_relay, sizeof(int), 0644, NULL,
+ &proc_dointvec},
+ {NET_IPV4_FIB_MODEL, "ip_fib_model",
+ &ipv4_config.fib_model, sizeof(int), 0644, NULL,
+ &proc_dointvec},
+ {NET_IPV4_NO_PMTU_DISC, "ip_no_pmtu_disc",
+ &ipv4_config.no_pmtu_disc, sizeof(int), 0644, NULL,
+ &proc_dointvec},
+ {NET_IPV4_ACCEPT_REDIRECTS, "ip_accept_redirects",
+ &ipv4_config.accept_redirects, sizeof(int), 0644, NULL,
+ &proc_dointvec},
+ {NET_IPV4_SECURE_REDIRECTS, "ip_secure_redirects",
+ &ipv4_config.secure_redirects, sizeof(int), 0644, NULL,
+ &proc_dointvec},
+ {NET_IPV4_RFC1620_REDIRECTS, "ip_rfc1620_redirects",
+ &ipv4_config.rfc1620_redirects, sizeof(int), 0644, NULL,
+ &proc_dointvec},
{0}
};
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov