blob: 82cdf23837e3e8b9766ba5f7dbb28634a20c2675 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * sysctl_net_ipv4.c: sysctl interface to net IPV4 subsystem.
3 *
4 * $Id: sysctl_net_ipv4.c,v 1.50 2001/10/20 00:00:11 davem Exp $
5 *
6 * Begun April 1, 1996, Mike Shaver.
7 * Added /proc/sys/net/ipv4 directory entry (empty =) ). [MS]
8 */
9
10#include <linux/mm.h>
11#include <linux/module.h>
12#include <linux/sysctl.h>
Arnaldo Carvalho de Melo20380732005-08-16 02:18:02 -030013#include <linux/igmp.h>
Arnaldo Carvalho de Melo14c85022005-12-27 02:43:12 -020014#include <linux/inetdevice.h>
Stephen Hemminger227b60f2007-10-10 17:30:46 -070015#include <linux/seqlock.h>
Pavel Emelyanov3e37c3f2007-12-05 01:41:26 -080016#include <linux/init.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#include <net/snmp.h>
Arnaldo Carvalho de Melo20380732005-08-16 02:18:02 -030018#include <net/icmp.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#include <net/ip.h>
20#include <net/route.h>
21#include <net/tcp.h>
Hideo Aoki95766ff2007-12-31 00:29:24 -080022#include <net/udp.h>
Paul Moore446fda42006-08-03 16:48:06 -070023#include <net/cipso_ipv4.h>
Pavel Emelyanov04128f22007-10-15 02:33:45 -070024#include <net/inet_frag.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070025
Herbert Xu89cee8b2005-12-13 23:14:27 -080026static int zero;
YOSHIFUJI Hideakie905a9e2007-02-09 23:24:47 +090027static int tcp_retr1_max = 255;
Linus Torvalds1da177e2005-04-16 15:20:36 -070028static int ip_local_port_range_min[] = { 1, 1 };
29static int ip_local_port_range_max[] = { 65535, 65535 };
Linus Torvalds1da177e2005-04-16 15:20:36 -070030
Stephen Hemminger227b60f2007-10-10 17:30:46 -070031extern seqlock_t sysctl_port_range_lock;
32extern int sysctl_local_port_range[2];
33
34/* Update system visible IP port range */
35static void set_local_port_range(int range[2])
36{
37 write_seqlock(&sysctl_port_range_lock);
38 sysctl_local_port_range[0] = range[0];
39 sysctl_local_port_range[1] = range[1];
40 write_sequnlock(&sysctl_port_range_lock);
41}
42
43/* Validate changes from /proc interface. */
44static int ipv4_local_port_range(ctl_table *table, int write, struct file *filp,
45 void __user *buffer,
46 size_t *lenp, loff_t *ppos)
47{
48 int ret;
49 int range[2] = { sysctl_local_port_range[0],
50 sysctl_local_port_range[1] };
51 ctl_table tmp = {
52 .data = &range,
53 .maxlen = sizeof(range),
54 .mode = table->mode,
55 .extra1 = &ip_local_port_range_min,
56 .extra2 = &ip_local_port_range_max,
57 };
58
59 ret = proc_dointvec_minmax(&tmp, write, filp, buffer, lenp, ppos);
60
61 if (write && ret == 0) {
Anton Arapova25de532007-10-18 22:00:17 -070062 if (range[1] < range[0])
Stephen Hemminger227b60f2007-10-10 17:30:46 -070063 ret = -EINVAL;
64 else
65 set_local_port_range(range);
66 }
67
68 return ret;
69}
70
71/* Validate changes from sysctl interface. */
72static int ipv4_sysctl_local_port_range(ctl_table *table, int __user *name,
73 int nlen, void __user *oldval,
74 size_t __user *oldlenp,
75 void __user *newval, size_t newlen)
76{
77 int ret;
78 int range[2] = { sysctl_local_port_range[0],
79 sysctl_local_port_range[1] };
80 ctl_table tmp = {
81 .data = &range,
82 .maxlen = sizeof(range),
83 .mode = table->mode,
84 .extra1 = &ip_local_port_range_min,
85 .extra2 = &ip_local_port_range_max,
86 };
87
88 ret = sysctl_intvec(&tmp, name, nlen, oldval, oldlenp, newval, newlen);
89 if (ret == 0 && newval && newlen) {
Anton Arapova25de532007-10-18 22:00:17 -070090 if (range[1] < range[0])
Stephen Hemminger227b60f2007-10-10 17:30:46 -070091 ret = -EINVAL;
92 else
93 set_local_port_range(range);
94 }
95 return ret;
96}
97
98
Stephen Hemminger317a76f2005-06-23 12:19:55 -070099static int proc_tcp_congestion_control(ctl_table *ctl, int write, struct file * filp,
100 void __user *buffer, size_t *lenp, loff_t *ppos)
101{
102 char val[TCP_CA_NAME_MAX];
103 ctl_table tbl = {
104 .data = val,
105 .maxlen = TCP_CA_NAME_MAX,
106 };
107 int ret;
108
109 tcp_get_default_congestion_control(val);
110
111 ret = proc_dostring(&tbl, write, filp, buffer, lenp, ppos);
112 if (write && ret == 0)
113 ret = tcp_set_default_congestion_control(val);
114 return ret;
115}
116
Arnaldo Carvalho de Melo20380732005-08-16 02:18:02 -0300117static int sysctl_tcp_congestion_control(ctl_table *table, int __user *name,
118 int nlen, void __user *oldval,
119 size_t __user *oldlenp,
Alexey Dobriyan1f29bcd2006-12-10 02:19:10 -0800120 void __user *newval, size_t newlen)
Stephen Hemminger317a76f2005-06-23 12:19:55 -0700121{
122 char val[TCP_CA_NAME_MAX];
123 ctl_table tbl = {
124 .data = val,
125 .maxlen = TCP_CA_NAME_MAX,
126 };
127 int ret;
128
129 tcp_get_default_congestion_control(val);
Alexey Dobriyan1f29bcd2006-12-10 02:19:10 -0800130 ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen);
Sam Jansen54877962007-11-19 23:28:21 -0800131 if (ret == 1 && newval && newlen)
Stephen Hemminger317a76f2005-06-23 12:19:55 -0700132 ret = tcp_set_default_congestion_control(val);
133 return ret;
134}
135
Stephen Hemminger3ff825b2006-11-09 16:32:06 -0800136static int proc_tcp_available_congestion_control(ctl_table *ctl,
137 int write, struct file * filp,
138 void __user *buffer, size_t *lenp,
139 loff_t *ppos)
140{
141 ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX, };
142 int ret;
143
144 tbl.data = kmalloc(tbl.maxlen, GFP_USER);
145 if (!tbl.data)
146 return -ENOMEM;
147 tcp_get_available_congestion_control(tbl.data, TCP_CA_BUF_MAX);
148 ret = proc_dostring(&tbl, write, filp, buffer, lenp, ppos);
149 kfree(tbl.data);
150 return ret;
151}
152
Stephen Hemmingerce7bc3b2006-11-09 16:35:15 -0800153static int proc_allowed_congestion_control(ctl_table *ctl,
154 int write, struct file * filp,
155 void __user *buffer, size_t *lenp,
156 loff_t *ppos)
157{
158 ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX };
159 int ret;
160
161 tbl.data = kmalloc(tbl.maxlen, GFP_USER);
162 if (!tbl.data)
163 return -ENOMEM;
164
165 tcp_get_allowed_congestion_control(tbl.data, tbl.maxlen);
166 ret = proc_dostring(&tbl, write, filp, buffer, lenp, ppos);
167 if (write && ret == 0)
168 ret = tcp_set_allowed_congestion_control(tbl.data);
169 kfree(tbl.data);
170 return ret;
171}
172
173static int strategy_allowed_congestion_control(ctl_table *table, int __user *name,
174 int nlen, void __user *oldval,
175 size_t __user *oldlenp,
Alexey Dobriyan1f29bcd2006-12-10 02:19:10 -0800176 void __user *newval,
177 size_t newlen)
Stephen Hemmingerce7bc3b2006-11-09 16:35:15 -0800178{
179 ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX };
180 int ret;
181
182 tbl.data = kmalloc(tbl.maxlen, GFP_USER);
183 if (!tbl.data)
184 return -ENOMEM;
185
186 tcp_get_available_congestion_control(tbl.data, tbl.maxlen);
Alexey Dobriyan1f29bcd2006-12-10 02:19:10 -0800187 ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen);
Stephen Hemmingerce7bc3b2006-11-09 16:35:15 -0800188 if (ret == 0 && newval && newlen)
189 ret = tcp_set_allowed_congestion_control(tbl.data);
190 kfree(tbl.data);
191
192 return ret;
193
194}
195
Pavel Emelyanov3e37c3f2007-12-05 01:41:26 -0800196static struct ctl_table ipv4_table[] = {
YOSHIFUJI Hideakie905a9e2007-02-09 23:24:47 +0900197 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198 .ctl_name = NET_IPV4_TCP_TIMESTAMPS,
199 .procname = "tcp_timestamps",
200 .data = &sysctl_tcp_timestamps,
201 .maxlen = sizeof(int),
202 .mode = 0644,
203 .proc_handler = &proc_dointvec
204 },
YOSHIFUJI Hideakie905a9e2007-02-09 23:24:47 +0900205 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206 .ctl_name = NET_IPV4_TCP_WINDOW_SCALING,
207 .procname = "tcp_window_scaling",
208 .data = &sysctl_tcp_window_scaling,
209 .maxlen = sizeof(int),
210 .mode = 0644,
211 .proc_handler = &proc_dointvec
212 },
YOSHIFUJI Hideakie905a9e2007-02-09 23:24:47 +0900213 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214 .ctl_name = NET_IPV4_TCP_SACK,
215 .procname = "tcp_sack",
216 .data = &sysctl_tcp_sack,
217 .maxlen = sizeof(int),
218 .mode = 0644,
219 .proc_handler = &proc_dointvec
220 },
YOSHIFUJI Hideakie905a9e2007-02-09 23:24:47 +0900221 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222 .ctl_name = NET_IPV4_TCP_RETRANS_COLLAPSE,
223 .procname = "tcp_retrans_collapse",
224 .data = &sysctl_tcp_retrans_collapse,
225 .maxlen = sizeof(int),
226 .mode = 0644,
227 .proc_handler = &proc_dointvec
228 },
YOSHIFUJI Hideakie905a9e2007-02-09 23:24:47 +0900229 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700230 .ctl_name = NET_IPV4_DEFAULT_TTL,
231 .procname = "ip_default_ttl",
YOSHIFUJI Hideakie905a9e2007-02-09 23:24:47 +0900232 .data = &sysctl_ip_default_ttl,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233 .maxlen = sizeof(int),
234 .mode = 0644,
235 .proc_handler = &ipv4_doint_and_flush,
236 .strategy = &ipv4_doint_and_flush_strategy,
237 },
YOSHIFUJI Hideakie905a9e2007-02-09 23:24:47 +0900238 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239 .ctl_name = NET_IPV4_NO_PMTU_DISC,
240 .procname = "ip_no_pmtu_disc",
241 .data = &ipv4_config.no_pmtu_disc,
242 .maxlen = sizeof(int),
243 .mode = 0644,
244 .proc_handler = &proc_dointvec
245 },
246 {
247 .ctl_name = NET_IPV4_NONLOCAL_BIND,
248 .procname = "ip_nonlocal_bind",
249 .data = &sysctl_ip_nonlocal_bind,
250 .maxlen = sizeof(int),
251 .mode = 0644,
252 .proc_handler = &proc_dointvec
253 },
254 {
255 .ctl_name = NET_IPV4_TCP_SYN_RETRIES,
256 .procname = "tcp_syn_retries",
257 .data = &sysctl_tcp_syn_retries,
258 .maxlen = sizeof(int),
259 .mode = 0644,
260 .proc_handler = &proc_dointvec
261 },
262 {
263 .ctl_name = NET_TCP_SYNACK_RETRIES,
264 .procname = "tcp_synack_retries",
265 .data = &sysctl_tcp_synack_retries,
266 .maxlen = sizeof(int),
267 .mode = 0644,
268 .proc_handler = &proc_dointvec
269 },
270 {
271 .ctl_name = NET_TCP_MAX_ORPHANS,
272 .procname = "tcp_max_orphans",
273 .data = &sysctl_tcp_max_orphans,
274 .maxlen = sizeof(int),
275 .mode = 0644,
276 .proc_handler = &proc_dointvec
277 },
278 {
279 .ctl_name = NET_TCP_MAX_TW_BUCKETS,
280 .procname = "tcp_max_tw_buckets",
Arnaldo Carvalho de Melo295ff7e2005-08-09 20:44:40 -0700281 .data = &tcp_death_row.sysctl_max_tw_buckets,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700282 .maxlen = sizeof(int),
283 .mode = 0644,
284 .proc_handler = &proc_dointvec
285 },
286 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700287 .ctl_name = NET_IPV4_DYNADDR,
288 .procname = "ip_dynaddr",
289 .data = &sysctl_ip_dynaddr,
290 .maxlen = sizeof(int),
291 .mode = 0644,
292 .proc_handler = &proc_dointvec
293 },
294 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700295 .ctl_name = NET_IPV4_TCP_KEEPALIVE_TIME,
296 .procname = "tcp_keepalive_time",
297 .data = &sysctl_tcp_keepalive_time,
298 .maxlen = sizeof(int),
299 .mode = 0644,
300 .proc_handler = &proc_dointvec_jiffies,
301 .strategy = &sysctl_jiffies
302 },
303 {
304 .ctl_name = NET_IPV4_TCP_KEEPALIVE_PROBES,
305 .procname = "tcp_keepalive_probes",
306 .data = &sysctl_tcp_keepalive_probes,
307 .maxlen = sizeof(int),
308 .mode = 0644,
309 .proc_handler = &proc_dointvec
310 },
311 {
312 .ctl_name = NET_IPV4_TCP_KEEPALIVE_INTVL,
313 .procname = "tcp_keepalive_intvl",
314 .data = &sysctl_tcp_keepalive_intvl,
315 .maxlen = sizeof(int),
316 .mode = 0644,
317 .proc_handler = &proc_dointvec_jiffies,
318 .strategy = &sysctl_jiffies
319 },
320 {
321 .ctl_name = NET_IPV4_TCP_RETRIES1,
322 .procname = "tcp_retries1",
323 .data = &sysctl_tcp_retries1,
324 .maxlen = sizeof(int),
325 .mode = 0644,
326 .proc_handler = &proc_dointvec_minmax,
327 .strategy = &sysctl_intvec,
328 .extra2 = &tcp_retr1_max
329 },
330 {
331 .ctl_name = NET_IPV4_TCP_RETRIES2,
332 .procname = "tcp_retries2",
333 .data = &sysctl_tcp_retries2,
334 .maxlen = sizeof(int),
335 .mode = 0644,
336 .proc_handler = &proc_dointvec
337 },
338 {
339 .ctl_name = NET_IPV4_TCP_FIN_TIMEOUT,
340 .procname = "tcp_fin_timeout",
341 .data = &sysctl_tcp_fin_timeout,
342 .maxlen = sizeof(int),
343 .mode = 0644,
344 .proc_handler = &proc_dointvec_jiffies,
345 .strategy = &sysctl_jiffies
346 },
347#ifdef CONFIG_SYN_COOKIES
348 {
349 .ctl_name = NET_TCP_SYNCOOKIES,
350 .procname = "tcp_syncookies",
351 .data = &sysctl_tcp_syncookies,
352 .maxlen = sizeof(int),
353 .mode = 0644,
354 .proc_handler = &proc_dointvec
355 },
356#endif
357 {
358 .ctl_name = NET_TCP_TW_RECYCLE,
359 .procname = "tcp_tw_recycle",
Arnaldo Carvalho de Melo295ff7e2005-08-09 20:44:40 -0700360 .data = &tcp_death_row.sysctl_tw_recycle,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700361 .maxlen = sizeof(int),
362 .mode = 0644,
363 .proc_handler = &proc_dointvec
364 },
365 {
366 .ctl_name = NET_TCP_ABORT_ON_OVERFLOW,
367 .procname = "tcp_abort_on_overflow",
368 .data = &sysctl_tcp_abort_on_overflow,
369 .maxlen = sizeof(int),
370 .mode = 0644,
371 .proc_handler = &proc_dointvec
372 },
373 {
374 .ctl_name = NET_TCP_STDURG,
375 .procname = "tcp_stdurg",
376 .data = &sysctl_tcp_stdurg,
377 .maxlen = sizeof(int),
378 .mode = 0644,
379 .proc_handler = &proc_dointvec
380 },
381 {
382 .ctl_name = NET_TCP_RFC1337,
383 .procname = "tcp_rfc1337",
384 .data = &sysctl_tcp_rfc1337,
385 .maxlen = sizeof(int),
386 .mode = 0644,
387 .proc_handler = &proc_dointvec
388 },
389 {
390 .ctl_name = NET_TCP_MAX_SYN_BACKLOG,
391 .procname = "tcp_max_syn_backlog",
392 .data = &sysctl_max_syn_backlog,
393 .maxlen = sizeof(int),
394 .mode = 0644,
395 .proc_handler = &proc_dointvec
396 },
397 {
398 .ctl_name = NET_IPV4_LOCAL_PORT_RANGE,
399 .procname = "ip_local_port_range",
400 .data = &sysctl_local_port_range,
401 .maxlen = sizeof(sysctl_local_port_range),
402 .mode = 0644,
Stephen Hemminger227b60f2007-10-10 17:30:46 -0700403 .proc_handler = &ipv4_local_port_range,
404 .strategy = &ipv4_sysctl_local_port_range,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700405 },
406 {
407 .ctl_name = NET_IPV4_ICMP_ECHO_IGNORE_ALL,
408 .procname = "icmp_echo_ignore_all",
409 .data = &sysctl_icmp_echo_ignore_all,
410 .maxlen = sizeof(int),
411 .mode = 0644,
412 .proc_handler = &proc_dointvec
413 },
414 {
415 .ctl_name = NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS,
416 .procname = "icmp_echo_ignore_broadcasts",
417 .data = &sysctl_icmp_echo_ignore_broadcasts,
418 .maxlen = sizeof(int),
419 .mode = 0644,
420 .proc_handler = &proc_dointvec
421 },
422 {
423 .ctl_name = NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES,
424 .procname = "icmp_ignore_bogus_error_responses",
425 .data = &sysctl_icmp_ignore_bogus_error_responses,
426 .maxlen = sizeof(int),
427 .mode = 0644,
428 .proc_handler = &proc_dointvec
429 },
430 {
J. Simonetti1c2fb7f2005-06-13 15:19:03 -0700431 .ctl_name = NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR,
432 .procname = "icmp_errors_use_inbound_ifaddr",
433 .data = &sysctl_icmp_errors_use_inbound_ifaddr,
434 .maxlen = sizeof(int),
435 .mode = 0644,
436 .proc_handler = &proc_dointvec
437 },
438 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700439 .ctl_name = NET_IPV4_ROUTE,
440 .procname = "route",
441 .maxlen = 0,
442 .mode = 0555,
443 .child = ipv4_route_table
444 },
445#ifdef CONFIG_IP_MULTICAST
446 {
447 .ctl_name = NET_IPV4_IGMP_MAX_MEMBERSHIPS,
448 .procname = "igmp_max_memberships",
449 .data = &sysctl_igmp_max_memberships,
450 .maxlen = sizeof(int),
451 .mode = 0644,
452 .proc_handler = &proc_dointvec
453 },
454
455#endif
456 {
457 .ctl_name = NET_IPV4_IGMP_MAX_MSF,
458 .procname = "igmp_max_msf",
459 .data = &sysctl_igmp_max_msf,
460 .maxlen = sizeof(int),
461 .mode = 0644,
462 .proc_handler = &proc_dointvec
463 },
464 {
465 .ctl_name = NET_IPV4_INET_PEER_THRESHOLD,
466 .procname = "inet_peer_threshold",
467 .data = &inet_peer_threshold,
468 .maxlen = sizeof(int),
469 .mode = 0644,
470 .proc_handler = &proc_dointvec
471 },
472 {
473 .ctl_name = NET_IPV4_INET_PEER_MINTTL,
474 .procname = "inet_peer_minttl",
475 .data = &inet_peer_minttl,
476 .maxlen = sizeof(int),
477 .mode = 0644,
478 .proc_handler = &proc_dointvec_jiffies,
479 .strategy = &sysctl_jiffies
480 },
481 {
482 .ctl_name = NET_IPV4_INET_PEER_MAXTTL,
483 .procname = "inet_peer_maxttl",
484 .data = &inet_peer_maxttl,
485 .maxlen = sizeof(int),
486 .mode = 0644,
487 .proc_handler = &proc_dointvec_jiffies,
488 .strategy = &sysctl_jiffies
489 },
490 {
491 .ctl_name = NET_IPV4_INET_PEER_GC_MINTIME,
492 .procname = "inet_peer_gc_mintime",
493 .data = &inet_peer_gc_mintime,
494 .maxlen = sizeof(int),
495 .mode = 0644,
496 .proc_handler = &proc_dointvec_jiffies,
497 .strategy = &sysctl_jiffies
498 },
499 {
500 .ctl_name = NET_IPV4_INET_PEER_GC_MAXTIME,
501 .procname = "inet_peer_gc_maxtime",
502 .data = &inet_peer_gc_maxtime,
503 .maxlen = sizeof(int),
504 .mode = 0644,
505 .proc_handler = &proc_dointvec_jiffies,
506 .strategy = &sysctl_jiffies
507 },
508 {
509 .ctl_name = NET_TCP_ORPHAN_RETRIES,
510 .procname = "tcp_orphan_retries",
511 .data = &sysctl_tcp_orphan_retries,
512 .maxlen = sizeof(int),
513 .mode = 0644,
514 .proc_handler = &proc_dointvec
515 },
516 {
517 .ctl_name = NET_TCP_FACK,
518 .procname = "tcp_fack",
519 .data = &sysctl_tcp_fack,
520 .maxlen = sizeof(int),
521 .mode = 0644,
522 .proc_handler = &proc_dointvec
523 },
524 {
525 .ctl_name = NET_TCP_REORDERING,
526 .procname = "tcp_reordering",
527 .data = &sysctl_tcp_reordering,
528 .maxlen = sizeof(int),
529 .mode = 0644,
530 .proc_handler = &proc_dointvec
531 },
532 {
533 .ctl_name = NET_TCP_ECN,
534 .procname = "tcp_ecn",
535 .data = &sysctl_tcp_ecn,
536 .maxlen = sizeof(int),
537 .mode = 0644,
538 .proc_handler = &proc_dointvec
539 },
540 {
541 .ctl_name = NET_TCP_DSACK,
542 .procname = "tcp_dsack",
543 .data = &sysctl_tcp_dsack,
544 .maxlen = sizeof(int),
545 .mode = 0644,
546 .proc_handler = &proc_dointvec
547 },
548 {
549 .ctl_name = NET_TCP_MEM,
550 .procname = "tcp_mem",
551 .data = &sysctl_tcp_mem,
552 .maxlen = sizeof(sysctl_tcp_mem),
553 .mode = 0644,
554 .proc_handler = &proc_dointvec
555 },
556 {
557 .ctl_name = NET_TCP_WMEM,
558 .procname = "tcp_wmem",
559 .data = &sysctl_tcp_wmem,
560 .maxlen = sizeof(sysctl_tcp_wmem),
561 .mode = 0644,
562 .proc_handler = &proc_dointvec
563 },
564 {
565 .ctl_name = NET_TCP_RMEM,
566 .procname = "tcp_rmem",
567 .data = &sysctl_tcp_rmem,
568 .maxlen = sizeof(sysctl_tcp_rmem),
569 .mode = 0644,
570 .proc_handler = &proc_dointvec
571 },
572 {
573 .ctl_name = NET_TCP_APP_WIN,
574 .procname = "tcp_app_win",
575 .data = &sysctl_tcp_app_win,
576 .maxlen = sizeof(int),
577 .mode = 0644,
578 .proc_handler = &proc_dointvec
579 },
580 {
581 .ctl_name = NET_TCP_ADV_WIN_SCALE,
582 .procname = "tcp_adv_win_scale",
583 .data = &sysctl_tcp_adv_win_scale,
584 .maxlen = sizeof(int),
585 .mode = 0644,
586 .proc_handler = &proc_dointvec
587 },
588 {
589 .ctl_name = NET_IPV4_ICMP_RATELIMIT,
590 .procname = "icmp_ratelimit",
591 .data = &sysctl_icmp_ratelimit,
592 .maxlen = sizeof(int),
593 .mode = 0644,
594 .proc_handler = &proc_dointvec
595 },
596 {
597 .ctl_name = NET_IPV4_ICMP_RATEMASK,
598 .procname = "icmp_ratemask",
599 .data = &sysctl_icmp_ratemask,
600 .maxlen = sizeof(int),
601 .mode = 0644,
602 .proc_handler = &proc_dointvec
603 },
604 {
605 .ctl_name = NET_TCP_TW_REUSE,
606 .procname = "tcp_tw_reuse",
607 .data = &sysctl_tcp_tw_reuse,
608 .maxlen = sizeof(int),
609 .mode = 0644,
610 .proc_handler = &proc_dointvec
611 },
612 {
613 .ctl_name = NET_TCP_FRTO,
614 .procname = "tcp_frto",
615 .data = &sysctl_tcp_frto,
616 .maxlen = sizeof(int),
617 .mode = 0644,
618 .proc_handler = &proc_dointvec
619 },
620 {
Ilpo Järvinen3cfe3ba2007-02-27 10:09:49 -0800621 .ctl_name = NET_TCP_FRTO_RESPONSE,
622 .procname = "tcp_frto_response",
623 .data = &sysctl_tcp_frto_response,
624 .maxlen = sizeof(int),
625 .mode = 0644,
626 .proc_handler = &proc_dointvec
627 },
628 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700629 .ctl_name = NET_TCP_LOW_LATENCY,
630 .procname = "tcp_low_latency",
631 .data = &sysctl_tcp_low_latency,
632 .maxlen = sizeof(int),
633 .mode = 0644,
634 .proc_handler = &proc_dointvec
635 },
636 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700637 .ctl_name = NET_TCP_NO_METRICS_SAVE,
638 .procname = "tcp_no_metrics_save",
639 .data = &sysctl_tcp_nometrics_save,
640 .maxlen = sizeof(int),
641 .mode = 0644,
642 .proc_handler = &proc_dointvec,
643 },
644 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700645 .ctl_name = NET_TCP_MODERATE_RCVBUF,
646 .procname = "tcp_moderate_rcvbuf",
647 .data = &sysctl_tcp_moderate_rcvbuf,
648 .maxlen = sizeof(int),
649 .mode = 0644,
650 .proc_handler = &proc_dointvec,
651 },
652 {
653 .ctl_name = NET_TCP_TSO_WIN_DIVISOR,
654 .procname = "tcp_tso_win_divisor",
655 .data = &sysctl_tcp_tso_win_divisor,
656 .maxlen = sizeof(int),
657 .mode = 0644,
658 .proc_handler = &proc_dointvec,
659 },
660 {
Stephen Hemminger317a76f2005-06-23 12:19:55 -0700661 .ctl_name = NET_TCP_CONG_CONTROL,
662 .procname = "tcp_congestion_control",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700663 .mode = 0644,
Stephen Hemminger317a76f2005-06-23 12:19:55 -0700664 .maxlen = TCP_CA_NAME_MAX,
665 .proc_handler = &proc_tcp_congestion_control,
666 .strategy = &sysctl_tcp_congestion_control,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700667 },
Stephen Hemminger9772efb2005-11-10 17:09:53 -0800668 {
669 .ctl_name = NET_TCP_ABC,
670 .procname = "tcp_abc",
671 .data = &sysctl_tcp_abc,
672 .maxlen = sizeof(int),
673 .mode = 0644,
674 .proc_handler = &proc_dointvec,
675 },
John Heffner5d424d52006-03-20 17:53:41 -0800676 {
677 .ctl_name = NET_TCP_MTU_PROBING,
678 .procname = "tcp_mtu_probing",
679 .data = &sysctl_tcp_mtu_probing,
680 .maxlen = sizeof(int),
681 .mode = 0644,
682 .proc_handler = &proc_dointvec,
683 },
684 {
685 .ctl_name = NET_TCP_BASE_MSS,
686 .procname = "tcp_base_mss",
687 .data = &sysctl_tcp_base_mss,
688 .maxlen = sizeof(int),
689 .mode = 0644,
690 .proc_handler = &proc_dointvec,
691 },
YOSHIFUJI Hideakie905a9e2007-02-09 23:24:47 +0900692 {
Rick Jones15d99e02006-03-20 22:40:29 -0800693 .ctl_name = NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS,
694 .procname = "tcp_workaround_signed_windows",
695 .data = &sysctl_tcp_workaround_signed_windows,
696 .maxlen = sizeof(int),
697 .mode = 0644,
698 .proc_handler = &proc_dointvec
699 },
Chris Leech95937822006-05-23 18:02:55 -0700700#ifdef CONFIG_NET_DMA
701 {
702 .ctl_name = NET_TCP_DMA_COPYBREAK,
703 .procname = "tcp_dma_copybreak",
704 .data = &sysctl_tcp_dma_copybreak,
705 .maxlen = sizeof(int),
706 .mode = 0644,
707 .proc_handler = &proc_dointvec
708 },
709#endif
David S. Miller35089bb2006-06-13 22:33:04 -0700710 {
711 .ctl_name = NET_TCP_SLOW_START_AFTER_IDLE,
712 .procname = "tcp_slow_start_after_idle",
713 .data = &sysctl_tcp_slow_start_after_idle,
714 .maxlen = sizeof(int),
715 .mode = 0644,
716 .proc_handler = &proc_dointvec
717 },
Paul Moore446fda42006-08-03 16:48:06 -0700718#ifdef CONFIG_NETLABEL
719 {
720 .ctl_name = NET_CIPSOV4_CACHE_ENABLE,
721 .procname = "cipso_cache_enable",
722 .data = &cipso_v4_cache_enabled,
723 .maxlen = sizeof(int),
724 .mode = 0644,
725 .proc_handler = &proc_dointvec,
726 },
727 {
728 .ctl_name = NET_CIPSOV4_CACHE_BUCKET_SIZE,
729 .procname = "cipso_cache_bucket_size",
730 .data = &cipso_v4_cache_bucketsize,
731 .maxlen = sizeof(int),
732 .mode = 0644,
733 .proc_handler = &proc_dointvec,
734 },
735 {
736 .ctl_name = NET_CIPSOV4_RBM_OPTFMT,
737 .procname = "cipso_rbm_optfmt",
738 .data = &cipso_v4_rbm_optfmt,
739 .maxlen = sizeof(int),
740 .mode = 0644,
741 .proc_handler = &proc_dointvec,
742 },
743 {
744 .ctl_name = NET_CIPSOV4_RBM_STRICTVALID,
745 .procname = "cipso_rbm_strictvalid",
746 .data = &cipso_v4_rbm_strictvalid,
747 .maxlen = sizeof(int),
748 .mode = 0644,
749 .proc_handler = &proc_dointvec,
750 },
751#endif /* CONFIG_NETLABEL */
Stephen Hemminger3ff825b2006-11-09 16:32:06 -0800752 {
Stephen Hemminger3ff825b2006-11-09 16:32:06 -0800753 .procname = "tcp_available_congestion_control",
754 .maxlen = TCP_CA_BUF_MAX,
755 .mode = 0444,
756 .proc_handler = &proc_tcp_available_congestion_control,
757 },
Stephen Hemmingerce7bc3b2006-11-09 16:35:15 -0800758 {
759 .ctl_name = NET_TCP_ALLOWED_CONG_CONTROL,
760 .procname = "tcp_allowed_congestion_control",
761 .maxlen = TCP_CA_BUF_MAX,
762 .mode = 0644,
763 .proc_handler = &proc_allowed_congestion_control,
764 .strategy = &strategy_allowed_congestion_control,
765 },
John Heffner886236c2007-03-25 19:21:45 -0700766 {
767 .ctl_name = NET_TCP_MAX_SSTHRESH,
768 .procname = "tcp_max_ssthresh",
769 .data = &sysctl_tcp_max_ssthresh,
770 .maxlen = sizeof(int),
771 .mode = 0644,
772 .proc_handler = &proc_dointvec,
773 },
Hideo Aoki95766ff2007-12-31 00:29:24 -0800774 {
775 .ctl_name = CTL_UNNUMBERED,
776 .procname = "udp_mem",
777 .data = &sysctl_udp_mem,
778 .maxlen = sizeof(sysctl_udp_mem),
779 .mode = 0644,
780 .proc_handler = &proc_dointvec_minmax,
781 .strategy = &sysctl_intvec,
782 .extra1 = &zero
783 },
784 {
785 .ctl_name = CTL_UNNUMBERED,
786 .procname = "udp_rmem_min",
787 .data = &sysctl_udp_rmem_min,
788 .maxlen = sizeof(sysctl_udp_rmem_min),
789 .mode = 0644,
790 .proc_handler = &proc_dointvec_minmax,
791 .strategy = &sysctl_intvec,
792 .extra1 = &zero
793 },
794 {
795 .ctl_name = CTL_UNNUMBERED,
796 .procname = "udp_wmem_min",
797 .data = &sysctl_udp_wmem_min,
798 .maxlen = sizeof(sysctl_udp_wmem_min),
799 .mode = 0644,
800 .proc_handler = &proc_dointvec_minmax,
801 .strategy = &sysctl_intvec,
802 .extra1 = &zero
803 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700804 { .ctl_name = 0 }
805};
Pavel Emelyanov3e37c3f2007-12-05 01:41:26 -0800806
Pavel Emelyanov3d7cc2b2008-01-09 00:33:11 -0800807struct ctl_path net_ipv4_ctl_path[] = {
Pavel Emelyanov3e37c3f2007-12-05 01:41:26 -0800808 { .procname = "net", .ctl_name = CTL_NET, },
809 { .procname = "ipv4", .ctl_name = NET_IPV4, },
810 { },
811};
Pavel Emelyanov3d7cc2b2008-01-09 00:33:11 -0800812EXPORT_SYMBOL_GPL(net_ipv4_ctl_path);
Pavel Emelyanov3e37c3f2007-12-05 01:41:26 -0800813
814static __init int sysctl_ipv4_init(void)
815{
816 struct ctl_table_header *hdr;
817
Pavel Emelyanov3d7cc2b2008-01-09 00:33:11 -0800818 hdr = register_sysctl_paths(net_ipv4_ctl_path, ipv4_table);
Pavel Emelyanov3e37c3f2007-12-05 01:41:26 -0800819 return hdr == NULL ? -ENOMEM : 0;
820}
821
822__initcall(sysctl_ipv4_init);