patch-2.0.30 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: 44
- Date:
Tue Apr 8 08:47:47 1997
- Orig file:
v2.0.29/linux/net/ipv4/sysctl_net_ipv4.c
- Orig date:
Mon Jun 3 04:07:09 1996
diff -u --recursive --new-file v2.0.29/linux/net/ipv4/sysctl_net_ipv4.c linux/net/ipv4/sysctl_net_ipv4.c
@@ -7,6 +7,7 @@
#include <linux/mm.h>
#include <linux/sysctl.h>
+#include <net/ip.h>
/* From arp.c */
extern int sysctl_arp_res_time;
@@ -17,6 +18,27 @@
extern int sysctl_arp_confirm_interval;
extern int sysctl_arp_confirm_timeout;
+extern int sysctl_ip_forward;
+static int proc_doipforward(ctl_table *ctl, int write, struct file *filp,
+ void *buffer, size_t *lenp)
+{
+ int val = sysctl_ip_forward;
+ int retv;
+
+ retv = proc_dointvec(ctl, write, filp, buffer, lenp);
+ if (write) {
+ if (sysctl_ip_forward && !val) {
+ printk(KERN_INFO "sysctl: ip forwarding enabled\n");
+ ip_statistics.IpForwarding = 1;
+ }
+ if (!sysctl_ip_forward && val) {
+ printk(KERN_INFO "sysctl: ip forwarding off\n");
+ ip_statistics.IpForwarding = 2;
+ }
+ }
+ return retv;
+}
+
ctl_table ipv4_table[] = {
{NET_IPV4_ARP_RES_TIME, "arp_res_time",
&sysctl_arp_res_time, sizeof(int), 0644, NULL, &proc_dointvec},
@@ -34,5 +56,7 @@
{NET_IPV4_ARP_CONFIRM_TIMEOUT, "arp_confirm_timeout",
&sysctl_arp_confirm_timeout, sizeof(int), 0644, NULL,
&proc_dointvec},
+ {NET_IPV4_FORWARD, "ip_forward", &sysctl_ip_forward, sizeof(int),
+ 0644, NULL, &proc_doipforward },
{0}
};
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov