1
2
3
4
5
6
7
8
9
10#include <linux/mm.h>
11#include <linux/sysctl.h>
12#include <linux/config.h>
13#include <net/snmp.h>
14#include <net/ip.h>
15#include <net/route.h>
16#include <net/tcp.h>
17
18
19
20
21
22#define TCP_PMTU_DISC 0x00000001
23#define TCP_CONG_AVOID 0x00000002
24#define TCP_DELAY_ACKS 0x00000003
25
26#if 0
27static int boolean_min = 0;
28static int boolean_max = 1;
29#endif
30
31
32extern int sysctl_icmp_echo_ignore_all;
33extern int sysctl_icmp_echo_ignore_broadcasts;
34extern int sysctl_icmp_ignore_bogus_error_responses;
35
36
37extern int sysctl_ipfrag_low_thresh;
38extern int sysctl_ipfrag_high_thresh;
39extern int sysctl_ipfrag_time;
40
41
42extern int sysctl_ip_dynaddr;
43
44
45extern int sysctl_ip_masq_debug;
46
47extern int sysctl_tcp_timestamps;
48extern int sysctl_tcp_window_scaling;
49extern int sysctl_tcp_sack;
50extern int sysctl_tcp_retrans_collapse;
51extern int sysctl_tcp_keepalive_time;
52extern int sysctl_tcp_keepalive_probes;
53extern int sysctl_tcp_max_ka_probes;
54extern int sysctl_tcp_retries1;
55extern int sysctl_tcp_retries2;
56extern int sysctl_tcp_fin_timeout;
57extern int sysctl_tcp_syncookies;
58extern int sysctl_tcp_syn_retries;
59extern int sysctl_tcp_stdurg;
60extern int sysctl_tcp_rfc1337;
61extern int sysctl_tcp_syn_taildrop;
62extern int sysctl_max_syn_backlog;
63
64
65extern int sysctl_icmp_destunreach_time;
66extern int sysctl_icmp_timeexceed_time;
67extern int sysctl_icmp_paramprob_time;
68extern int sysctl_icmp_echoreply_time;
69
70
71extern int sysctl_igmp_max_memberships;
72
73int tcp_retr1_max = 255;
74
75struct ipv4_config ipv4_config;
76
77extern ctl_table ipv4_route_table[];
78
79#ifdef CONFIG_SYSCTL
80
81static
82int ipv4_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
83 void *buffer, size_t *lenp)
84{
85 int val = ipv4_devconf.forwarding;
86 int ret;
87
88 ret = proc_dointvec(ctl, write, filp, buffer, lenp);
89
90 if (write && ipv4_devconf.forwarding != val)
91 inet_forward_change();
92
93 return ret;
94}
95
96
97ctl_table ipv4_table[] = {
98 {NET_IPV4_TCP_TIMESTAMPS, "tcp_timestamps",
99 &sysctl_tcp_timestamps, sizeof(int), 0644, NULL,
100 &proc_dointvec},
101 {NET_IPV4_TCP_WINDOW_SCALING, "tcp_window_scaling",
102 &sysctl_tcp_window_scaling, sizeof(int), 0644, NULL,
103 &proc_dointvec},
104 {NET_IPV4_TCP_SACK, "tcp_sack",
105 &sysctl_tcp_sack, sizeof(int), 0644, NULL,
106 &proc_dointvec},
107 {NET_IPV4_TCP_RETRANS_COLLAPSE, "tcp_retrans_collapse",
108 &sysctl_tcp_retrans_collapse, sizeof(int), 0644, NULL,
109 &proc_dointvec},
110 {NET_IPV4_FORWARD, "ip_forward",
111 &ipv4_devconf.forwarding, sizeof(int), 0644, NULL,
112 &ipv4_sysctl_forward},
113 {NET_IPV4_DEFAULT_TTL, "ip_default_ttl",
114 &ip_statistics.IpDefaultTTL, sizeof(int), 0644, NULL,
115 &proc_dointvec},
116 {NET_IPV4_AUTOCONFIG, "ip_autoconfig",
117 &ipv4_config.autoconfig, sizeof(int), 0644, NULL,
118 &proc_dointvec},
119 {NET_IPV4_NO_PMTU_DISC, "ip_no_pmtu_disc",
120 &ipv4_config.no_pmtu_disc, sizeof(int), 0644, NULL,
121 &proc_dointvec},
122 {NET_IPV4_TCP_SYN_RETRIES, "tcp_syn_retries",
123 &sysctl_tcp_syn_retries, sizeof(int), 0644, NULL, &proc_dointvec},
124 {NET_IPV4_IPFRAG_HIGH_THRESH, "ipfrag_high_thresh",
125 &sysctl_ipfrag_high_thresh, sizeof(int), 0644, NULL, &proc_dointvec},
126 {NET_IPV4_IPFRAG_LOW_THRESH, "ipfrag_low_thresh",
127 &sysctl_ipfrag_low_thresh, sizeof(int), 0644, NULL, &proc_dointvec},
128 {NET_IPV4_DYNADDR, "ip_dynaddr",
129 &sysctl_ip_dynaddr, sizeof(int), 0644, NULL, &proc_dointvec},
130#ifdef CONFIG_IP_MASQUERADE
131 {NET_IPV4_IP_MASQ_DEBUG, "ip_masq_debug",
132 &sysctl_ip_masq_debug, sizeof(int), 0644, NULL, &proc_dointvec},
133#endif
134 {NET_IPV4_IPFRAG_TIME, "ipfrag_time",
135 &sysctl_ipfrag_time, sizeof(int), 0644, NULL, &proc_dointvec_jiffies},
136 {NET_IPV4_TCP_MAX_KA_PROBES, "tcp_max_ka_probes",
137 &sysctl_tcp_max_ka_probes, sizeof(int), 0644, NULL, &proc_dointvec},
138 {NET_IPV4_TCP_KEEPALIVE_TIME, "tcp_keepalive_time",
139 &sysctl_tcp_keepalive_time, sizeof(int), 0644, NULL,
140 &proc_dointvec_jiffies},
141 {NET_IPV4_TCP_KEEPALIVE_PROBES, "tcp_keepalive_probes",
142 &sysctl_tcp_keepalive_probes, sizeof(int), 0644, NULL,
143 &proc_dointvec},
144 {NET_IPV4_TCP_RETRIES1, "tcp_retries1",
145 &sysctl_tcp_retries1, sizeof(int), 0644, NULL, &proc_dointvec_minmax,
146 &sysctl_intvec, NULL, NULL, &tcp_retr1_max},
147 {NET_IPV4_TCP_RETRIES2, "tcp_retries2",
148 &sysctl_tcp_retries2, sizeof(int), 0644, NULL, &proc_dointvec},
149 {NET_IPV4_TCP_FIN_TIMEOUT, "tcp_fin_timeout",
150 &sysctl_tcp_fin_timeout, sizeof(int), 0644, NULL,
151 &proc_dointvec_jiffies},
152#ifdef CONFIG_SYN_COOKIES
153 {NET_TCP_SYNCOOKIES, "tcp_syncookies",
154 &sysctl_tcp_syncookies, sizeof(int), 0644, NULL, &proc_dointvec},
155#endif
156 {NET_TCP_STDURG, "tcp_stdurg", &sysctl_tcp_stdurg,
157 sizeof(int), 0644, NULL, &proc_dointvec},
158 {NET_TCP_RFC1337, "tcp_rfc1337", &sysctl_tcp_rfc1337,
159 sizeof(int), 0644, NULL, &proc_dointvec},
160 {NET_TCP_MAX_SYN_BACKLOG, "tcp_max_syn_backlog", &sysctl_max_syn_backlog,
161 sizeof(int), 0644, NULL, &proc_dointvec},
162 {NET_IPV4_LOCAL_PORT_RANGE, "ip_local_port_range",
163 &sysctl_local_port_range, sizeof(sysctl_local_port_range), 0644,
164 NULL, &proc_dointvec},
165 {NET_IPV4_ICMP_ECHO_IGNORE_ALL, "icmp_echo_ignore_all",
166 &sysctl_icmp_echo_ignore_all, sizeof(int), 0644, NULL,
167 &proc_dointvec},
168 {NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS, "icmp_echo_ignore_broadcasts",
169 &sysctl_icmp_echo_ignore_broadcasts, sizeof(int), 0644, NULL,
170 &proc_dointvec},
171 {NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES, "icmp_ignore_bogus_error_responses",
172 &sysctl_icmp_ignore_bogus_error_responses, sizeof(int), 0644, NULL,
173 &proc_dointvec},
174 {NET_IPV4_ICMP_DESTUNREACH_RATE, "icmp_destunreach_rate",
175 &sysctl_icmp_destunreach_time, sizeof(int), 0644, NULL, &proc_dointvec},
176 {NET_IPV4_ICMP_TIMEEXCEED_RATE, "icmp_timeexceed_rate",
177 &sysctl_icmp_timeexceed_time, sizeof(int), 0644, NULL, &proc_dointvec},
178 {NET_IPV4_ICMP_PARAMPROB_RATE, "icmp_paramprob_rate",
179 &sysctl_icmp_paramprob_time, sizeof(int), 0644, NULL, &proc_dointvec},
180 {NET_IPV4_ICMP_ECHOREPLY_RATE, "icmp_echoreply_rate",
181 &sysctl_icmp_echoreply_time, sizeof(int), 0644, NULL, &proc_dointvec},
182 {NET_IPV4_ROUTE, "route", NULL, 0, 0555, ipv4_route_table},
183#ifdef CONFIG_IP_MULTICAST
184 {NET_IPV4_IGMP_MAX_MEMBERSHIPS, "igmp_max_memberships",
185 &sysctl_igmp_max_memberships, sizeof(int), 0644, NULL, &proc_dointvec},
186#endif
187 {0}
188};
189
190#endif
191