[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / net / ipv4 / sysctl_net_ipv4.c
blob3aafb298c1c19691e26a2a599f53b8e7de4214f3
1 /*
2 * sysctl_net_ipv4.c: sysctl interface to net IPV4 subsystem.
4 * $Id: sysctl_net_ipv4.c,v 1.50 2001/10/20 00:00:11 davem Exp $
6 * Begun April 1, 1996, Mike Shaver.
7 * Added /proc/sys/net/ipv4 directory entry (empty =) ). [MS]
8 */
10 #include <linux/mm.h>
11 #include <linux/module.h>
12 #include <linux/sysctl.h>
13 #include <linux/config.h>
14 #include <net/snmp.h>
15 #include <net/ip.h>
16 #include <net/route.h>
17 #include <net/tcp.h>
19 /* From af_inet.c */
20 extern int sysctl_ip_nonlocal_bind;
22 /* From icmp.c */
23 extern int sysctl_icmp_echo_ignore_all;
24 extern int sysctl_icmp_echo_ignore_broadcasts;
25 extern int sysctl_icmp_ignore_bogus_error_responses;
27 /* From ip_fragment.c */
28 extern int sysctl_ipfrag_low_thresh;
29 extern int sysctl_ipfrag_high_thresh;
30 extern int sysctl_ipfrag_time;
31 extern int sysctl_ipfrag_secret_interval;
33 /* From ip_output.c */
34 extern int sysctl_ip_dynaddr;
36 /* From icmp.c */
37 extern int sysctl_icmp_ratelimit;
38 extern int sysctl_icmp_ratemask;
40 /* From igmp.c */
41 extern int sysctl_igmp_max_memberships;
42 extern int sysctl_igmp_max_msf;
44 /* From inetpeer.c */
45 extern int inet_peer_threshold;
46 extern int inet_peer_minttl;
47 extern int inet_peer_maxttl;
48 extern int inet_peer_gc_mintime;
49 extern int inet_peer_gc_maxtime;
51 #ifdef CONFIG_SYSCTL
52 static int tcp_retr1_max = 255;
53 static int ip_local_port_range_min[] = { 1, 1 };
54 static int ip_local_port_range_max[] = { 65535, 65535 };
55 #endif
57 struct ipv4_config ipv4_config;
59 extern ctl_table ipv4_route_table[];
61 #ifdef CONFIG_SYSCTL
63 static
64 int ipv4_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
65 void __user *buffer, size_t *lenp, loff_t *ppos)
67 int val = ipv4_devconf.forwarding;
68 int ret;
70 ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
72 if (write && ipv4_devconf.forwarding != val)
73 inet_forward_change();
75 return ret;
78 static int ipv4_sysctl_forward_strategy(ctl_table *table,
79 int __user *name, int nlen,
80 void __user *oldval, size_t __user *oldlenp,
81 void __user *newval, size_t newlen,
82 void **context)
84 int *valp = table->data;
85 int new;
87 if (!newval || !newlen)
88 return 0;
90 if (newlen != sizeof(int))
91 return -EINVAL;
93 if (get_user(new, (int __user *)newval))
94 return -EFAULT;
96 if (new == *valp)
97 return 0;
99 if (oldval && oldlenp) {
100 size_t len;
102 if (get_user(len, oldlenp))
103 return -EFAULT;
105 if (len) {
106 if (len > table->maxlen)
107 len = table->maxlen;
108 if (copy_to_user(oldval, valp, len))
109 return -EFAULT;
110 if (put_user(len, oldlenp))
111 return -EFAULT;
115 *valp = new;
116 inet_forward_change();
117 return 1;
120 ctl_table ipv4_table[] = {
122 .ctl_name = NET_IPV4_TCP_TIMESTAMPS,
123 .procname = "tcp_timestamps",
124 .data = &sysctl_tcp_timestamps,
125 .maxlen = sizeof(int),
126 .mode = 0644,
127 .proc_handler = &proc_dointvec
130 .ctl_name = NET_IPV4_TCP_WINDOW_SCALING,
131 .procname = "tcp_window_scaling",
132 .data = &sysctl_tcp_window_scaling,
133 .maxlen = sizeof(int),
134 .mode = 0644,
135 .proc_handler = &proc_dointvec
138 .ctl_name = NET_IPV4_TCP_SACK,
139 .procname = "tcp_sack",
140 .data = &sysctl_tcp_sack,
141 .maxlen = sizeof(int),
142 .mode = 0644,
143 .proc_handler = &proc_dointvec
146 .ctl_name = NET_IPV4_TCP_RETRANS_COLLAPSE,
147 .procname = "tcp_retrans_collapse",
148 .data = &sysctl_tcp_retrans_collapse,
149 .maxlen = sizeof(int),
150 .mode = 0644,
151 .proc_handler = &proc_dointvec
154 .ctl_name = NET_IPV4_FORWARD,
155 .procname = "ip_forward",
156 .data = &ipv4_devconf.forwarding,
157 .maxlen = sizeof(int),
158 .mode = 0644,
159 .proc_handler = &ipv4_sysctl_forward,
160 .strategy = &ipv4_sysctl_forward_strategy
163 .ctl_name = NET_IPV4_DEFAULT_TTL,
164 .procname = "ip_default_ttl",
165 .data = &sysctl_ip_default_ttl,
166 .maxlen = sizeof(int),
167 .mode = 0644,
168 .proc_handler = &ipv4_doint_and_flush,
169 .strategy = &ipv4_doint_and_flush_strategy,
172 .ctl_name = NET_IPV4_AUTOCONFIG,
173 .procname = "ip_autoconfig",
174 .data = &ipv4_config.autoconfig,
175 .maxlen = sizeof(int),
176 .mode = 0644,
177 .proc_handler = &proc_dointvec
180 .ctl_name = NET_IPV4_NO_PMTU_DISC,
181 .procname = "ip_no_pmtu_disc",
182 .data = &ipv4_config.no_pmtu_disc,
183 .maxlen = sizeof(int),
184 .mode = 0644,
185 .proc_handler = &proc_dointvec
188 .ctl_name = NET_IPV4_NONLOCAL_BIND,
189 .procname = "ip_nonlocal_bind",
190 .data = &sysctl_ip_nonlocal_bind,
191 .maxlen = sizeof(int),
192 .mode = 0644,
193 .proc_handler = &proc_dointvec
196 .ctl_name = NET_IPV4_TCP_SYN_RETRIES,
197 .procname = "tcp_syn_retries",
198 .data = &sysctl_tcp_syn_retries,
199 .maxlen = sizeof(int),
200 .mode = 0644,
201 .proc_handler = &proc_dointvec
204 .ctl_name = NET_TCP_SYNACK_RETRIES,
205 .procname = "tcp_synack_retries",
206 .data = &sysctl_tcp_synack_retries,
207 .maxlen = sizeof(int),
208 .mode = 0644,
209 .proc_handler = &proc_dointvec
212 .ctl_name = NET_TCP_MAX_ORPHANS,
213 .procname = "tcp_max_orphans",
214 .data = &sysctl_tcp_max_orphans,
215 .maxlen = sizeof(int),
216 .mode = 0644,
217 .proc_handler = &proc_dointvec
220 .ctl_name = NET_TCP_MAX_TW_BUCKETS,
221 .procname = "tcp_max_tw_buckets",
222 .data = &sysctl_tcp_max_tw_buckets,
223 .maxlen = sizeof(int),
224 .mode = 0644,
225 .proc_handler = &proc_dointvec
228 .ctl_name = NET_IPV4_IPFRAG_HIGH_THRESH,
229 .procname = "ipfrag_high_thresh",
230 .data = &sysctl_ipfrag_high_thresh,
231 .maxlen = sizeof(int),
232 .mode = 0644,
233 .proc_handler = &proc_dointvec
236 .ctl_name = NET_IPV4_IPFRAG_LOW_THRESH,
237 .procname = "ipfrag_low_thresh",
238 .data = &sysctl_ipfrag_low_thresh,
239 .maxlen = sizeof(int),
240 .mode = 0644,
241 .proc_handler = &proc_dointvec
244 .ctl_name = NET_IPV4_DYNADDR,
245 .procname = "ip_dynaddr",
246 .data = &sysctl_ip_dynaddr,
247 .maxlen = sizeof(int),
248 .mode = 0644,
249 .proc_handler = &proc_dointvec
252 .ctl_name = NET_IPV4_IPFRAG_TIME,
253 .procname = "ipfrag_time",
254 .data = &sysctl_ipfrag_time,
255 .maxlen = sizeof(int),
256 .mode = 0644,
257 .proc_handler = &proc_dointvec_jiffies,
258 .strategy = &sysctl_jiffies
261 .ctl_name = NET_IPV4_TCP_KEEPALIVE_TIME,
262 .procname = "tcp_keepalive_time",
263 .data = &sysctl_tcp_keepalive_time,
264 .maxlen = sizeof(int),
265 .mode = 0644,
266 .proc_handler = &proc_dointvec_jiffies,
267 .strategy = &sysctl_jiffies
270 .ctl_name = NET_IPV4_TCP_KEEPALIVE_PROBES,
271 .procname = "tcp_keepalive_probes",
272 .data = &sysctl_tcp_keepalive_probes,
273 .maxlen = sizeof(int),
274 .mode = 0644,
275 .proc_handler = &proc_dointvec
278 .ctl_name = NET_IPV4_TCP_KEEPALIVE_INTVL,
279 .procname = "tcp_keepalive_intvl",
280 .data = &sysctl_tcp_keepalive_intvl,
281 .maxlen = sizeof(int),
282 .mode = 0644,
283 .proc_handler = &proc_dointvec_jiffies,
284 .strategy = &sysctl_jiffies
287 .ctl_name = NET_IPV4_TCP_RETRIES1,
288 .procname = "tcp_retries1",
289 .data = &sysctl_tcp_retries1,
290 .maxlen = sizeof(int),
291 .mode = 0644,
292 .proc_handler = &proc_dointvec_minmax,
293 .strategy = &sysctl_intvec,
294 .extra2 = &tcp_retr1_max
297 .ctl_name = NET_IPV4_TCP_RETRIES2,
298 .procname = "tcp_retries2",
299 .data = &sysctl_tcp_retries2,
300 .maxlen = sizeof(int),
301 .mode = 0644,
302 .proc_handler = &proc_dointvec
305 .ctl_name = NET_IPV4_TCP_FIN_TIMEOUT,
306 .procname = "tcp_fin_timeout",
307 .data = &sysctl_tcp_fin_timeout,
308 .maxlen = sizeof(int),
309 .mode = 0644,
310 .proc_handler = &proc_dointvec_jiffies,
311 .strategy = &sysctl_jiffies
313 #ifdef CONFIG_SYN_COOKIES
315 .ctl_name = NET_TCP_SYNCOOKIES,
316 .procname = "tcp_syncookies",
317 .data = &sysctl_tcp_syncookies,
318 .maxlen = sizeof(int),
319 .mode = 0644,
320 .proc_handler = &proc_dointvec
322 #endif
324 .ctl_name = NET_TCP_TW_RECYCLE,
325 .procname = "tcp_tw_recycle",
326 .data = &sysctl_tcp_tw_recycle,
327 .maxlen = sizeof(int),
328 .mode = 0644,
329 .proc_handler = &proc_dointvec
332 .ctl_name = NET_TCP_ABORT_ON_OVERFLOW,
333 .procname = "tcp_abort_on_overflow",
334 .data = &sysctl_tcp_abort_on_overflow,
335 .maxlen = sizeof(int),
336 .mode = 0644,
337 .proc_handler = &proc_dointvec
340 .ctl_name = NET_TCP_STDURG,
341 .procname = "tcp_stdurg",
342 .data = &sysctl_tcp_stdurg,
343 .maxlen = sizeof(int),
344 .mode = 0644,
345 .proc_handler = &proc_dointvec
348 .ctl_name = NET_TCP_RFC1337,
349 .procname = "tcp_rfc1337",
350 .data = &sysctl_tcp_rfc1337,
351 .maxlen = sizeof(int),
352 .mode = 0644,
353 .proc_handler = &proc_dointvec
356 .ctl_name = NET_TCP_MAX_SYN_BACKLOG,
357 .procname = "tcp_max_syn_backlog",
358 .data = &sysctl_max_syn_backlog,
359 .maxlen = sizeof(int),
360 .mode = 0644,
361 .proc_handler = &proc_dointvec
364 .ctl_name = NET_IPV4_LOCAL_PORT_RANGE,
365 .procname = "ip_local_port_range",
366 .data = &sysctl_local_port_range,
367 .maxlen = sizeof(sysctl_local_port_range),
368 .mode = 0644,
369 .proc_handler = &proc_dointvec_minmax,
370 .strategy = &sysctl_intvec,
371 .extra1 = ip_local_port_range_min,
372 .extra2 = ip_local_port_range_max
375 .ctl_name = NET_IPV4_ICMP_ECHO_IGNORE_ALL,
376 .procname = "icmp_echo_ignore_all",
377 .data = &sysctl_icmp_echo_ignore_all,
378 .maxlen = sizeof(int),
379 .mode = 0644,
380 .proc_handler = &proc_dointvec
383 .ctl_name = NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS,
384 .procname = "icmp_echo_ignore_broadcasts",
385 .data = &sysctl_icmp_echo_ignore_broadcasts,
386 .maxlen = sizeof(int),
387 .mode = 0644,
388 .proc_handler = &proc_dointvec
391 .ctl_name = NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES,
392 .procname = "icmp_ignore_bogus_error_responses",
393 .data = &sysctl_icmp_ignore_bogus_error_responses,
394 .maxlen = sizeof(int),
395 .mode = 0644,
396 .proc_handler = &proc_dointvec
399 .ctl_name = NET_IPV4_ROUTE,
400 .procname = "route",
401 .maxlen = 0,
402 .mode = 0555,
403 .child = ipv4_route_table
405 #ifdef CONFIG_IP_MULTICAST
407 .ctl_name = NET_IPV4_IGMP_MAX_MEMBERSHIPS,
408 .procname = "igmp_max_memberships",
409 .data = &sysctl_igmp_max_memberships,
410 .maxlen = sizeof(int),
411 .mode = 0644,
412 .proc_handler = &proc_dointvec
415 #endif
417 .ctl_name = NET_IPV4_IGMP_MAX_MSF,
418 .procname = "igmp_max_msf",
419 .data = &sysctl_igmp_max_msf,
420 .maxlen = sizeof(int),
421 .mode = 0644,
422 .proc_handler = &proc_dointvec
425 .ctl_name = NET_IPV4_INET_PEER_THRESHOLD,
426 .procname = "inet_peer_threshold",
427 .data = &inet_peer_threshold,
428 .maxlen = sizeof(int),
429 .mode = 0644,
430 .proc_handler = &proc_dointvec
433 .ctl_name = NET_IPV4_INET_PEER_MINTTL,
434 .procname = "inet_peer_minttl",
435 .data = &inet_peer_minttl,
436 .maxlen = sizeof(int),
437 .mode = 0644,
438 .proc_handler = &proc_dointvec_jiffies,
439 .strategy = &sysctl_jiffies
442 .ctl_name = NET_IPV4_INET_PEER_MAXTTL,
443 .procname = "inet_peer_maxttl",
444 .data = &inet_peer_maxttl,
445 .maxlen = sizeof(int),
446 .mode = 0644,
447 .proc_handler = &proc_dointvec_jiffies,
448 .strategy = &sysctl_jiffies
451 .ctl_name = NET_IPV4_INET_PEER_GC_MINTIME,
452 .procname = "inet_peer_gc_mintime",
453 .data = &inet_peer_gc_mintime,
454 .maxlen = sizeof(int),
455 .mode = 0644,
456 .proc_handler = &proc_dointvec_jiffies,
457 .strategy = &sysctl_jiffies
460 .ctl_name = NET_IPV4_INET_PEER_GC_MAXTIME,
461 .procname = "inet_peer_gc_maxtime",
462 .data = &inet_peer_gc_maxtime,
463 .maxlen = sizeof(int),
464 .mode = 0644,
465 .proc_handler = &proc_dointvec_jiffies,
466 .strategy = &sysctl_jiffies
469 .ctl_name = NET_TCP_ORPHAN_RETRIES,
470 .procname = "tcp_orphan_retries",
471 .data = &sysctl_tcp_orphan_retries,
472 .maxlen = sizeof(int),
473 .mode = 0644,
474 .proc_handler = &proc_dointvec
477 .ctl_name = NET_TCP_FACK,
478 .procname = "tcp_fack",
479 .data = &sysctl_tcp_fack,
480 .maxlen = sizeof(int),
481 .mode = 0644,
482 .proc_handler = &proc_dointvec
485 .ctl_name = NET_TCP_REORDERING,
486 .procname = "tcp_reordering",
487 .data = &sysctl_tcp_reordering,
488 .maxlen = sizeof(int),
489 .mode = 0644,
490 .proc_handler = &proc_dointvec
493 .ctl_name = NET_TCP_ECN,
494 .procname = "tcp_ecn",
495 .data = &sysctl_tcp_ecn,
496 .maxlen = sizeof(int),
497 .mode = 0644,
498 .proc_handler = &proc_dointvec
501 .ctl_name = NET_TCP_DSACK,
502 .procname = "tcp_dsack",
503 .data = &sysctl_tcp_dsack,
504 .maxlen = sizeof(int),
505 .mode = 0644,
506 .proc_handler = &proc_dointvec
509 .ctl_name = NET_TCP_MEM,
510 .procname = "tcp_mem",
511 .data = &sysctl_tcp_mem,
512 .maxlen = sizeof(sysctl_tcp_mem),
513 .mode = 0644,
514 .proc_handler = &proc_dointvec
517 .ctl_name = NET_TCP_WMEM,
518 .procname = "tcp_wmem",
519 .data = &sysctl_tcp_wmem,
520 .maxlen = sizeof(sysctl_tcp_wmem),
521 .mode = 0644,
522 .proc_handler = &proc_dointvec
525 .ctl_name = NET_TCP_RMEM,
526 .procname = "tcp_rmem",
527 .data = &sysctl_tcp_rmem,
528 .maxlen = sizeof(sysctl_tcp_rmem),
529 .mode = 0644,
530 .proc_handler = &proc_dointvec
533 .ctl_name = NET_TCP_APP_WIN,
534 .procname = "tcp_app_win",
535 .data = &sysctl_tcp_app_win,
536 .maxlen = sizeof(int),
537 .mode = 0644,
538 .proc_handler = &proc_dointvec
541 .ctl_name = NET_TCP_ADV_WIN_SCALE,
542 .procname = "tcp_adv_win_scale",
543 .data = &sysctl_tcp_adv_win_scale,
544 .maxlen = sizeof(int),
545 .mode = 0644,
546 .proc_handler = &proc_dointvec
549 .ctl_name = NET_IPV4_ICMP_RATELIMIT,
550 .procname = "icmp_ratelimit",
551 .data = &sysctl_icmp_ratelimit,
552 .maxlen = sizeof(int),
553 .mode = 0644,
554 .proc_handler = &proc_dointvec
557 .ctl_name = NET_IPV4_ICMP_RATEMASK,
558 .procname = "icmp_ratemask",
559 .data = &sysctl_icmp_ratemask,
560 .maxlen = sizeof(int),
561 .mode = 0644,
562 .proc_handler = &proc_dointvec
565 .ctl_name = NET_TCP_TW_REUSE,
566 .procname = "tcp_tw_reuse",
567 .data = &sysctl_tcp_tw_reuse,
568 .maxlen = sizeof(int),
569 .mode = 0644,
570 .proc_handler = &proc_dointvec
573 .ctl_name = NET_TCP_FRTO,
574 .procname = "tcp_frto",
575 .data = &sysctl_tcp_frto,
576 .maxlen = sizeof(int),
577 .mode = 0644,
578 .proc_handler = &proc_dointvec
581 .ctl_name = NET_TCP_LOW_LATENCY,
582 .procname = "tcp_low_latency",
583 .data = &sysctl_tcp_low_latency,
584 .maxlen = sizeof(int),
585 .mode = 0644,
586 .proc_handler = &proc_dointvec
589 .ctl_name = NET_IPV4_IPFRAG_SECRET_INTERVAL,
590 .procname = "ipfrag_secret_interval",
591 .data = &sysctl_ipfrag_secret_interval,
592 .maxlen = sizeof(int),
593 .mode = 0644,
594 .proc_handler = &proc_dointvec_jiffies,
595 .strategy = &sysctl_jiffies
598 .ctl_name = NET_TCP_NO_METRICS_SAVE,
599 .procname = "tcp_no_metrics_save",
600 .data = &sysctl_tcp_nometrics_save,
601 .maxlen = sizeof(int),
602 .mode = 0644,
603 .proc_handler = &proc_dointvec,
606 .ctl_name = NET_TCP_WESTWOOD,
607 .procname = "tcp_westwood",
608 .data = &sysctl_tcp_westwood,
609 .maxlen = sizeof(int),
610 .mode = 0644,
611 .proc_handler = &proc_dointvec,
614 .ctl_name = NET_TCP_VEGAS,
615 .procname = "tcp_vegas_cong_avoid",
616 .data = &sysctl_tcp_vegas_cong_avoid,
617 .maxlen = sizeof(int),
618 .mode = 0644,
619 .proc_handler = &proc_dointvec,
622 .ctl_name = NET_TCP_VEGAS_ALPHA,
623 .procname = "tcp_vegas_alpha",
624 .data = &sysctl_tcp_vegas_alpha,
625 .maxlen = sizeof(int),
626 .mode = 0644,
627 .proc_handler = &proc_dointvec,
630 .ctl_name = NET_TCP_VEGAS_BETA,
631 .procname = "tcp_vegas_beta",
632 .data = &sysctl_tcp_vegas_beta,
633 .maxlen = sizeof(int),
634 .mode = 0644,
635 .proc_handler = &proc_dointvec,
638 .ctl_name = NET_TCP_VEGAS_GAMMA,
639 .procname = "tcp_vegas_gamma",
640 .data = &sysctl_tcp_vegas_gamma,
641 .maxlen = sizeof(int),
642 .mode = 0644,
643 .proc_handler = &proc_dointvec,
646 .ctl_name = NET_TCP_BIC,
647 .procname = "tcp_bic",
648 .data = &sysctl_tcp_bic,
649 .maxlen = sizeof(int),
650 .mode = 0644,
651 .proc_handler = &proc_dointvec,
654 .ctl_name = NET_TCP_BIC_FAST_CONVERGENCE,
655 .procname = "tcp_bic_fast_convergence",
656 .data = &sysctl_tcp_bic_fast_convergence,
657 .maxlen = sizeof(int),
658 .mode = 0644,
659 .proc_handler = &proc_dointvec,
662 .ctl_name = NET_TCP_BIC_LOW_WINDOW,
663 .procname = "tcp_bic_low_window",
664 .data = &sysctl_tcp_bic_low_window,
665 .maxlen = sizeof(int),
666 .mode = 0644,
667 .proc_handler = &proc_dointvec,
670 .ctl_name = NET_TCP_MODERATE_RCVBUF,
671 .procname = "tcp_moderate_rcvbuf",
672 .data = &sysctl_tcp_moderate_rcvbuf,
673 .maxlen = sizeof(int),
674 .mode = 0644,
675 .proc_handler = &proc_dointvec,
678 .ctl_name = NET_TCP_TSO_WIN_DIVISOR,
679 .procname = "tcp_tso_win_divisor",
680 .data = &sysctl_tcp_tso_win_divisor,
681 .maxlen = sizeof(int),
682 .mode = 0644,
683 .proc_handler = &proc_dointvec,
686 .ctl_name = NET_TCP_BIC_BETA,
687 .procname = "tcp_bic_beta",
688 .data = &sysctl_tcp_bic_beta,
689 .maxlen = sizeof(int),
690 .mode = 0644,
691 .proc_handler = &proc_dointvec,
693 { .ctl_name = 0 }
696 #endif /* CONFIG_SYSCTL */
698 EXPORT_SYMBOL(ipv4_config);