blob: eb286abcf5dc7f600e84c1cb43de53e90962fe50 [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>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include <net/snmp.h>
Arnaldo Carvalho de Melo20380732005-08-16 02:18:02 -030017#include <net/icmp.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#include <net/ip.h>
19#include <net/route.h>
20#include <net/tcp.h>
Paul Moore446fda42006-08-03 16:48:06 -070021#include <net/cipso_ipv4.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070022
23/* From af_inet.c */
24extern int sysctl_ip_nonlocal_bind;
25
Linus Torvalds1da177e2005-04-16 15:20:36 -070026#ifdef CONFIG_SYSCTL
Herbert Xu89cee8b2005-12-13 23:14:27 -080027static int zero;
YOSHIFUJI Hideakie905a9e2007-02-09 23:24:47 +090028static int tcp_retr1_max = 255;
Linus Torvalds1da177e2005-04-16 15:20:36 -070029static int ip_local_port_range_min[] = { 1, 1 };
30static int ip_local_port_range_max[] = { 65535, 65535 };
31#endif
32
33struct ipv4_config ipv4_config;
34
Linus Torvalds1da177e2005-04-16 15:20:36 -070035#ifdef CONFIG_SYSCTL
36
37static
38int ipv4_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
39 void __user *buffer, size_t *lenp, loff_t *ppos)
40{
Herbert Xu42f811b2007-06-04 23:34:44 -070041 int val = IPV4_DEVCONF_ALL(FORWARDING);
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 int ret;
43
44 ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
45
Herbert Xu42f811b2007-06-04 23:34:44 -070046 if (write && IPV4_DEVCONF_ALL(FORWARDING) != val)
Linus Torvalds1da177e2005-04-16 15:20:36 -070047 inet_forward_change();
48
49 return ret;
50}
51
52static int ipv4_sysctl_forward_strategy(ctl_table *table,
53 int __user *name, int nlen,
54 void __user *oldval, size_t __user *oldlenp,
Alexey Dobriyan1f29bcd2006-12-10 02:19:10 -080055 void __user *newval, size_t newlen)
Linus Torvalds1da177e2005-04-16 15:20:36 -070056{
57 int *valp = table->data;
58 int new;
59
60 if (!newval || !newlen)
61 return 0;
62
63 if (newlen != sizeof(int))
64 return -EINVAL;
65
66 if (get_user(new, (int __user *)newval))
67 return -EFAULT;
68
69 if (new == *valp)
70 return 0;
71
72 if (oldval && oldlenp) {
73 size_t len;
74
75 if (get_user(len, oldlenp))
76 return -EFAULT;
77
78 if (len) {
79 if (len > table->maxlen)
80 len = table->maxlen;
81 if (copy_to_user(oldval, valp, len))
82 return -EFAULT;
83 if (put_user(len, oldlenp))
84 return -EFAULT;
85 }
86 }
87
88 *valp = new;
89 inet_forward_change();
90 return 1;
91}
92
Stephen Hemminger227b60f2007-10-10 17:30:46 -070093extern seqlock_t sysctl_port_range_lock;
94extern int sysctl_local_port_range[2];
95
96/* Update system visible IP port range */
97static void set_local_port_range(int range[2])
98{
99 write_seqlock(&sysctl_port_range_lock);
100 sysctl_local_port_range[0] = range[0];
101 sysctl_local_port_range[1] = range[1];
102 write_sequnlock(&sysctl_port_range_lock);
103}
104
105/* Validate changes from /proc interface. */
106static int ipv4_local_port_range(ctl_table *table, int write, struct file *filp,
107 void __user *buffer,
108 size_t *lenp, loff_t *ppos)
109{
110 int ret;
111 int range[2] = { sysctl_local_port_range[0],
112 sysctl_local_port_range[1] };
113 ctl_table tmp = {
114 .data = &range,
115 .maxlen = sizeof(range),
116 .mode = table->mode,
117 .extra1 = &ip_local_port_range_min,
118 .extra2 = &ip_local_port_range_max,
119 };
120
121 ret = proc_dointvec_minmax(&tmp, write, filp, buffer, lenp, ppos);
122
123 if (write && ret == 0) {
124 if (range[1] <= range[0])
125 ret = -EINVAL;
126 else
127 set_local_port_range(range);
128 }
129
130 return ret;
131}
132
133/* Validate changes from sysctl interface. */
134static int ipv4_sysctl_local_port_range(ctl_table *table, int __user *name,
135 int nlen, void __user *oldval,
136 size_t __user *oldlenp,
137 void __user *newval, size_t newlen)
138{
139 int ret;
140 int range[2] = { sysctl_local_port_range[0],
141 sysctl_local_port_range[1] };
142 ctl_table tmp = {
143 .data = &range,
144 .maxlen = sizeof(range),
145 .mode = table->mode,
146 .extra1 = &ip_local_port_range_min,
147 .extra2 = &ip_local_port_range_max,
148 };
149
150 ret = sysctl_intvec(&tmp, name, nlen, oldval, oldlenp, newval, newlen);
151 if (ret == 0 && newval && newlen) {
152 if (range[1] <= range[0])
153 ret = -EINVAL;
154 else
155 set_local_port_range(range);
156 }
157 return ret;
158}
159
160
Stephen Hemminger317a76f2005-06-23 12:19:55 -0700161static int proc_tcp_congestion_control(ctl_table *ctl, int write, struct file * filp,
162 void __user *buffer, size_t *lenp, loff_t *ppos)
163{
164 char val[TCP_CA_NAME_MAX];
165 ctl_table tbl = {
166 .data = val,
167 .maxlen = TCP_CA_NAME_MAX,
168 };
169 int ret;
170
171 tcp_get_default_congestion_control(val);
172
173 ret = proc_dostring(&tbl, write, filp, buffer, lenp, ppos);
174 if (write && ret == 0)
175 ret = tcp_set_default_congestion_control(val);
176 return ret;
177}
178
Arnaldo Carvalho de Melo20380732005-08-16 02:18:02 -0300179static int sysctl_tcp_congestion_control(ctl_table *table, int __user *name,
180 int nlen, void __user *oldval,
181 size_t __user *oldlenp,
Alexey Dobriyan1f29bcd2006-12-10 02:19:10 -0800182 void __user *newval, size_t newlen)
Stephen Hemminger317a76f2005-06-23 12:19:55 -0700183{
184 char val[TCP_CA_NAME_MAX];
185 ctl_table tbl = {
186 .data = val,
187 .maxlen = TCP_CA_NAME_MAX,
188 };
189 int ret;
190
191 tcp_get_default_congestion_control(val);
Alexey Dobriyan1f29bcd2006-12-10 02:19:10 -0800192 ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen);
Stephen Hemminger317a76f2005-06-23 12:19:55 -0700193 if (ret == 0 && newval && newlen)
194 ret = tcp_set_default_congestion_control(val);
195 return ret;
196}
197
Stephen Hemminger3ff825b2006-11-09 16:32:06 -0800198static int proc_tcp_available_congestion_control(ctl_table *ctl,
199 int write, struct file * filp,
200 void __user *buffer, size_t *lenp,
201 loff_t *ppos)
202{
203 ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX, };
204 int ret;
205
206 tbl.data = kmalloc(tbl.maxlen, GFP_USER);
207 if (!tbl.data)
208 return -ENOMEM;
209 tcp_get_available_congestion_control(tbl.data, TCP_CA_BUF_MAX);
210 ret = proc_dostring(&tbl, write, filp, buffer, lenp, ppos);
211 kfree(tbl.data);
212 return ret;
213}
214
Stephen Hemmingerce7bc3b2006-11-09 16:35:15 -0800215static int proc_allowed_congestion_control(ctl_table *ctl,
216 int write, struct file * filp,
217 void __user *buffer, size_t *lenp,
218 loff_t *ppos)
219{
220 ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX };
221 int ret;
222
223 tbl.data = kmalloc(tbl.maxlen, GFP_USER);
224 if (!tbl.data)
225 return -ENOMEM;
226
227 tcp_get_allowed_congestion_control(tbl.data, tbl.maxlen);
228 ret = proc_dostring(&tbl, write, filp, buffer, lenp, ppos);
229 if (write && ret == 0)
230 ret = tcp_set_allowed_congestion_control(tbl.data);
231 kfree(tbl.data);
232 return ret;
233}
234
235static int strategy_allowed_congestion_control(ctl_table *table, int __user *name,
236 int nlen, void __user *oldval,
237 size_t __user *oldlenp,
Alexey Dobriyan1f29bcd2006-12-10 02:19:10 -0800238 void __user *newval,
239 size_t newlen)
Stephen Hemmingerce7bc3b2006-11-09 16:35:15 -0800240{
241 ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX };
242 int ret;
243
244 tbl.data = kmalloc(tbl.maxlen, GFP_USER);
245 if (!tbl.data)
246 return -ENOMEM;
247
248 tcp_get_available_congestion_control(tbl.data, tbl.maxlen);
Alexey Dobriyan1f29bcd2006-12-10 02:19:10 -0800249 ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen);
Stephen Hemmingerce7bc3b2006-11-09 16:35:15 -0800250 if (ret == 0 && newval && newlen)
251 ret = tcp_set_allowed_congestion_control(tbl.data);
252 kfree(tbl.data);
253
254 return ret;
255
256}
257
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258ctl_table ipv4_table[] = {
YOSHIFUJI Hideakie905a9e2007-02-09 23:24:47 +0900259 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700260 .ctl_name = NET_IPV4_TCP_TIMESTAMPS,
261 .procname = "tcp_timestamps",
262 .data = &sysctl_tcp_timestamps,
263 .maxlen = sizeof(int),
264 .mode = 0644,
265 .proc_handler = &proc_dointvec
266 },
YOSHIFUJI Hideakie905a9e2007-02-09 23:24:47 +0900267 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268 .ctl_name = NET_IPV4_TCP_WINDOW_SCALING,
269 .procname = "tcp_window_scaling",
270 .data = &sysctl_tcp_window_scaling,
271 .maxlen = sizeof(int),
272 .mode = 0644,
273 .proc_handler = &proc_dointvec
274 },
YOSHIFUJI Hideakie905a9e2007-02-09 23:24:47 +0900275 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276 .ctl_name = NET_IPV4_TCP_SACK,
277 .procname = "tcp_sack",
278 .data = &sysctl_tcp_sack,
279 .maxlen = sizeof(int),
280 .mode = 0644,
281 .proc_handler = &proc_dointvec
282 },
YOSHIFUJI Hideakie905a9e2007-02-09 23:24:47 +0900283 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700284 .ctl_name = NET_IPV4_TCP_RETRANS_COLLAPSE,
285 .procname = "tcp_retrans_collapse",
286 .data = &sysctl_tcp_retrans_collapse,
287 .maxlen = sizeof(int),
288 .mode = 0644,
289 .proc_handler = &proc_dointvec
290 },
YOSHIFUJI Hideakie905a9e2007-02-09 23:24:47 +0900291 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700292 .ctl_name = NET_IPV4_FORWARD,
293 .procname = "ip_forward",
Herbert Xu42f811b2007-06-04 23:34:44 -0700294 .data = &IPV4_DEVCONF_ALL(FORWARDING),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700295 .maxlen = sizeof(int),
296 .mode = 0644,
297 .proc_handler = &ipv4_sysctl_forward,
298 .strategy = &ipv4_sysctl_forward_strategy
299 },
YOSHIFUJI Hideakie905a9e2007-02-09 23:24:47 +0900300 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700301 .ctl_name = NET_IPV4_DEFAULT_TTL,
302 .procname = "ip_default_ttl",
YOSHIFUJI Hideakie905a9e2007-02-09 23:24:47 +0900303 .data = &sysctl_ip_default_ttl,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700304 .maxlen = sizeof(int),
305 .mode = 0644,
306 .proc_handler = &ipv4_doint_and_flush,
307 .strategy = &ipv4_doint_and_flush_strategy,
308 },
YOSHIFUJI Hideakie905a9e2007-02-09 23:24:47 +0900309 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700310 .ctl_name = NET_IPV4_NO_PMTU_DISC,
311 .procname = "ip_no_pmtu_disc",
312 .data = &ipv4_config.no_pmtu_disc,
313 .maxlen = sizeof(int),
314 .mode = 0644,
315 .proc_handler = &proc_dointvec
316 },
317 {
318 .ctl_name = NET_IPV4_NONLOCAL_BIND,
319 .procname = "ip_nonlocal_bind",
320 .data = &sysctl_ip_nonlocal_bind,
321 .maxlen = sizeof(int),
322 .mode = 0644,
323 .proc_handler = &proc_dointvec
324 },
325 {
326 .ctl_name = NET_IPV4_TCP_SYN_RETRIES,
327 .procname = "tcp_syn_retries",
328 .data = &sysctl_tcp_syn_retries,
329 .maxlen = sizeof(int),
330 .mode = 0644,
331 .proc_handler = &proc_dointvec
332 },
333 {
334 .ctl_name = NET_TCP_SYNACK_RETRIES,
335 .procname = "tcp_synack_retries",
336 .data = &sysctl_tcp_synack_retries,
337 .maxlen = sizeof(int),
338 .mode = 0644,
339 .proc_handler = &proc_dointvec
340 },
341 {
342 .ctl_name = NET_TCP_MAX_ORPHANS,
343 .procname = "tcp_max_orphans",
344 .data = &sysctl_tcp_max_orphans,
345 .maxlen = sizeof(int),
346 .mode = 0644,
347 .proc_handler = &proc_dointvec
348 },
349 {
350 .ctl_name = NET_TCP_MAX_TW_BUCKETS,
351 .procname = "tcp_max_tw_buckets",
Arnaldo Carvalho de Melo295ff7e2005-08-09 20:44:40 -0700352 .data = &tcp_death_row.sysctl_max_tw_buckets,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700353 .maxlen = sizeof(int),
354 .mode = 0644,
355 .proc_handler = &proc_dointvec
356 },
357 {
358 .ctl_name = NET_IPV4_IPFRAG_HIGH_THRESH,
359 .procname = "ipfrag_high_thresh",
360 .data = &sysctl_ipfrag_high_thresh,
361 .maxlen = sizeof(int),
362 .mode = 0644,
363 .proc_handler = &proc_dointvec
364 },
365 {
366 .ctl_name = NET_IPV4_IPFRAG_LOW_THRESH,
367 .procname = "ipfrag_low_thresh",
368 .data = &sysctl_ipfrag_low_thresh,
369 .maxlen = sizeof(int),
370 .mode = 0644,
371 .proc_handler = &proc_dointvec
372 },
373 {
374 .ctl_name = NET_IPV4_DYNADDR,
375 .procname = "ip_dynaddr",
376 .data = &sysctl_ip_dynaddr,
377 .maxlen = sizeof(int),
378 .mode = 0644,
379 .proc_handler = &proc_dointvec
380 },
381 {
382 .ctl_name = NET_IPV4_IPFRAG_TIME,
383 .procname = "ipfrag_time",
384 .data = &sysctl_ipfrag_time,
385 .maxlen = sizeof(int),
386 .mode = 0644,
387 .proc_handler = &proc_dointvec_jiffies,
388 .strategy = &sysctl_jiffies
389 },
390 {
391 .ctl_name = NET_IPV4_TCP_KEEPALIVE_TIME,
392 .procname = "tcp_keepalive_time",
393 .data = &sysctl_tcp_keepalive_time,
394 .maxlen = sizeof(int),
395 .mode = 0644,
396 .proc_handler = &proc_dointvec_jiffies,
397 .strategy = &sysctl_jiffies
398 },
399 {
400 .ctl_name = NET_IPV4_TCP_KEEPALIVE_PROBES,
401 .procname = "tcp_keepalive_probes",
402 .data = &sysctl_tcp_keepalive_probes,
403 .maxlen = sizeof(int),
404 .mode = 0644,
405 .proc_handler = &proc_dointvec
406 },
407 {
408 .ctl_name = NET_IPV4_TCP_KEEPALIVE_INTVL,
409 .procname = "tcp_keepalive_intvl",
410 .data = &sysctl_tcp_keepalive_intvl,
411 .maxlen = sizeof(int),
412 .mode = 0644,
413 .proc_handler = &proc_dointvec_jiffies,
414 .strategy = &sysctl_jiffies
415 },
416 {
417 .ctl_name = NET_IPV4_TCP_RETRIES1,
418 .procname = "tcp_retries1",
419 .data = &sysctl_tcp_retries1,
420 .maxlen = sizeof(int),
421 .mode = 0644,
422 .proc_handler = &proc_dointvec_minmax,
423 .strategy = &sysctl_intvec,
424 .extra2 = &tcp_retr1_max
425 },
426 {
427 .ctl_name = NET_IPV4_TCP_RETRIES2,
428 .procname = "tcp_retries2",
429 .data = &sysctl_tcp_retries2,
430 .maxlen = sizeof(int),
431 .mode = 0644,
432 .proc_handler = &proc_dointvec
433 },
434 {
435 .ctl_name = NET_IPV4_TCP_FIN_TIMEOUT,
436 .procname = "tcp_fin_timeout",
437 .data = &sysctl_tcp_fin_timeout,
438 .maxlen = sizeof(int),
439 .mode = 0644,
440 .proc_handler = &proc_dointvec_jiffies,
441 .strategy = &sysctl_jiffies
442 },
443#ifdef CONFIG_SYN_COOKIES
444 {
445 .ctl_name = NET_TCP_SYNCOOKIES,
446 .procname = "tcp_syncookies",
447 .data = &sysctl_tcp_syncookies,
448 .maxlen = sizeof(int),
449 .mode = 0644,
450 .proc_handler = &proc_dointvec
451 },
452#endif
453 {
454 .ctl_name = NET_TCP_TW_RECYCLE,
455 .procname = "tcp_tw_recycle",
Arnaldo Carvalho de Melo295ff7e2005-08-09 20:44:40 -0700456 .data = &tcp_death_row.sysctl_tw_recycle,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700457 .maxlen = sizeof(int),
458 .mode = 0644,
459 .proc_handler = &proc_dointvec
460 },
461 {
462 .ctl_name = NET_TCP_ABORT_ON_OVERFLOW,
463 .procname = "tcp_abort_on_overflow",
464 .data = &sysctl_tcp_abort_on_overflow,
465 .maxlen = sizeof(int),
466 .mode = 0644,
467 .proc_handler = &proc_dointvec
468 },
469 {
470 .ctl_name = NET_TCP_STDURG,
471 .procname = "tcp_stdurg",
472 .data = &sysctl_tcp_stdurg,
473 .maxlen = sizeof(int),
474 .mode = 0644,
475 .proc_handler = &proc_dointvec
476 },
477 {
478 .ctl_name = NET_TCP_RFC1337,
479 .procname = "tcp_rfc1337",
480 .data = &sysctl_tcp_rfc1337,
481 .maxlen = sizeof(int),
482 .mode = 0644,
483 .proc_handler = &proc_dointvec
484 },
485 {
486 .ctl_name = NET_TCP_MAX_SYN_BACKLOG,
487 .procname = "tcp_max_syn_backlog",
488 .data = &sysctl_max_syn_backlog,
489 .maxlen = sizeof(int),
490 .mode = 0644,
491 .proc_handler = &proc_dointvec
492 },
493 {
494 .ctl_name = NET_IPV4_LOCAL_PORT_RANGE,
495 .procname = "ip_local_port_range",
496 .data = &sysctl_local_port_range,
497 .maxlen = sizeof(sysctl_local_port_range),
498 .mode = 0644,
Stephen Hemminger227b60f2007-10-10 17:30:46 -0700499 .proc_handler = &ipv4_local_port_range,
500 .strategy = &ipv4_sysctl_local_port_range,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700501 },
502 {
503 .ctl_name = NET_IPV4_ICMP_ECHO_IGNORE_ALL,
504 .procname = "icmp_echo_ignore_all",
505 .data = &sysctl_icmp_echo_ignore_all,
506 .maxlen = sizeof(int),
507 .mode = 0644,
508 .proc_handler = &proc_dointvec
509 },
510 {
511 .ctl_name = NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS,
512 .procname = "icmp_echo_ignore_broadcasts",
513 .data = &sysctl_icmp_echo_ignore_broadcasts,
514 .maxlen = sizeof(int),
515 .mode = 0644,
516 .proc_handler = &proc_dointvec
517 },
518 {
519 .ctl_name = NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES,
520 .procname = "icmp_ignore_bogus_error_responses",
521 .data = &sysctl_icmp_ignore_bogus_error_responses,
522 .maxlen = sizeof(int),
523 .mode = 0644,
524 .proc_handler = &proc_dointvec
525 },
526 {
J. Simonetti1c2fb7f2005-06-13 15:19:03 -0700527 .ctl_name = NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR,
528 .procname = "icmp_errors_use_inbound_ifaddr",
529 .data = &sysctl_icmp_errors_use_inbound_ifaddr,
530 .maxlen = sizeof(int),
531 .mode = 0644,
532 .proc_handler = &proc_dointvec
533 },
534 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700535 .ctl_name = NET_IPV4_ROUTE,
536 .procname = "route",
537 .maxlen = 0,
538 .mode = 0555,
539 .child = ipv4_route_table
540 },
541#ifdef CONFIG_IP_MULTICAST
542 {
543 .ctl_name = NET_IPV4_IGMP_MAX_MEMBERSHIPS,
544 .procname = "igmp_max_memberships",
545 .data = &sysctl_igmp_max_memberships,
546 .maxlen = sizeof(int),
547 .mode = 0644,
548 .proc_handler = &proc_dointvec
549 },
550
551#endif
552 {
553 .ctl_name = NET_IPV4_IGMP_MAX_MSF,
554 .procname = "igmp_max_msf",
555 .data = &sysctl_igmp_max_msf,
556 .maxlen = sizeof(int),
557 .mode = 0644,
558 .proc_handler = &proc_dointvec
559 },
560 {
561 .ctl_name = NET_IPV4_INET_PEER_THRESHOLD,
562 .procname = "inet_peer_threshold",
563 .data = &inet_peer_threshold,
564 .maxlen = sizeof(int),
565 .mode = 0644,
566 .proc_handler = &proc_dointvec
567 },
568 {
569 .ctl_name = NET_IPV4_INET_PEER_MINTTL,
570 .procname = "inet_peer_minttl",
571 .data = &inet_peer_minttl,
572 .maxlen = sizeof(int),
573 .mode = 0644,
574 .proc_handler = &proc_dointvec_jiffies,
575 .strategy = &sysctl_jiffies
576 },
577 {
578 .ctl_name = NET_IPV4_INET_PEER_MAXTTL,
579 .procname = "inet_peer_maxttl",
580 .data = &inet_peer_maxttl,
581 .maxlen = sizeof(int),
582 .mode = 0644,
583 .proc_handler = &proc_dointvec_jiffies,
584 .strategy = &sysctl_jiffies
585 },
586 {
587 .ctl_name = NET_IPV4_INET_PEER_GC_MINTIME,
588 .procname = "inet_peer_gc_mintime",
589 .data = &inet_peer_gc_mintime,
590 .maxlen = sizeof(int),
591 .mode = 0644,
592 .proc_handler = &proc_dointvec_jiffies,
593 .strategy = &sysctl_jiffies
594 },
595 {
596 .ctl_name = NET_IPV4_INET_PEER_GC_MAXTIME,
597 .procname = "inet_peer_gc_maxtime",
598 .data = &inet_peer_gc_maxtime,
599 .maxlen = sizeof(int),
600 .mode = 0644,
601 .proc_handler = &proc_dointvec_jiffies,
602 .strategy = &sysctl_jiffies
603 },
604 {
605 .ctl_name = NET_TCP_ORPHAN_RETRIES,
606 .procname = "tcp_orphan_retries",
607 .data = &sysctl_tcp_orphan_retries,
608 .maxlen = sizeof(int),
609 .mode = 0644,
610 .proc_handler = &proc_dointvec
611 },
612 {
613 .ctl_name = NET_TCP_FACK,
614 .procname = "tcp_fack",
615 .data = &sysctl_tcp_fack,
616 .maxlen = sizeof(int),
617 .mode = 0644,
618 .proc_handler = &proc_dointvec
619 },
620 {
621 .ctl_name = NET_TCP_REORDERING,
622 .procname = "tcp_reordering",
623 .data = &sysctl_tcp_reordering,
624 .maxlen = sizeof(int),
625 .mode = 0644,
626 .proc_handler = &proc_dointvec
627 },
628 {
629 .ctl_name = NET_TCP_ECN,
630 .procname = "tcp_ecn",
631 .data = &sysctl_tcp_ecn,
632 .maxlen = sizeof(int),
633 .mode = 0644,
634 .proc_handler = &proc_dointvec
635 },
636 {
637 .ctl_name = NET_TCP_DSACK,
638 .procname = "tcp_dsack",
639 .data = &sysctl_tcp_dsack,
640 .maxlen = sizeof(int),
641 .mode = 0644,
642 .proc_handler = &proc_dointvec
643 },
644 {
645 .ctl_name = NET_TCP_MEM,
646 .procname = "tcp_mem",
647 .data = &sysctl_tcp_mem,
648 .maxlen = sizeof(sysctl_tcp_mem),
649 .mode = 0644,
650 .proc_handler = &proc_dointvec
651 },
652 {
653 .ctl_name = NET_TCP_WMEM,
654 .procname = "tcp_wmem",
655 .data = &sysctl_tcp_wmem,
656 .maxlen = sizeof(sysctl_tcp_wmem),
657 .mode = 0644,
658 .proc_handler = &proc_dointvec
659 },
660 {
661 .ctl_name = NET_TCP_RMEM,
662 .procname = "tcp_rmem",
663 .data = &sysctl_tcp_rmem,
664 .maxlen = sizeof(sysctl_tcp_rmem),
665 .mode = 0644,
666 .proc_handler = &proc_dointvec
667 },
668 {
669 .ctl_name = NET_TCP_APP_WIN,
670 .procname = "tcp_app_win",
671 .data = &sysctl_tcp_app_win,
672 .maxlen = sizeof(int),
673 .mode = 0644,
674 .proc_handler = &proc_dointvec
675 },
676 {
677 .ctl_name = NET_TCP_ADV_WIN_SCALE,
678 .procname = "tcp_adv_win_scale",
679 .data = &sysctl_tcp_adv_win_scale,
680 .maxlen = sizeof(int),
681 .mode = 0644,
682 .proc_handler = &proc_dointvec
683 },
684 {
685 .ctl_name = NET_IPV4_ICMP_RATELIMIT,
686 .procname = "icmp_ratelimit",
687 .data = &sysctl_icmp_ratelimit,
688 .maxlen = sizeof(int),
689 .mode = 0644,
690 .proc_handler = &proc_dointvec
691 },
692 {
693 .ctl_name = NET_IPV4_ICMP_RATEMASK,
694 .procname = "icmp_ratemask",
695 .data = &sysctl_icmp_ratemask,
696 .maxlen = sizeof(int),
697 .mode = 0644,
698 .proc_handler = &proc_dointvec
699 },
700 {
701 .ctl_name = NET_TCP_TW_REUSE,
702 .procname = "tcp_tw_reuse",
703 .data = &sysctl_tcp_tw_reuse,
704 .maxlen = sizeof(int),
705 .mode = 0644,
706 .proc_handler = &proc_dointvec
707 },
708 {
709 .ctl_name = NET_TCP_FRTO,
710 .procname = "tcp_frto",
711 .data = &sysctl_tcp_frto,
712 .maxlen = sizeof(int),
713 .mode = 0644,
714 .proc_handler = &proc_dointvec
715 },
716 {
Ilpo Järvinen3cfe3ba2007-02-27 10:09:49 -0800717 .ctl_name = NET_TCP_FRTO_RESPONSE,
718 .procname = "tcp_frto_response",
719 .data = &sysctl_tcp_frto_response,
720 .maxlen = sizeof(int),
721 .mode = 0644,
722 .proc_handler = &proc_dointvec
723 },
724 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700725 .ctl_name = NET_TCP_LOW_LATENCY,
726 .procname = "tcp_low_latency",
727 .data = &sysctl_tcp_low_latency,
728 .maxlen = sizeof(int),
729 .mode = 0644,
730 .proc_handler = &proc_dointvec
731 },
732 {
733 .ctl_name = NET_IPV4_IPFRAG_SECRET_INTERVAL,
734 .procname = "ipfrag_secret_interval",
735 .data = &sysctl_ipfrag_secret_interval,
736 .maxlen = sizeof(int),
737 .mode = 0644,
738 .proc_handler = &proc_dointvec_jiffies,
739 .strategy = &sysctl_jiffies
740 },
741 {
Herbert Xu89cee8b2005-12-13 23:14:27 -0800742 .ctl_name = NET_IPV4_IPFRAG_MAX_DIST,
743 .procname = "ipfrag_max_dist",
744 .data = &sysctl_ipfrag_max_dist,
745 .maxlen = sizeof(int),
746 .mode = 0644,
747 .proc_handler = &proc_dointvec_minmax,
748 .extra1 = &zero
749 },
750 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700751 .ctl_name = NET_TCP_NO_METRICS_SAVE,
752 .procname = "tcp_no_metrics_save",
753 .data = &sysctl_tcp_nometrics_save,
754 .maxlen = sizeof(int),
755 .mode = 0644,
756 .proc_handler = &proc_dointvec,
757 },
758 {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700759 .ctl_name = NET_TCP_MODERATE_RCVBUF,
760 .procname = "tcp_moderate_rcvbuf",
761 .data = &sysctl_tcp_moderate_rcvbuf,
762 .maxlen = sizeof(int),
763 .mode = 0644,
764 .proc_handler = &proc_dointvec,
765 },
766 {
767 .ctl_name = NET_TCP_TSO_WIN_DIVISOR,
768 .procname = "tcp_tso_win_divisor",
769 .data = &sysctl_tcp_tso_win_divisor,
770 .maxlen = sizeof(int),
771 .mode = 0644,
772 .proc_handler = &proc_dointvec,
773 },
774 {
Stephen Hemminger317a76f2005-06-23 12:19:55 -0700775 .ctl_name = NET_TCP_CONG_CONTROL,
776 .procname = "tcp_congestion_control",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700777 .mode = 0644,
Stephen Hemminger317a76f2005-06-23 12:19:55 -0700778 .maxlen = TCP_CA_NAME_MAX,
779 .proc_handler = &proc_tcp_congestion_control,
780 .strategy = &sysctl_tcp_congestion_control,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700781 },
Stephen Hemminger9772efb2005-11-10 17:09:53 -0800782 {
783 .ctl_name = NET_TCP_ABC,
784 .procname = "tcp_abc",
785 .data = &sysctl_tcp_abc,
786 .maxlen = sizeof(int),
787 .mode = 0644,
788 .proc_handler = &proc_dointvec,
789 },
John Heffner5d424d52006-03-20 17:53:41 -0800790 {
791 .ctl_name = NET_TCP_MTU_PROBING,
792 .procname = "tcp_mtu_probing",
793 .data = &sysctl_tcp_mtu_probing,
794 .maxlen = sizeof(int),
795 .mode = 0644,
796 .proc_handler = &proc_dointvec,
797 },
798 {
799 .ctl_name = NET_TCP_BASE_MSS,
800 .procname = "tcp_base_mss",
801 .data = &sysctl_tcp_base_mss,
802 .maxlen = sizeof(int),
803 .mode = 0644,
804 .proc_handler = &proc_dointvec,
805 },
YOSHIFUJI Hideakie905a9e2007-02-09 23:24:47 +0900806 {
Rick Jones15d99e02006-03-20 22:40:29 -0800807 .ctl_name = NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS,
808 .procname = "tcp_workaround_signed_windows",
809 .data = &sysctl_tcp_workaround_signed_windows,
810 .maxlen = sizeof(int),
811 .mode = 0644,
812 .proc_handler = &proc_dointvec
813 },
Chris Leech95937822006-05-23 18:02:55 -0700814#ifdef CONFIG_NET_DMA
815 {
816 .ctl_name = NET_TCP_DMA_COPYBREAK,
817 .procname = "tcp_dma_copybreak",
818 .data = &sysctl_tcp_dma_copybreak,
819 .maxlen = sizeof(int),
820 .mode = 0644,
821 .proc_handler = &proc_dointvec
822 },
823#endif
David S. Miller35089bb2006-06-13 22:33:04 -0700824 {
825 .ctl_name = NET_TCP_SLOW_START_AFTER_IDLE,
826 .procname = "tcp_slow_start_after_idle",
827 .data = &sysctl_tcp_slow_start_after_idle,
828 .maxlen = sizeof(int),
829 .mode = 0644,
830 .proc_handler = &proc_dointvec
831 },
Paul Moore446fda42006-08-03 16:48:06 -0700832#ifdef CONFIG_NETLABEL
833 {
834 .ctl_name = NET_CIPSOV4_CACHE_ENABLE,
835 .procname = "cipso_cache_enable",
836 .data = &cipso_v4_cache_enabled,
837 .maxlen = sizeof(int),
838 .mode = 0644,
839 .proc_handler = &proc_dointvec,
840 },
841 {
842 .ctl_name = NET_CIPSOV4_CACHE_BUCKET_SIZE,
843 .procname = "cipso_cache_bucket_size",
844 .data = &cipso_v4_cache_bucketsize,
845 .maxlen = sizeof(int),
846 .mode = 0644,
847 .proc_handler = &proc_dointvec,
848 },
849 {
850 .ctl_name = NET_CIPSOV4_RBM_OPTFMT,
851 .procname = "cipso_rbm_optfmt",
852 .data = &cipso_v4_rbm_optfmt,
853 .maxlen = sizeof(int),
854 .mode = 0644,
855 .proc_handler = &proc_dointvec,
856 },
857 {
858 .ctl_name = NET_CIPSOV4_RBM_STRICTVALID,
859 .procname = "cipso_rbm_strictvalid",
860 .data = &cipso_v4_rbm_strictvalid,
861 .maxlen = sizeof(int),
862 .mode = 0644,
863 .proc_handler = &proc_dointvec,
864 },
865#endif /* CONFIG_NETLABEL */
Stephen Hemminger3ff825b2006-11-09 16:32:06 -0800866 {
867 .ctl_name = NET_TCP_AVAIL_CONG_CONTROL,
868 .procname = "tcp_available_congestion_control",
869 .maxlen = TCP_CA_BUF_MAX,
870 .mode = 0444,
871 .proc_handler = &proc_tcp_available_congestion_control,
872 },
Stephen Hemmingerce7bc3b2006-11-09 16:35:15 -0800873 {
874 .ctl_name = NET_TCP_ALLOWED_CONG_CONTROL,
875 .procname = "tcp_allowed_congestion_control",
876 .maxlen = TCP_CA_BUF_MAX,
877 .mode = 0644,
878 .proc_handler = &proc_allowed_congestion_control,
879 .strategy = &strategy_allowed_congestion_control,
880 },
John Heffner886236c2007-03-25 19:21:45 -0700881 {
882 .ctl_name = NET_TCP_MAX_SSTHRESH,
883 .procname = "tcp_max_ssthresh",
884 .data = &sysctl_tcp_max_ssthresh,
885 .maxlen = sizeof(int),
886 .mode = 0644,
887 .proc_handler = &proc_dointvec,
888 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700889 { .ctl_name = 0 }
890};
891
892#endif /* CONFIG_SYSCTL */
893
894EXPORT_SYMBOL(ipv4_config);