2 * sysctl_net_ipv4.c: sysctl interface to net IPV4 subsystem.
4 * Begun April 1, 1996, Mike Shaver.
5 * Added /proc/sys/net/ipv4 directory entry (empty =) ). [MS]
9 #include <linux/module.h>
10 #include <linux/sysctl.h>
11 #include <linux/igmp.h>
12 #include <linux/inetdevice.h>
13 #include <linux/seqlock.h>
14 #include <linux/init.h>
18 #include <net/route.h>
21 #include <net/cipso_ipv4.h>
22 #include <net/inet_frag.h>
25 static int tcp_retr1_max = 255;
26 static int ip_local_port_range_min[] = { 1, 1 };
27 static int ip_local_port_range_max[] = { 65535, 65535 };
29 extern seqlock_t sysctl_port_range_lock;
30 extern int sysctl_local_port_range[2];
32 /* Update system visible IP port range */
33 static void set_local_port_range(int range[2])
35 write_seqlock(&sysctl_port_range_lock);
36 sysctl_local_port_range[0] = range[0];
37 sysctl_local_port_range[1] = range[1];
38 write_sequnlock(&sysctl_port_range_lock);
41 /* Validate changes from /proc interface. */
42 static int ipv4_local_port_range(ctl_table *table, int write, struct file *filp,
44 size_t *lenp, loff_t *ppos)
47 int range[2] = { sysctl_local_port_range[0],
48 sysctl_local_port_range[1] };
51 .maxlen = sizeof(range),
53 .extra1 = &ip_local_port_range_min,
54 .extra2 = &ip_local_port_range_max,
57 ret = proc_dointvec_minmax(&tmp, write, filp, buffer, lenp, ppos);
59 if (write && ret == 0) {
60 if (range[1] < range[0])
63 set_local_port_range(range);
69 /* Validate changes from sysctl interface. */
70 static int ipv4_sysctl_local_port_range(ctl_table *table, int __user *name,
71 int nlen, void __user *oldval,
72 size_t __user *oldlenp,
73 void __user *newval, size_t newlen)
76 int range[2] = { sysctl_local_port_range[0],
77 sysctl_local_port_range[1] };
80 .maxlen = sizeof(range),
82 .extra1 = &ip_local_port_range_min,
83 .extra2 = &ip_local_port_range_max,
86 ret = sysctl_intvec(&tmp, name, nlen, oldval, oldlenp, newval, newlen);
87 if (ret == 0 && newval && newlen) {
88 if (range[1] < range[0])
91 set_local_port_range(range);
97 static int proc_tcp_congestion_control(ctl_table *ctl, int write, struct file * filp,
98 void __user *buffer, size_t *lenp, loff_t *ppos)
100 char val[TCP_CA_NAME_MAX];
103 .maxlen = TCP_CA_NAME_MAX,
107 tcp_get_default_congestion_control(val);
109 ret = proc_dostring(&tbl, write, filp, buffer, lenp, ppos);
110 if (write && ret == 0)
111 ret = tcp_set_default_congestion_control(val);
115 static int sysctl_tcp_congestion_control(ctl_table *table, int __user *name,
116 int nlen, void __user *oldval,
117 size_t __user *oldlenp,
118 void __user *newval, size_t newlen)
120 char val[TCP_CA_NAME_MAX];
123 .maxlen = TCP_CA_NAME_MAX,
127 tcp_get_default_congestion_control(val);
128 ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen);
129 if (ret == 1 && newval && newlen)
130 ret = tcp_set_default_congestion_control(val);
134 static int proc_tcp_available_congestion_control(ctl_table *ctl,
135 int write, struct file * filp,
136 void __user *buffer, size_t *lenp,
139 ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX, };
142 tbl.data = kmalloc(tbl.maxlen, GFP_USER);
145 tcp_get_available_congestion_control(tbl.data, TCP_CA_BUF_MAX);
146 ret = proc_dostring(&tbl, write, filp, buffer, lenp, ppos);
151 static int proc_allowed_congestion_control(ctl_table *ctl,
152 int write, struct file * filp,
153 void __user *buffer, size_t *lenp,
156 ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX };
159 tbl.data = kmalloc(tbl.maxlen, GFP_USER);
163 tcp_get_allowed_congestion_control(tbl.data, tbl.maxlen);
164 ret = proc_dostring(&tbl, write, filp, buffer, lenp, ppos);
165 if (write && ret == 0)
166 ret = tcp_set_allowed_congestion_control(tbl.data);
171 static int strategy_allowed_congestion_control(ctl_table *table, int __user *name,
172 int nlen, void __user *oldval,
173 size_t __user *oldlenp,
177 ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX };
180 tbl.data = kmalloc(tbl.maxlen, GFP_USER);
184 tcp_get_available_congestion_control(tbl.data, tbl.maxlen);
185 ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen);
186 if (ret == 1 && newval && newlen)
187 ret = tcp_set_allowed_congestion_control(tbl.data);
194 static struct ctl_table ipv4_table[] = {
196 .ctl_name = NET_IPV4_TCP_TIMESTAMPS,
197 .procname = "tcp_timestamps",
198 .data = &sysctl_tcp_timestamps,
199 .maxlen = sizeof(int),
201 .proc_handler = &proc_dointvec
204 .ctl_name = NET_IPV4_TCP_WINDOW_SCALING,
205 .procname = "tcp_window_scaling",
206 .data = &sysctl_tcp_window_scaling,
207 .maxlen = sizeof(int),
209 .proc_handler = &proc_dointvec
212 .ctl_name = NET_IPV4_TCP_SACK,
213 .procname = "tcp_sack",
214 .data = &sysctl_tcp_sack,
215 .maxlen = sizeof(int),
217 .proc_handler = &proc_dointvec
220 .ctl_name = NET_IPV4_TCP_RETRANS_COLLAPSE,
221 .procname = "tcp_retrans_collapse",
222 .data = &sysctl_tcp_retrans_collapse,
223 .maxlen = sizeof(int),
225 .proc_handler = &proc_dointvec
228 .ctl_name = NET_IPV4_DEFAULT_TTL,
229 .procname = "ip_default_ttl",
230 .data = &sysctl_ip_default_ttl,
231 .maxlen = sizeof(int),
233 .proc_handler = &ipv4_doint_and_flush,
234 .strategy = &ipv4_doint_and_flush_strategy,
237 .ctl_name = NET_IPV4_NO_PMTU_DISC,
238 .procname = "ip_no_pmtu_disc",
239 .data = &ipv4_config.no_pmtu_disc,
240 .maxlen = sizeof(int),
242 .proc_handler = &proc_dointvec
245 .ctl_name = NET_IPV4_NONLOCAL_BIND,
246 .procname = "ip_nonlocal_bind",
247 .data = &sysctl_ip_nonlocal_bind,
248 .maxlen = sizeof(int),
250 .proc_handler = &proc_dointvec
253 .ctl_name = NET_IPV4_TCP_SYN_RETRIES,
254 .procname = "tcp_syn_retries",
255 .data = &sysctl_tcp_syn_retries,
256 .maxlen = sizeof(int),
258 .proc_handler = &proc_dointvec
261 .ctl_name = NET_TCP_SYNACK_RETRIES,
262 .procname = "tcp_synack_retries",
263 .data = &sysctl_tcp_synack_retries,
264 .maxlen = sizeof(int),
266 .proc_handler = &proc_dointvec
269 .ctl_name = NET_TCP_MAX_ORPHANS,
270 .procname = "tcp_max_orphans",
271 .data = &sysctl_tcp_max_orphans,
272 .maxlen = sizeof(int),
274 .proc_handler = &proc_dointvec
277 .ctl_name = NET_TCP_MAX_TW_BUCKETS,
278 .procname = "tcp_max_tw_buckets",
279 .data = &tcp_death_row.sysctl_max_tw_buckets,
280 .maxlen = sizeof(int),
282 .proc_handler = &proc_dointvec
285 .ctl_name = NET_IPV4_DYNADDR,
286 .procname = "ip_dynaddr",
287 .data = &sysctl_ip_dynaddr,
288 .maxlen = sizeof(int),
290 .proc_handler = &proc_dointvec
293 .ctl_name = NET_IPV4_TCP_KEEPALIVE_TIME,
294 .procname = "tcp_keepalive_time",
295 .data = &sysctl_tcp_keepalive_time,
296 .maxlen = sizeof(int),
298 .proc_handler = &proc_dointvec_jiffies,
299 .strategy = &sysctl_jiffies
302 .ctl_name = NET_IPV4_TCP_KEEPALIVE_PROBES,
303 .procname = "tcp_keepalive_probes",
304 .data = &sysctl_tcp_keepalive_probes,
305 .maxlen = sizeof(int),
307 .proc_handler = &proc_dointvec
310 .ctl_name = NET_IPV4_TCP_KEEPALIVE_INTVL,
311 .procname = "tcp_keepalive_intvl",
312 .data = &sysctl_tcp_keepalive_intvl,
313 .maxlen = sizeof(int),
315 .proc_handler = &proc_dointvec_jiffies,
316 .strategy = &sysctl_jiffies
319 .ctl_name = NET_IPV4_TCP_RETRIES1,
320 .procname = "tcp_retries1",
321 .data = &sysctl_tcp_retries1,
322 .maxlen = sizeof(int),
324 .proc_handler = &proc_dointvec_minmax,
325 .strategy = &sysctl_intvec,
326 .extra2 = &tcp_retr1_max
329 .ctl_name = NET_IPV4_TCP_RETRIES2,
330 .procname = "tcp_retries2",
331 .data = &sysctl_tcp_retries2,
332 .maxlen = sizeof(int),
334 .proc_handler = &proc_dointvec
337 .ctl_name = NET_IPV4_TCP_FIN_TIMEOUT,
338 .procname = "tcp_fin_timeout",
339 .data = &sysctl_tcp_fin_timeout,
340 .maxlen = sizeof(int),
342 .proc_handler = &proc_dointvec_jiffies,
343 .strategy = &sysctl_jiffies
345 #ifdef CONFIG_SYN_COOKIES
347 .ctl_name = NET_TCP_SYNCOOKIES,
348 .procname = "tcp_syncookies",
349 .data = &sysctl_tcp_syncookies,
350 .maxlen = sizeof(int),
352 .proc_handler = &proc_dointvec
356 .ctl_name = NET_TCP_TW_RECYCLE,
357 .procname = "tcp_tw_recycle",
358 .data = &tcp_death_row.sysctl_tw_recycle,
359 .maxlen = sizeof(int),
361 .proc_handler = &proc_dointvec
364 .ctl_name = NET_TCP_ABORT_ON_OVERFLOW,
365 .procname = "tcp_abort_on_overflow",
366 .data = &sysctl_tcp_abort_on_overflow,
367 .maxlen = sizeof(int),
369 .proc_handler = &proc_dointvec
372 .ctl_name = NET_TCP_STDURG,
373 .procname = "tcp_stdurg",
374 .data = &sysctl_tcp_stdurg,
375 .maxlen = sizeof(int),
377 .proc_handler = &proc_dointvec
380 .ctl_name = NET_TCP_RFC1337,
381 .procname = "tcp_rfc1337",
382 .data = &sysctl_tcp_rfc1337,
383 .maxlen = sizeof(int),
385 .proc_handler = &proc_dointvec
388 .ctl_name = NET_TCP_MAX_SYN_BACKLOG,
389 .procname = "tcp_max_syn_backlog",
390 .data = &sysctl_max_syn_backlog,
391 .maxlen = sizeof(int),
393 .proc_handler = &proc_dointvec
396 .ctl_name = NET_IPV4_LOCAL_PORT_RANGE,
397 .procname = "ip_local_port_range",
398 .data = &sysctl_local_port_range,
399 .maxlen = sizeof(sysctl_local_port_range),
401 .proc_handler = &ipv4_local_port_range,
402 .strategy = &ipv4_sysctl_local_port_range,
405 .ctl_name = NET_IPV4_ROUTE,
409 .child = ipv4_route_table
411 #ifdef CONFIG_IP_MULTICAST
413 .ctl_name = NET_IPV4_IGMP_MAX_MEMBERSHIPS,
414 .procname = "igmp_max_memberships",
415 .data = &sysctl_igmp_max_memberships,
416 .maxlen = sizeof(int),
418 .proc_handler = &proc_dointvec
423 .ctl_name = NET_IPV4_IGMP_MAX_MSF,
424 .procname = "igmp_max_msf",
425 .data = &sysctl_igmp_max_msf,
426 .maxlen = sizeof(int),
428 .proc_handler = &proc_dointvec
431 .ctl_name = NET_IPV4_INET_PEER_THRESHOLD,
432 .procname = "inet_peer_threshold",
433 .data = &inet_peer_threshold,
434 .maxlen = sizeof(int),
436 .proc_handler = &proc_dointvec
439 .ctl_name = NET_IPV4_INET_PEER_MINTTL,
440 .procname = "inet_peer_minttl",
441 .data = &inet_peer_minttl,
442 .maxlen = sizeof(int),
444 .proc_handler = &proc_dointvec_jiffies,
445 .strategy = &sysctl_jiffies
448 .ctl_name = NET_IPV4_INET_PEER_MAXTTL,
449 .procname = "inet_peer_maxttl",
450 .data = &inet_peer_maxttl,
451 .maxlen = sizeof(int),
453 .proc_handler = &proc_dointvec_jiffies,
454 .strategy = &sysctl_jiffies
457 .ctl_name = NET_IPV4_INET_PEER_GC_MINTIME,
458 .procname = "inet_peer_gc_mintime",
459 .data = &inet_peer_gc_mintime,
460 .maxlen = sizeof(int),
462 .proc_handler = &proc_dointvec_jiffies,
463 .strategy = &sysctl_jiffies
466 .ctl_name = NET_IPV4_INET_PEER_GC_MAXTIME,
467 .procname = "inet_peer_gc_maxtime",
468 .data = &inet_peer_gc_maxtime,
469 .maxlen = sizeof(int),
471 .proc_handler = &proc_dointvec_jiffies,
472 .strategy = &sysctl_jiffies
475 .ctl_name = NET_TCP_ORPHAN_RETRIES,
476 .procname = "tcp_orphan_retries",
477 .data = &sysctl_tcp_orphan_retries,
478 .maxlen = sizeof(int),
480 .proc_handler = &proc_dointvec
483 .ctl_name = NET_TCP_FACK,
484 .procname = "tcp_fack",
485 .data = &sysctl_tcp_fack,
486 .maxlen = sizeof(int),
488 .proc_handler = &proc_dointvec
491 .ctl_name = NET_TCP_REORDERING,
492 .procname = "tcp_reordering",
493 .data = &sysctl_tcp_reordering,
494 .maxlen = sizeof(int),
496 .proc_handler = &proc_dointvec
499 .ctl_name = NET_TCP_ECN,
500 .procname = "tcp_ecn",
501 .data = &sysctl_tcp_ecn,
502 .maxlen = sizeof(int),
504 .proc_handler = &proc_dointvec
507 .ctl_name = NET_TCP_DSACK,
508 .procname = "tcp_dsack",
509 .data = &sysctl_tcp_dsack,
510 .maxlen = sizeof(int),
512 .proc_handler = &proc_dointvec
515 .ctl_name = NET_TCP_MEM,
516 .procname = "tcp_mem",
517 .data = &sysctl_tcp_mem,
518 .maxlen = sizeof(sysctl_tcp_mem),
520 .proc_handler = &proc_dointvec
523 .ctl_name = NET_TCP_WMEM,
524 .procname = "tcp_wmem",
525 .data = &sysctl_tcp_wmem,
526 .maxlen = sizeof(sysctl_tcp_wmem),
528 .proc_handler = &proc_dointvec
531 .ctl_name = NET_TCP_RMEM,
532 .procname = "tcp_rmem",
533 .data = &sysctl_tcp_rmem,
534 .maxlen = sizeof(sysctl_tcp_rmem),
536 .proc_handler = &proc_dointvec
539 .ctl_name = NET_TCP_APP_WIN,
540 .procname = "tcp_app_win",
541 .data = &sysctl_tcp_app_win,
542 .maxlen = sizeof(int),
544 .proc_handler = &proc_dointvec
547 .ctl_name = NET_TCP_ADV_WIN_SCALE,
548 .procname = "tcp_adv_win_scale",
549 .data = &sysctl_tcp_adv_win_scale,
550 .maxlen = sizeof(int),
552 .proc_handler = &proc_dointvec
555 .ctl_name = NET_TCP_TW_REUSE,
556 .procname = "tcp_tw_reuse",
557 .data = &sysctl_tcp_tw_reuse,
558 .maxlen = sizeof(int),
560 .proc_handler = &proc_dointvec
563 .ctl_name = NET_TCP_FRTO,
564 .procname = "tcp_frto",
565 .data = &sysctl_tcp_frto,
566 .maxlen = sizeof(int),
568 .proc_handler = &proc_dointvec
571 .ctl_name = NET_TCP_FRTO_RESPONSE,
572 .procname = "tcp_frto_response",
573 .data = &sysctl_tcp_frto_response,
574 .maxlen = sizeof(int),
576 .proc_handler = &proc_dointvec
579 .ctl_name = NET_TCP_LOW_LATENCY,
580 .procname = "tcp_low_latency",
581 .data = &sysctl_tcp_low_latency,
582 .maxlen = sizeof(int),
584 .proc_handler = &proc_dointvec
587 .ctl_name = NET_TCP_NO_METRICS_SAVE,
588 .procname = "tcp_no_metrics_save",
589 .data = &sysctl_tcp_nometrics_save,
590 .maxlen = sizeof(int),
592 .proc_handler = &proc_dointvec,
595 .ctl_name = NET_TCP_MODERATE_RCVBUF,
596 .procname = "tcp_moderate_rcvbuf",
597 .data = &sysctl_tcp_moderate_rcvbuf,
598 .maxlen = sizeof(int),
600 .proc_handler = &proc_dointvec,
603 .ctl_name = NET_TCP_TSO_WIN_DIVISOR,
604 .procname = "tcp_tso_win_divisor",
605 .data = &sysctl_tcp_tso_win_divisor,
606 .maxlen = sizeof(int),
608 .proc_handler = &proc_dointvec,
611 .ctl_name = NET_TCP_CONG_CONTROL,
612 .procname = "tcp_congestion_control",
614 .maxlen = TCP_CA_NAME_MAX,
615 .proc_handler = &proc_tcp_congestion_control,
616 .strategy = &sysctl_tcp_congestion_control,
619 .ctl_name = NET_TCP_ABC,
620 .procname = "tcp_abc",
621 .data = &sysctl_tcp_abc,
622 .maxlen = sizeof(int),
624 .proc_handler = &proc_dointvec,
627 .ctl_name = NET_TCP_MTU_PROBING,
628 .procname = "tcp_mtu_probing",
629 .data = &sysctl_tcp_mtu_probing,
630 .maxlen = sizeof(int),
632 .proc_handler = &proc_dointvec,
635 .ctl_name = NET_TCP_BASE_MSS,
636 .procname = "tcp_base_mss",
637 .data = &sysctl_tcp_base_mss,
638 .maxlen = sizeof(int),
640 .proc_handler = &proc_dointvec,
643 .ctl_name = NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS,
644 .procname = "tcp_workaround_signed_windows",
645 .data = &sysctl_tcp_workaround_signed_windows,
646 .maxlen = sizeof(int),
648 .proc_handler = &proc_dointvec
650 #ifdef CONFIG_NET_DMA
652 .ctl_name = NET_TCP_DMA_COPYBREAK,
653 .procname = "tcp_dma_copybreak",
654 .data = &sysctl_tcp_dma_copybreak,
655 .maxlen = sizeof(int),
657 .proc_handler = &proc_dointvec
661 .ctl_name = NET_TCP_SLOW_START_AFTER_IDLE,
662 .procname = "tcp_slow_start_after_idle",
663 .data = &sysctl_tcp_slow_start_after_idle,
664 .maxlen = sizeof(int),
666 .proc_handler = &proc_dointvec
668 #ifdef CONFIG_NETLABEL
670 .ctl_name = NET_CIPSOV4_CACHE_ENABLE,
671 .procname = "cipso_cache_enable",
672 .data = &cipso_v4_cache_enabled,
673 .maxlen = sizeof(int),
675 .proc_handler = &proc_dointvec,
678 .ctl_name = NET_CIPSOV4_CACHE_BUCKET_SIZE,
679 .procname = "cipso_cache_bucket_size",
680 .data = &cipso_v4_cache_bucketsize,
681 .maxlen = sizeof(int),
683 .proc_handler = &proc_dointvec,
686 .ctl_name = NET_CIPSOV4_RBM_OPTFMT,
687 .procname = "cipso_rbm_optfmt",
688 .data = &cipso_v4_rbm_optfmt,
689 .maxlen = sizeof(int),
691 .proc_handler = &proc_dointvec,
694 .ctl_name = NET_CIPSOV4_RBM_STRICTVALID,
695 .procname = "cipso_rbm_strictvalid",
696 .data = &cipso_v4_rbm_strictvalid,
697 .maxlen = sizeof(int),
699 .proc_handler = &proc_dointvec,
701 #endif /* CONFIG_NETLABEL */
703 .procname = "tcp_available_congestion_control",
704 .maxlen = TCP_CA_BUF_MAX,
706 .proc_handler = &proc_tcp_available_congestion_control,
709 .ctl_name = NET_TCP_ALLOWED_CONG_CONTROL,
710 .procname = "tcp_allowed_congestion_control",
711 .maxlen = TCP_CA_BUF_MAX,
713 .proc_handler = &proc_allowed_congestion_control,
714 .strategy = &strategy_allowed_congestion_control,
717 .ctl_name = NET_TCP_MAX_SSTHRESH,
718 .procname = "tcp_max_ssthresh",
719 .data = &sysctl_tcp_max_ssthresh,
720 .maxlen = sizeof(int),
722 .proc_handler = &proc_dointvec,
725 .ctl_name = CTL_UNNUMBERED,
726 .procname = "udp_mem",
727 .data = &sysctl_udp_mem,
728 .maxlen = sizeof(sysctl_udp_mem),
730 .proc_handler = &proc_dointvec_minmax,
731 .strategy = &sysctl_intvec,
735 .ctl_name = CTL_UNNUMBERED,
736 .procname = "udp_rmem_min",
737 .data = &sysctl_udp_rmem_min,
738 .maxlen = sizeof(sysctl_udp_rmem_min),
740 .proc_handler = &proc_dointvec_minmax,
741 .strategy = &sysctl_intvec,
745 .ctl_name = CTL_UNNUMBERED,
746 .procname = "udp_wmem_min",
747 .data = &sysctl_udp_wmem_min,
748 .maxlen = sizeof(sysctl_udp_wmem_min),
750 .proc_handler = &proc_dointvec_minmax,
751 .strategy = &sysctl_intvec,
757 static struct ctl_table ipv4_net_table[] = {
759 .ctl_name = NET_IPV4_ICMP_ECHO_IGNORE_ALL,
760 .procname = "icmp_echo_ignore_all",
761 .data = &init_net.ipv4.sysctl_icmp_echo_ignore_all,
762 .maxlen = sizeof(int),
764 .proc_handler = &proc_dointvec
767 .ctl_name = NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS,
768 .procname = "icmp_echo_ignore_broadcasts",
769 .data = &init_net.ipv4.sysctl_icmp_echo_ignore_broadcasts,
770 .maxlen = sizeof(int),
772 .proc_handler = &proc_dointvec
775 .ctl_name = NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES,
776 .procname = "icmp_ignore_bogus_error_responses",
777 .data = &init_net.ipv4.sysctl_icmp_ignore_bogus_error_responses,
778 .maxlen = sizeof(int),
780 .proc_handler = &proc_dointvec
783 .ctl_name = NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR,
784 .procname = "icmp_errors_use_inbound_ifaddr",
785 .data = &init_net.ipv4.sysctl_icmp_errors_use_inbound_ifaddr,
786 .maxlen = sizeof(int),
788 .proc_handler = &proc_dointvec
791 .ctl_name = NET_IPV4_ICMP_RATELIMIT,
792 .procname = "icmp_ratelimit",
793 .data = &init_net.ipv4.sysctl_icmp_ratelimit,
794 .maxlen = sizeof(int),
796 .proc_handler = &proc_dointvec_ms_jiffies,
797 .strategy = &sysctl_ms_jiffies
800 .ctl_name = NET_IPV4_ICMP_RATEMASK,
801 .procname = "icmp_ratemask",
802 .data = &init_net.ipv4.sysctl_icmp_ratemask,
803 .maxlen = sizeof(int),
805 .proc_handler = &proc_dointvec
810 struct ctl_path net_ipv4_ctl_path[] = {
811 { .procname = "net", .ctl_name = CTL_NET, },
812 { .procname = "ipv4", .ctl_name = NET_IPV4, },
815 EXPORT_SYMBOL_GPL(net_ipv4_ctl_path);
817 static __net_init int ipv4_sysctl_init_net(struct net *net)
819 struct ctl_table *table;
821 table = ipv4_net_table;
822 if (net != &init_net) {
823 table = kmemdup(table, sizeof(ipv4_net_table), GFP_KERNEL);
828 &net->ipv4.sysctl_icmp_echo_ignore_all;
830 &net->ipv4.sysctl_icmp_echo_ignore_broadcasts;
832 &net->ipv4.sysctl_icmp_ignore_bogus_error_responses;
834 &net->ipv4.sysctl_icmp_errors_use_inbound_ifaddr;
836 &net->ipv4.sysctl_icmp_ratelimit;
838 &net->ipv4.sysctl_icmp_ratemask;
841 net->ipv4.ipv4_hdr = register_net_sysctl_table(net,
842 net_ipv4_ctl_path, table);
843 if (net->ipv4.ipv4_hdr == NULL)
849 if (net != &init_net)
855 static __net_exit void ipv4_sysctl_exit_net(struct net *net)
857 struct ctl_table *table;
859 table = net->ipv4.ipv4_hdr->ctl_table_arg;
860 unregister_net_sysctl_table(net->ipv4.ipv4_hdr);
864 static __net_initdata struct pernet_operations ipv4_sysctl_ops = {
865 .init = ipv4_sysctl_init_net,
866 .exit = ipv4_sysctl_exit_net,
869 static __init int sysctl_ipv4_init(void)
871 struct ctl_table_header *hdr;
873 hdr = register_sysctl_paths(net_ipv4_ctl_path, ipv4_table);
877 if (register_pernet_subsys(&ipv4_sysctl_ops)) {
878 unregister_sysctl_table(hdr);
885 __initcall(sysctl_ipv4_init);