1 // SPDX-License-Identifier: GPL-2.0
3 * sysctl_net_ipv4.c: sysctl interface to net IPV4 subsystem.
5 * Begun April 1, 1996, Mike Shaver.
6 * Added /proc/sys/net/ipv4 directory entry (empty =) ). [MS]
9 #include <linux/sysctl.h>
10 #include <linux/seqlock.h>
11 #include <linux/init.h>
12 #include <linux/slab.h>
15 #include <net/ip_fib.h>
18 #include <net/cipso_ipv4.h>
20 #include <net/protocol.h>
21 #include <net/netevent.h>
23 static int tcp_retr1_max = 255;
24 static int ip_local_port_range_min[] = { 1, 1 };
25 static int ip_local_port_range_max[] = { 65535, 65535 };
26 static int tcp_adv_win_scale_min = -31;
27 static int tcp_adv_win_scale_max = 31;
28 static int tcp_app_win_max = 31;
29 static int tcp_min_snd_mss_min = TCP_MIN_SND_MSS;
30 static int tcp_min_snd_mss_max = 65535;
31 static int ip_privileged_port_min;
32 static int ip_privileged_port_max = 65535;
33 static int ip_ttl_min = 1;
34 static int ip_ttl_max = 255;
35 static int tcp_syn_retries_min = 1;
36 static int tcp_syn_retries_max = MAX_TCP_SYNCNT;
37 static int tcp_syn_linear_timeouts_max = MAX_TCP_SYNCNT;
38 static unsigned long ip_ping_group_range_min[] = { 0, 0 };
39 static unsigned long ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX };
40 static u32 u32_max_div_HZ = UINT_MAX / HZ;
41 static int one_day_secs = 24 * 3600;
42 static u32 fib_multipath_hash_fields_all_mask __maybe_unused =
43 FIB_MULTIPATH_HASH_FIELD_ALL_MASK;
44 static unsigned int tcp_child_ehash_entries_max = 16 * 1024 * 1024;
45 static unsigned int udp_child_hash_entries_max = UDP_HTABLE_SIZE_MAX;
46 static int tcp_plb_max_rounds = 31;
47 static int tcp_plb_max_cong_thresh = 256;
50 static int sysctl_tcp_low_latency __read_mostly;
52 /* Update system visible IP port range */
53 static void set_local_port_range(struct net *net, int range[2])
55 bool same_parity = !((range[0] ^ range[1]) & 1);
57 write_seqlock_bh(&net->ipv4.ip_local_ports.lock);
58 if (same_parity && !net->ipv4.ip_local_ports.warned) {
59 net->ipv4.ip_local_ports.warned = true;
60 pr_err_ratelimited("ip_local_port_range: prefer different parity for start/end values.\n");
62 net->ipv4.ip_local_ports.range[0] = range[0];
63 net->ipv4.ip_local_ports.range[1] = range[1];
64 write_sequnlock_bh(&net->ipv4.ip_local_ports.lock);
67 /* Validate changes from /proc interface. */
68 static int ipv4_local_port_range(struct ctl_table *table, int write,
69 void *buffer, size_t *lenp, loff_t *ppos)
72 container_of(table->data, struct net, ipv4.ip_local_ports.range);
75 struct ctl_table tmp = {
77 .maxlen = sizeof(range),
79 .extra1 = &ip_local_port_range_min,
80 .extra2 = &ip_local_port_range_max,
83 inet_get_local_port_range(net, &range[0], &range[1]);
85 ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
87 if (write && ret == 0) {
88 /* Ensure that the upper limit is not smaller than the lower,
89 * and that the lower does not encroach upon the privileged
92 if ((range[1] < range[0]) ||
93 (range[0] < READ_ONCE(net->ipv4.sysctl_ip_prot_sock)))
96 set_local_port_range(net, range);
102 /* Validate changes from /proc interface. */
103 static int ipv4_privileged_ports(struct ctl_table *table, int write,
104 void *buffer, size_t *lenp, loff_t *ppos)
106 struct net *net = container_of(table->data, struct net,
107 ipv4.sysctl_ip_prot_sock);
111 struct ctl_table tmp = {
113 .maxlen = sizeof(pports),
115 .extra1 = &ip_privileged_port_min,
116 .extra2 = &ip_privileged_port_max,
119 pports = READ_ONCE(net->ipv4.sysctl_ip_prot_sock);
121 ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
123 if (write && ret == 0) {
124 inet_get_local_port_range(net, &range[0], &range[1]);
125 /* Ensure that the local port range doesn't overlap with the
126 * privileged port range.
128 if (range[0] < pports)
131 WRITE_ONCE(net->ipv4.sysctl_ip_prot_sock, pports);
137 static void inet_get_ping_group_range_table(struct ctl_table *table, kgid_t *low, kgid_t *high)
139 kgid_t *data = table->data;
141 container_of(table->data, struct net, ipv4.ping_group_range.range);
144 seq = read_seqbegin(&net->ipv4.ping_group_range.lock);
148 } while (read_seqretry(&net->ipv4.ping_group_range.lock, seq));
151 /* Update system visible IP port range */
152 static void set_ping_group_range(struct ctl_table *table, kgid_t low, kgid_t high)
154 kgid_t *data = table->data;
156 container_of(table->data, struct net, ipv4.ping_group_range.range);
157 write_seqlock(&net->ipv4.ping_group_range.lock);
160 write_sequnlock(&net->ipv4.ping_group_range.lock);
163 /* Validate changes from /proc interface. */
164 static int ipv4_ping_group_range(struct ctl_table *table, int write,
165 void *buffer, size_t *lenp, loff_t *ppos)
167 struct user_namespace *user_ns = current_user_ns();
169 unsigned long urange[2];
171 struct ctl_table tmp = {
173 .maxlen = sizeof(urange),
175 .extra1 = &ip_ping_group_range_min,
176 .extra2 = &ip_ping_group_range_max,
179 inet_get_ping_group_range_table(table, &low, &high);
180 urange[0] = from_kgid_munged(user_ns, low);
181 urange[1] = from_kgid_munged(user_ns, high);
182 ret = proc_doulongvec_minmax(&tmp, write, buffer, lenp, ppos);
184 if (write && ret == 0) {
185 low = make_kgid(user_ns, urange[0]);
186 high = make_kgid(user_ns, urange[1]);
187 if (!gid_valid(low) || !gid_valid(high))
189 if (urange[1] < urange[0] || gid_lt(high, low)) {
190 low = make_kgid(&init_user_ns, 1);
191 high = make_kgid(&init_user_ns, 0);
193 set_ping_group_range(table, low, high);
199 static int ipv4_fwd_update_priority(struct ctl_table *table, int write,
200 void *buffer, size_t *lenp, loff_t *ppos)
205 net = container_of(table->data, struct net,
206 ipv4.sysctl_ip_fwd_update_priority);
207 ret = proc_dou8vec_minmax(table, write, buffer, lenp, ppos);
208 if (write && ret == 0)
209 call_netevent_notifiers(NETEVENT_IPV4_FWD_UPDATE_PRIORITY_UPDATE,
215 static int proc_tcp_congestion_control(struct ctl_table *ctl, int write,
216 void *buffer, size_t *lenp, loff_t *ppos)
218 struct net *net = container_of(ctl->data, struct net,
219 ipv4.tcp_congestion_control);
220 char val[TCP_CA_NAME_MAX];
221 struct ctl_table tbl = {
223 .maxlen = TCP_CA_NAME_MAX,
227 tcp_get_default_congestion_control(net, val);
229 ret = proc_dostring(&tbl, write, buffer, lenp, ppos);
230 if (write && ret == 0)
231 ret = tcp_set_default_congestion_control(net, val);
235 static int proc_tcp_available_congestion_control(struct ctl_table *ctl,
236 int write, void *buffer,
237 size_t *lenp, loff_t *ppos)
239 struct ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX, };
242 tbl.data = kmalloc(tbl.maxlen, GFP_USER);
245 tcp_get_available_congestion_control(tbl.data, TCP_CA_BUF_MAX);
246 ret = proc_dostring(&tbl, write, buffer, lenp, ppos);
251 static int proc_allowed_congestion_control(struct ctl_table *ctl,
252 int write, void *buffer,
253 size_t *lenp, loff_t *ppos)
255 struct ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX };
258 tbl.data = kmalloc(tbl.maxlen, GFP_USER);
262 tcp_get_allowed_congestion_control(tbl.data, tbl.maxlen);
263 ret = proc_dostring(&tbl, write, buffer, lenp, ppos);
264 if (write && ret == 0)
265 ret = tcp_set_allowed_congestion_control(tbl.data);
270 static int sscanf_key(char *buf, __le32 *key)
275 if (sscanf(buf, "%x-%x-%x-%x", user_key, user_key + 1,
276 user_key + 2, user_key + 3) != 4) {
279 for (i = 0; i < ARRAY_SIZE(user_key); i++)
280 key[i] = cpu_to_le32(user_key[i]);
282 pr_debug("proc TFO key set 0x%x-%x-%x-%x <- 0x%s: %u\n",
283 user_key[0], user_key[1], user_key[2], user_key[3], buf, ret);
288 static int proc_tcp_fastopen_key(struct ctl_table *table, int write,
289 void *buffer, size_t *lenp, loff_t *ppos)
291 struct net *net = container_of(table->data, struct net,
292 ipv4.sysctl_tcp_fastopen);
293 /* maxlen to print the list of keys in hex (*2), with dashes
294 * separating doublewords and a comma in between keys.
296 struct ctl_table tbl = { .maxlen = ((TCP_FASTOPEN_KEY_LENGTH *
297 2 * TCP_FASTOPEN_KEY_MAX) +
298 (TCP_FASTOPEN_KEY_MAX * 5)) };
299 u32 user_key[TCP_FASTOPEN_KEY_BUF_LENGTH / sizeof(u32)];
300 __le32 key[TCP_FASTOPEN_KEY_BUF_LENGTH / sizeof(__le32)];
302 int ret, i = 0, off = 0, n_keys;
304 tbl.data = kmalloc(tbl.maxlen, GFP_KERNEL);
308 n_keys = tcp_fastopen_get_cipher(net, NULL, (u64 *)key);
310 memset(&key[0], 0, TCP_FASTOPEN_KEY_LENGTH);
314 for (i = 0; i < n_keys * 4; i++)
315 user_key[i] = le32_to_cpu(key[i]);
317 for (i = 0; i < n_keys; i++) {
318 off += snprintf(tbl.data + off, tbl.maxlen - off,
319 "%08x-%08x-%08x-%08x",
323 user_key[i * 4 + 3]);
325 if (WARN_ON_ONCE(off >= tbl.maxlen - 1))
329 off += snprintf(tbl.data + off, tbl.maxlen - off, ",");
332 ret = proc_dostring(&tbl, write, buffer, lenp, ppos);
334 if (write && ret == 0) {
335 backup_data = strchr(tbl.data, ',');
340 if (sscanf_key(tbl.data, key)) {
345 if (sscanf_key(backup_data, key + 4)) {
350 tcp_fastopen_reset_cipher(net, NULL, key,
351 backup_data ? key + 4 : NULL);
359 static int proc_tfo_blackhole_detect_timeout(struct ctl_table *table,
360 int write, void *buffer,
361 size_t *lenp, loff_t *ppos)
363 struct net *net = container_of(table->data, struct net,
364 ipv4.sysctl_tcp_fastopen_blackhole_timeout);
367 ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
368 if (write && ret == 0)
369 atomic_set(&net->ipv4.tfo_active_disable_times, 0);
374 static int proc_tcp_available_ulp(struct ctl_table *ctl,
375 int write, void *buffer, size_t *lenp,
378 struct ctl_table tbl = { .maxlen = TCP_ULP_BUF_MAX, };
381 tbl.data = kmalloc(tbl.maxlen, GFP_USER);
384 tcp_get_available_ulp(tbl.data, TCP_ULP_BUF_MAX);
385 ret = proc_dostring(&tbl, write, buffer, lenp, ppos);
391 static int proc_tcp_ehash_entries(struct ctl_table *table, int write,
392 void *buffer, size_t *lenp, loff_t *ppos)
394 struct net *net = container_of(table->data, struct net,
395 ipv4.sysctl_tcp_child_ehash_entries);
396 struct inet_hashinfo *hinfo = net->ipv4.tcp_death_row.hashinfo;
397 int tcp_ehash_entries;
398 struct ctl_table tbl;
400 tcp_ehash_entries = hinfo->ehash_mask + 1;
402 /* A negative number indicates that the child netns
403 * shares the global ehash.
405 if (!net_eq(net, &init_net) && !hinfo->pernet)
406 tcp_ehash_entries *= -1;
408 memset(&tbl, 0, sizeof(tbl));
409 tbl.data = &tcp_ehash_entries;
410 tbl.maxlen = sizeof(int);
412 return proc_dointvec(&tbl, write, buffer, lenp, ppos);
415 static int proc_udp_hash_entries(struct ctl_table *table, int write,
416 void *buffer, size_t *lenp, loff_t *ppos)
418 struct net *net = container_of(table->data, struct net,
419 ipv4.sysctl_udp_child_hash_entries);
420 int udp_hash_entries;
421 struct ctl_table tbl;
423 udp_hash_entries = net->ipv4.udp_table->mask + 1;
425 /* A negative number indicates that the child netns
426 * shares the global udp_table.
428 if (!net_eq(net, &init_net) && net->ipv4.udp_table == &udp_table)
429 udp_hash_entries *= -1;
431 memset(&tbl, 0, sizeof(tbl));
432 tbl.data = &udp_hash_entries;
433 tbl.maxlen = sizeof(int);
435 return proc_dointvec(&tbl, write, buffer, lenp, ppos);
438 #ifdef CONFIG_IP_ROUTE_MULTIPATH
439 static int proc_fib_multipath_hash_policy(struct ctl_table *table, int write,
440 void *buffer, size_t *lenp,
443 struct net *net = container_of(table->data, struct net,
444 ipv4.sysctl_fib_multipath_hash_policy);
447 ret = proc_dou8vec_minmax(table, write, buffer, lenp, ppos);
448 if (write && ret == 0)
449 call_netevent_notifiers(NETEVENT_IPV4_MPATH_HASH_UPDATE, net);
454 static int proc_fib_multipath_hash_fields(struct ctl_table *table, int write,
455 void *buffer, size_t *lenp,
461 net = container_of(table->data, struct net,
462 ipv4.sysctl_fib_multipath_hash_fields);
463 ret = proc_douintvec_minmax(table, write, buffer, lenp, ppos);
464 if (write && ret == 0)
465 call_netevent_notifiers(NETEVENT_IPV4_MPATH_HASH_UPDATE, net);
471 static struct ctl_table ipv4_table[] = {
473 .procname = "tcp_max_orphans",
474 .data = &sysctl_tcp_max_orphans,
475 .maxlen = sizeof(int),
477 .proc_handler = proc_dointvec
480 .procname = "inet_peer_threshold",
481 .data = &inet_peer_threshold,
482 .maxlen = sizeof(int),
484 .proc_handler = proc_dointvec
487 .procname = "inet_peer_minttl",
488 .data = &inet_peer_minttl,
489 .maxlen = sizeof(int),
491 .proc_handler = proc_dointvec_jiffies,
494 .procname = "inet_peer_maxttl",
495 .data = &inet_peer_maxttl,
496 .maxlen = sizeof(int),
498 .proc_handler = proc_dointvec_jiffies,
501 .procname = "tcp_mem",
502 .maxlen = sizeof(sysctl_tcp_mem),
503 .data = &sysctl_tcp_mem,
505 .proc_handler = proc_doulongvec_minmax,
508 .procname = "tcp_low_latency",
509 .data = &sysctl_tcp_low_latency,
510 .maxlen = sizeof(int),
512 .proc_handler = proc_dointvec
514 #ifdef CONFIG_NETLABEL
516 .procname = "cipso_cache_enable",
517 .data = &cipso_v4_cache_enabled,
518 .maxlen = sizeof(int),
520 .proc_handler = proc_dointvec,
523 .procname = "cipso_cache_bucket_size",
524 .data = &cipso_v4_cache_bucketsize,
525 .maxlen = sizeof(int),
527 .proc_handler = proc_dointvec,
530 .procname = "cipso_rbm_optfmt",
531 .data = &cipso_v4_rbm_optfmt,
532 .maxlen = sizeof(int),
534 .proc_handler = proc_dointvec,
537 .procname = "cipso_rbm_strictvalid",
538 .data = &cipso_v4_rbm_strictvalid,
539 .maxlen = sizeof(int),
541 .proc_handler = proc_dointvec,
543 #endif /* CONFIG_NETLABEL */
545 .procname = "tcp_available_ulp",
546 .maxlen = TCP_ULP_BUF_MAX,
548 .proc_handler = proc_tcp_available_ulp,
551 .procname = "icmp_msgs_per_sec",
552 .data = &sysctl_icmp_msgs_per_sec,
553 .maxlen = sizeof(int),
555 .proc_handler = proc_dointvec_minmax,
556 .extra1 = SYSCTL_ZERO,
559 .procname = "icmp_msgs_burst",
560 .data = &sysctl_icmp_msgs_burst,
561 .maxlen = sizeof(int),
563 .proc_handler = proc_dointvec_minmax,
564 .extra1 = SYSCTL_ZERO,
567 .procname = "udp_mem",
568 .data = &sysctl_udp_mem,
569 .maxlen = sizeof(sysctl_udp_mem),
571 .proc_handler = proc_doulongvec_minmax,
574 .procname = "fib_sync_mem",
575 .data = &sysctl_fib_sync_mem,
576 .maxlen = sizeof(sysctl_fib_sync_mem),
578 .proc_handler = proc_douintvec_minmax,
579 .extra1 = &sysctl_fib_sync_mem_min,
580 .extra2 = &sysctl_fib_sync_mem_max,
585 static struct ctl_table ipv4_net_table[] = {
587 .procname = "tcp_max_tw_buckets",
588 .data = &init_net.ipv4.tcp_death_row.sysctl_max_tw_buckets,
589 .maxlen = sizeof(int),
591 .proc_handler = proc_dointvec
594 .procname = "icmp_echo_ignore_all",
595 .data = &init_net.ipv4.sysctl_icmp_echo_ignore_all,
596 .maxlen = sizeof(u8),
598 .proc_handler = proc_dou8vec_minmax,
599 .extra1 = SYSCTL_ZERO,
603 .procname = "icmp_echo_enable_probe",
604 .data = &init_net.ipv4.sysctl_icmp_echo_enable_probe,
605 .maxlen = sizeof(u8),
607 .proc_handler = proc_dou8vec_minmax,
608 .extra1 = SYSCTL_ZERO,
612 .procname = "icmp_echo_ignore_broadcasts",
613 .data = &init_net.ipv4.sysctl_icmp_echo_ignore_broadcasts,
614 .maxlen = sizeof(u8),
616 .proc_handler = proc_dou8vec_minmax,
617 .extra1 = SYSCTL_ZERO,
621 .procname = "icmp_ignore_bogus_error_responses",
622 .data = &init_net.ipv4.sysctl_icmp_ignore_bogus_error_responses,
623 .maxlen = sizeof(u8),
625 .proc_handler = proc_dou8vec_minmax,
626 .extra1 = SYSCTL_ZERO,
630 .procname = "icmp_errors_use_inbound_ifaddr",
631 .data = &init_net.ipv4.sysctl_icmp_errors_use_inbound_ifaddr,
632 .maxlen = sizeof(u8),
634 .proc_handler = proc_dou8vec_minmax,
635 .extra1 = SYSCTL_ZERO,
639 .procname = "icmp_ratelimit",
640 .data = &init_net.ipv4.sysctl_icmp_ratelimit,
641 .maxlen = sizeof(int),
643 .proc_handler = proc_dointvec_ms_jiffies,
646 .procname = "icmp_ratemask",
647 .data = &init_net.ipv4.sysctl_icmp_ratemask,
648 .maxlen = sizeof(int),
650 .proc_handler = proc_dointvec
653 .procname = "ping_group_range",
654 .data = &init_net.ipv4.ping_group_range.range,
655 .maxlen = sizeof(gid_t)*2,
657 .proc_handler = ipv4_ping_group_range,
659 #ifdef CONFIG_NET_L3_MASTER_DEV
661 .procname = "raw_l3mdev_accept",
662 .data = &init_net.ipv4.sysctl_raw_l3mdev_accept,
663 .maxlen = sizeof(u8),
665 .proc_handler = proc_dou8vec_minmax,
666 .extra1 = SYSCTL_ZERO,
667 .extra2 = SYSCTL_ONE,
671 .procname = "tcp_ecn",
672 .data = &init_net.ipv4.sysctl_tcp_ecn,
673 .maxlen = sizeof(u8),
675 .proc_handler = proc_dou8vec_minmax,
676 .extra1 = SYSCTL_ZERO,
677 .extra2 = SYSCTL_TWO,
680 .procname = "tcp_ecn_fallback",
681 .data = &init_net.ipv4.sysctl_tcp_ecn_fallback,
682 .maxlen = sizeof(u8),
684 .proc_handler = proc_dou8vec_minmax,
685 .extra1 = SYSCTL_ZERO,
686 .extra2 = SYSCTL_ONE,
689 .procname = "ip_dynaddr",
690 .data = &init_net.ipv4.sysctl_ip_dynaddr,
691 .maxlen = sizeof(u8),
693 .proc_handler = proc_dou8vec_minmax,
696 .procname = "ip_early_demux",
697 .data = &init_net.ipv4.sysctl_ip_early_demux,
698 .maxlen = sizeof(u8),
700 .proc_handler = proc_dou8vec_minmax,
703 .procname = "udp_early_demux",
704 .data = &init_net.ipv4.sysctl_udp_early_demux,
705 .maxlen = sizeof(u8),
707 .proc_handler = proc_dou8vec_minmax,
710 .procname = "tcp_early_demux",
711 .data = &init_net.ipv4.sysctl_tcp_early_demux,
712 .maxlen = sizeof(u8),
714 .proc_handler = proc_dou8vec_minmax,
717 .procname = "nexthop_compat_mode",
718 .data = &init_net.ipv4.sysctl_nexthop_compat_mode,
719 .maxlen = sizeof(u8),
721 .proc_handler = proc_dou8vec_minmax,
722 .extra1 = SYSCTL_ZERO,
723 .extra2 = SYSCTL_ONE,
726 .procname = "ip_default_ttl",
727 .data = &init_net.ipv4.sysctl_ip_default_ttl,
728 .maxlen = sizeof(u8),
730 .proc_handler = proc_dou8vec_minmax,
731 .extra1 = &ip_ttl_min,
732 .extra2 = &ip_ttl_max,
735 .procname = "ip_local_port_range",
736 .maxlen = sizeof(init_net.ipv4.ip_local_ports.range),
737 .data = &init_net.ipv4.ip_local_ports.range,
739 .proc_handler = ipv4_local_port_range,
742 .procname = "ip_local_reserved_ports",
743 .data = &init_net.ipv4.sysctl_local_reserved_ports,
746 .proc_handler = proc_do_large_bitmap,
749 .procname = "ip_no_pmtu_disc",
750 .data = &init_net.ipv4.sysctl_ip_no_pmtu_disc,
751 .maxlen = sizeof(u8),
753 .proc_handler = proc_dou8vec_minmax,
756 .procname = "ip_forward_use_pmtu",
757 .data = &init_net.ipv4.sysctl_ip_fwd_use_pmtu,
758 .maxlen = sizeof(u8),
760 .proc_handler = proc_dou8vec_minmax,
763 .procname = "ip_forward_update_priority",
764 .data = &init_net.ipv4.sysctl_ip_fwd_update_priority,
765 .maxlen = sizeof(u8),
767 .proc_handler = ipv4_fwd_update_priority,
768 .extra1 = SYSCTL_ZERO,
769 .extra2 = SYSCTL_ONE,
772 .procname = "ip_nonlocal_bind",
773 .data = &init_net.ipv4.sysctl_ip_nonlocal_bind,
774 .maxlen = sizeof(u8),
776 .proc_handler = proc_dou8vec_minmax,
779 .procname = "ip_autobind_reuse",
780 .data = &init_net.ipv4.sysctl_ip_autobind_reuse,
781 .maxlen = sizeof(u8),
783 .proc_handler = proc_dou8vec_minmax,
784 .extra1 = SYSCTL_ZERO,
785 .extra2 = SYSCTL_ONE,
788 .procname = "fwmark_reflect",
789 .data = &init_net.ipv4.sysctl_fwmark_reflect,
790 .maxlen = sizeof(u8),
792 .proc_handler = proc_dou8vec_minmax,
795 .procname = "tcp_fwmark_accept",
796 .data = &init_net.ipv4.sysctl_tcp_fwmark_accept,
797 .maxlen = sizeof(u8),
799 .proc_handler = proc_dou8vec_minmax,
801 #ifdef CONFIG_NET_L3_MASTER_DEV
803 .procname = "tcp_l3mdev_accept",
804 .data = &init_net.ipv4.sysctl_tcp_l3mdev_accept,
805 .maxlen = sizeof(u8),
807 .proc_handler = proc_dou8vec_minmax,
808 .extra1 = SYSCTL_ZERO,
809 .extra2 = SYSCTL_ONE,
813 .procname = "tcp_mtu_probing",
814 .data = &init_net.ipv4.sysctl_tcp_mtu_probing,
815 .maxlen = sizeof(u8),
817 .proc_handler = proc_dou8vec_minmax,
820 .procname = "tcp_base_mss",
821 .data = &init_net.ipv4.sysctl_tcp_base_mss,
822 .maxlen = sizeof(int),
824 .proc_handler = proc_dointvec,
827 .procname = "tcp_min_snd_mss",
828 .data = &init_net.ipv4.sysctl_tcp_min_snd_mss,
829 .maxlen = sizeof(int),
831 .proc_handler = proc_dointvec_minmax,
832 .extra1 = &tcp_min_snd_mss_min,
833 .extra2 = &tcp_min_snd_mss_max,
836 .procname = "tcp_mtu_probe_floor",
837 .data = &init_net.ipv4.sysctl_tcp_mtu_probe_floor,
838 .maxlen = sizeof(int),
840 .proc_handler = proc_dointvec_minmax,
841 .extra1 = &tcp_min_snd_mss_min,
842 .extra2 = &tcp_min_snd_mss_max,
845 .procname = "tcp_probe_threshold",
846 .data = &init_net.ipv4.sysctl_tcp_probe_threshold,
847 .maxlen = sizeof(int),
849 .proc_handler = proc_dointvec,
852 .procname = "tcp_probe_interval",
853 .data = &init_net.ipv4.sysctl_tcp_probe_interval,
854 .maxlen = sizeof(u32),
856 .proc_handler = proc_douintvec_minmax,
857 .extra2 = &u32_max_div_HZ,
860 .procname = "igmp_link_local_mcast_reports",
861 .data = &init_net.ipv4.sysctl_igmp_llm_reports,
862 .maxlen = sizeof(u8),
864 .proc_handler = proc_dou8vec_minmax,
867 .procname = "igmp_max_memberships",
868 .data = &init_net.ipv4.sysctl_igmp_max_memberships,
869 .maxlen = sizeof(int),
871 .proc_handler = proc_dointvec
874 .procname = "igmp_max_msf",
875 .data = &init_net.ipv4.sysctl_igmp_max_msf,
876 .maxlen = sizeof(int),
878 .proc_handler = proc_dointvec
880 #ifdef CONFIG_IP_MULTICAST
882 .procname = "igmp_qrv",
883 .data = &init_net.ipv4.sysctl_igmp_qrv,
884 .maxlen = sizeof(int),
886 .proc_handler = proc_dointvec_minmax,
891 .procname = "tcp_congestion_control",
892 .data = &init_net.ipv4.tcp_congestion_control,
894 .maxlen = TCP_CA_NAME_MAX,
895 .proc_handler = proc_tcp_congestion_control,
898 .procname = "tcp_available_congestion_control",
899 .maxlen = TCP_CA_BUF_MAX,
901 .proc_handler = proc_tcp_available_congestion_control,
904 .procname = "tcp_allowed_congestion_control",
905 .maxlen = TCP_CA_BUF_MAX,
907 .proc_handler = proc_allowed_congestion_control,
910 .procname = "tcp_keepalive_time",
911 .data = &init_net.ipv4.sysctl_tcp_keepalive_time,
912 .maxlen = sizeof(int),
914 .proc_handler = proc_dointvec_jiffies,
917 .procname = "tcp_keepalive_probes",
918 .data = &init_net.ipv4.sysctl_tcp_keepalive_probes,
919 .maxlen = sizeof(u8),
921 .proc_handler = proc_dou8vec_minmax,
924 .procname = "tcp_keepalive_intvl",
925 .data = &init_net.ipv4.sysctl_tcp_keepalive_intvl,
926 .maxlen = sizeof(int),
928 .proc_handler = proc_dointvec_jiffies,
931 .procname = "tcp_syn_retries",
932 .data = &init_net.ipv4.sysctl_tcp_syn_retries,
933 .maxlen = sizeof(u8),
935 .proc_handler = proc_dou8vec_minmax,
936 .extra1 = &tcp_syn_retries_min,
937 .extra2 = &tcp_syn_retries_max
940 .procname = "tcp_synack_retries",
941 .data = &init_net.ipv4.sysctl_tcp_synack_retries,
942 .maxlen = sizeof(u8),
944 .proc_handler = proc_dou8vec_minmax,
946 #ifdef CONFIG_SYN_COOKIES
948 .procname = "tcp_syncookies",
949 .data = &init_net.ipv4.sysctl_tcp_syncookies,
950 .maxlen = sizeof(u8),
952 .proc_handler = proc_dou8vec_minmax,
956 .procname = "tcp_migrate_req",
957 .data = &init_net.ipv4.sysctl_tcp_migrate_req,
958 .maxlen = sizeof(u8),
960 .proc_handler = proc_dou8vec_minmax,
961 .extra1 = SYSCTL_ZERO,
965 .procname = "tcp_reordering",
966 .data = &init_net.ipv4.sysctl_tcp_reordering,
967 .maxlen = sizeof(int),
969 .proc_handler = proc_dointvec
972 .procname = "tcp_retries1",
973 .data = &init_net.ipv4.sysctl_tcp_retries1,
974 .maxlen = sizeof(u8),
976 .proc_handler = proc_dou8vec_minmax,
977 .extra2 = &tcp_retr1_max
980 .procname = "tcp_retries2",
981 .data = &init_net.ipv4.sysctl_tcp_retries2,
982 .maxlen = sizeof(u8),
984 .proc_handler = proc_dou8vec_minmax,
987 .procname = "tcp_orphan_retries",
988 .data = &init_net.ipv4.sysctl_tcp_orphan_retries,
989 .maxlen = sizeof(u8),
991 .proc_handler = proc_dou8vec_minmax,
994 .procname = "tcp_fin_timeout",
995 .data = &init_net.ipv4.sysctl_tcp_fin_timeout,
996 .maxlen = sizeof(int),
998 .proc_handler = proc_dointvec_jiffies,
1001 .procname = "tcp_notsent_lowat",
1002 .data = &init_net.ipv4.sysctl_tcp_notsent_lowat,
1003 .maxlen = sizeof(unsigned int),
1005 .proc_handler = proc_douintvec,
1008 .procname = "tcp_tw_reuse",
1009 .data = &init_net.ipv4.sysctl_tcp_tw_reuse,
1010 .maxlen = sizeof(u8),
1012 .proc_handler = proc_dou8vec_minmax,
1013 .extra1 = SYSCTL_ZERO,
1014 .extra2 = SYSCTL_TWO,
1017 .procname = "tcp_max_syn_backlog",
1018 .data = &init_net.ipv4.sysctl_max_syn_backlog,
1019 .maxlen = sizeof(int),
1021 .proc_handler = proc_dointvec
1024 .procname = "tcp_fastopen",
1025 .data = &init_net.ipv4.sysctl_tcp_fastopen,
1026 .maxlen = sizeof(int),
1028 .proc_handler = proc_dointvec,
1031 .procname = "tcp_fastopen_key",
1033 .data = &init_net.ipv4.sysctl_tcp_fastopen,
1034 /* maxlen to print the list of keys in hex (*2), with dashes
1035 * separating doublewords and a comma in between keys.
1037 .maxlen = ((TCP_FASTOPEN_KEY_LENGTH *
1038 2 * TCP_FASTOPEN_KEY_MAX) +
1039 (TCP_FASTOPEN_KEY_MAX * 5)),
1040 .proc_handler = proc_tcp_fastopen_key,
1043 .procname = "tcp_fastopen_blackhole_timeout_sec",
1044 .data = &init_net.ipv4.sysctl_tcp_fastopen_blackhole_timeout,
1045 .maxlen = sizeof(int),
1047 .proc_handler = proc_tfo_blackhole_detect_timeout,
1048 .extra1 = SYSCTL_ZERO,
1050 #ifdef CONFIG_IP_ROUTE_MULTIPATH
1052 .procname = "fib_multipath_use_neigh",
1053 .data = &init_net.ipv4.sysctl_fib_multipath_use_neigh,
1054 .maxlen = sizeof(u8),
1056 .proc_handler = proc_dou8vec_minmax,
1057 .extra1 = SYSCTL_ZERO,
1058 .extra2 = SYSCTL_ONE,
1061 .procname = "fib_multipath_hash_policy",
1062 .data = &init_net.ipv4.sysctl_fib_multipath_hash_policy,
1063 .maxlen = sizeof(u8),
1065 .proc_handler = proc_fib_multipath_hash_policy,
1066 .extra1 = SYSCTL_ZERO,
1067 .extra2 = SYSCTL_THREE,
1070 .procname = "fib_multipath_hash_fields",
1071 .data = &init_net.ipv4.sysctl_fib_multipath_hash_fields,
1072 .maxlen = sizeof(u32),
1074 .proc_handler = proc_fib_multipath_hash_fields,
1075 .extra1 = SYSCTL_ONE,
1076 .extra2 = &fib_multipath_hash_fields_all_mask,
1080 .procname = "ip_unprivileged_port_start",
1081 .maxlen = sizeof(int),
1082 .data = &init_net.ipv4.sysctl_ip_prot_sock,
1084 .proc_handler = ipv4_privileged_ports,
1086 #ifdef CONFIG_NET_L3_MASTER_DEV
1088 .procname = "udp_l3mdev_accept",
1089 .data = &init_net.ipv4.sysctl_udp_l3mdev_accept,
1090 .maxlen = sizeof(u8),
1092 .proc_handler = proc_dou8vec_minmax,
1093 .extra1 = SYSCTL_ZERO,
1094 .extra2 = SYSCTL_ONE,
1098 .procname = "tcp_sack",
1099 .data = &init_net.ipv4.sysctl_tcp_sack,
1100 .maxlen = sizeof(u8),
1102 .proc_handler = proc_dou8vec_minmax,
1105 .procname = "tcp_window_scaling",
1106 .data = &init_net.ipv4.sysctl_tcp_window_scaling,
1107 .maxlen = sizeof(u8),
1109 .proc_handler = proc_dou8vec_minmax,
1112 .procname = "tcp_timestamps",
1113 .data = &init_net.ipv4.sysctl_tcp_timestamps,
1114 .maxlen = sizeof(u8),
1116 .proc_handler = proc_dou8vec_minmax,
1119 .procname = "tcp_early_retrans",
1120 .data = &init_net.ipv4.sysctl_tcp_early_retrans,
1121 .maxlen = sizeof(u8),
1123 .proc_handler = proc_dou8vec_minmax,
1124 .extra1 = SYSCTL_ZERO,
1125 .extra2 = SYSCTL_FOUR,
1128 .procname = "tcp_recovery",
1129 .data = &init_net.ipv4.sysctl_tcp_recovery,
1130 .maxlen = sizeof(u8),
1132 .proc_handler = proc_dou8vec_minmax,
1135 .procname = "tcp_thin_linear_timeouts",
1136 .data = &init_net.ipv4.sysctl_tcp_thin_linear_timeouts,
1137 .maxlen = sizeof(u8),
1139 .proc_handler = proc_dou8vec_minmax,
1142 .procname = "tcp_slow_start_after_idle",
1143 .data = &init_net.ipv4.sysctl_tcp_slow_start_after_idle,
1144 .maxlen = sizeof(u8),
1146 .proc_handler = proc_dou8vec_minmax,
1149 .procname = "tcp_retrans_collapse",
1150 .data = &init_net.ipv4.sysctl_tcp_retrans_collapse,
1151 .maxlen = sizeof(u8),
1153 .proc_handler = proc_dou8vec_minmax,
1156 .procname = "tcp_stdurg",
1157 .data = &init_net.ipv4.sysctl_tcp_stdurg,
1158 .maxlen = sizeof(u8),
1160 .proc_handler = proc_dou8vec_minmax,
1163 .procname = "tcp_rfc1337",
1164 .data = &init_net.ipv4.sysctl_tcp_rfc1337,
1165 .maxlen = sizeof(u8),
1167 .proc_handler = proc_dou8vec_minmax,
1170 .procname = "tcp_abort_on_overflow",
1171 .data = &init_net.ipv4.sysctl_tcp_abort_on_overflow,
1172 .maxlen = sizeof(u8),
1174 .proc_handler = proc_dou8vec_minmax,
1177 .procname = "tcp_fack",
1178 .data = &init_net.ipv4.sysctl_tcp_fack,
1179 .maxlen = sizeof(u8),
1181 .proc_handler = proc_dou8vec_minmax,
1184 .procname = "tcp_max_reordering",
1185 .data = &init_net.ipv4.sysctl_tcp_max_reordering,
1186 .maxlen = sizeof(int),
1188 .proc_handler = proc_dointvec
1191 .procname = "tcp_dsack",
1192 .data = &init_net.ipv4.sysctl_tcp_dsack,
1193 .maxlen = sizeof(u8),
1195 .proc_handler = proc_dou8vec_minmax,
1198 .procname = "tcp_app_win",
1199 .data = &init_net.ipv4.sysctl_tcp_app_win,
1200 .maxlen = sizeof(u8),
1202 .proc_handler = proc_dou8vec_minmax,
1203 .extra1 = SYSCTL_ZERO,
1204 .extra2 = &tcp_app_win_max,
1207 .procname = "tcp_adv_win_scale",
1208 .data = &init_net.ipv4.sysctl_tcp_adv_win_scale,
1209 .maxlen = sizeof(int),
1211 .proc_handler = proc_dointvec_minmax,
1212 .extra1 = &tcp_adv_win_scale_min,
1213 .extra2 = &tcp_adv_win_scale_max,
1216 .procname = "tcp_frto",
1217 .data = &init_net.ipv4.sysctl_tcp_frto,
1218 .maxlen = sizeof(u8),
1220 .proc_handler = proc_dou8vec_minmax,
1223 .procname = "tcp_no_metrics_save",
1224 .data = &init_net.ipv4.sysctl_tcp_nometrics_save,
1225 .maxlen = sizeof(u8),
1227 .proc_handler = proc_dou8vec_minmax,
1230 .procname = "tcp_no_ssthresh_metrics_save",
1231 .data = &init_net.ipv4.sysctl_tcp_no_ssthresh_metrics_save,
1232 .maxlen = sizeof(u8),
1234 .proc_handler = proc_dou8vec_minmax,
1235 .extra1 = SYSCTL_ZERO,
1236 .extra2 = SYSCTL_ONE,
1239 .procname = "tcp_moderate_rcvbuf",
1240 .data = &init_net.ipv4.sysctl_tcp_moderate_rcvbuf,
1241 .maxlen = sizeof(u8),
1243 .proc_handler = proc_dou8vec_minmax,
1246 .procname = "tcp_tso_win_divisor",
1247 .data = &init_net.ipv4.sysctl_tcp_tso_win_divisor,
1248 .maxlen = sizeof(u8),
1250 .proc_handler = proc_dou8vec_minmax,
1253 .procname = "tcp_workaround_signed_windows",
1254 .data = &init_net.ipv4.sysctl_tcp_workaround_signed_windows,
1255 .maxlen = sizeof(u8),
1257 .proc_handler = proc_dou8vec_minmax,
1260 .procname = "tcp_limit_output_bytes",
1261 .data = &init_net.ipv4.sysctl_tcp_limit_output_bytes,
1262 .maxlen = sizeof(int),
1264 .proc_handler = proc_dointvec
1267 .procname = "tcp_challenge_ack_limit",
1268 .data = &init_net.ipv4.sysctl_tcp_challenge_ack_limit,
1269 .maxlen = sizeof(int),
1271 .proc_handler = proc_dointvec
1274 .procname = "tcp_min_tso_segs",
1275 .data = &init_net.ipv4.sysctl_tcp_min_tso_segs,
1276 .maxlen = sizeof(u8),
1278 .proc_handler = proc_dou8vec_minmax,
1279 .extra1 = SYSCTL_ONE,
1282 .procname = "tcp_tso_rtt_log",
1283 .data = &init_net.ipv4.sysctl_tcp_tso_rtt_log,
1284 .maxlen = sizeof(u8),
1286 .proc_handler = proc_dou8vec_minmax,
1289 .procname = "tcp_min_rtt_wlen",
1290 .data = &init_net.ipv4.sysctl_tcp_min_rtt_wlen,
1291 .maxlen = sizeof(int),
1293 .proc_handler = proc_dointvec_minmax,
1294 .extra1 = SYSCTL_ZERO,
1295 .extra2 = &one_day_secs
1298 .procname = "tcp_autocorking",
1299 .data = &init_net.ipv4.sysctl_tcp_autocorking,
1300 .maxlen = sizeof(u8),
1302 .proc_handler = proc_dou8vec_minmax,
1303 .extra1 = SYSCTL_ZERO,
1304 .extra2 = SYSCTL_ONE,
1307 .procname = "tcp_invalid_ratelimit",
1308 .data = &init_net.ipv4.sysctl_tcp_invalid_ratelimit,
1309 .maxlen = sizeof(int),
1311 .proc_handler = proc_dointvec_ms_jiffies,
1314 .procname = "tcp_pacing_ss_ratio",
1315 .data = &init_net.ipv4.sysctl_tcp_pacing_ss_ratio,
1316 .maxlen = sizeof(int),
1318 .proc_handler = proc_dointvec_minmax,
1319 .extra1 = SYSCTL_ZERO,
1320 .extra2 = SYSCTL_ONE_THOUSAND,
1323 .procname = "tcp_pacing_ca_ratio",
1324 .data = &init_net.ipv4.sysctl_tcp_pacing_ca_ratio,
1325 .maxlen = sizeof(int),
1327 .proc_handler = proc_dointvec_minmax,
1328 .extra1 = SYSCTL_ZERO,
1329 .extra2 = SYSCTL_ONE_THOUSAND,
1332 .procname = "tcp_wmem",
1333 .data = &init_net.ipv4.sysctl_tcp_wmem,
1334 .maxlen = sizeof(init_net.ipv4.sysctl_tcp_wmem),
1336 .proc_handler = proc_dointvec_minmax,
1337 .extra1 = SYSCTL_ONE,
1340 .procname = "tcp_rmem",
1341 .data = &init_net.ipv4.sysctl_tcp_rmem,
1342 .maxlen = sizeof(init_net.ipv4.sysctl_tcp_rmem),
1344 .proc_handler = proc_dointvec_minmax,
1345 .extra1 = SYSCTL_ONE,
1348 .procname = "tcp_comp_sack_delay_ns",
1349 .data = &init_net.ipv4.sysctl_tcp_comp_sack_delay_ns,
1350 .maxlen = sizeof(unsigned long),
1352 .proc_handler = proc_doulongvec_minmax,
1355 .procname = "tcp_comp_sack_slack_ns",
1356 .data = &init_net.ipv4.sysctl_tcp_comp_sack_slack_ns,
1357 .maxlen = sizeof(unsigned long),
1359 .proc_handler = proc_doulongvec_minmax,
1362 .procname = "tcp_comp_sack_nr",
1363 .data = &init_net.ipv4.sysctl_tcp_comp_sack_nr,
1364 .maxlen = sizeof(u8),
1366 .proc_handler = proc_dou8vec_minmax,
1367 .extra1 = SYSCTL_ZERO,
1370 .procname = "tcp_backlog_ack_defer",
1371 .data = &init_net.ipv4.sysctl_tcp_backlog_ack_defer,
1372 .maxlen = sizeof(u8),
1374 .proc_handler = proc_dou8vec_minmax,
1375 .extra1 = SYSCTL_ZERO,
1376 .extra2 = SYSCTL_ONE,
1379 .procname = "tcp_reflect_tos",
1380 .data = &init_net.ipv4.sysctl_tcp_reflect_tos,
1381 .maxlen = sizeof(u8),
1383 .proc_handler = proc_dou8vec_minmax,
1384 .extra1 = SYSCTL_ZERO,
1385 .extra2 = SYSCTL_ONE,
1388 .procname = "tcp_ehash_entries",
1389 .data = &init_net.ipv4.sysctl_tcp_child_ehash_entries,
1391 .proc_handler = proc_tcp_ehash_entries,
1394 .procname = "tcp_child_ehash_entries",
1395 .data = &init_net.ipv4.sysctl_tcp_child_ehash_entries,
1396 .maxlen = sizeof(unsigned int),
1398 .proc_handler = proc_douintvec_minmax,
1399 .extra1 = SYSCTL_ZERO,
1400 .extra2 = &tcp_child_ehash_entries_max,
1403 .procname = "udp_hash_entries",
1404 .data = &init_net.ipv4.sysctl_udp_child_hash_entries,
1406 .proc_handler = proc_udp_hash_entries,
1409 .procname = "udp_child_hash_entries",
1410 .data = &init_net.ipv4.sysctl_udp_child_hash_entries,
1411 .maxlen = sizeof(unsigned int),
1413 .proc_handler = proc_douintvec_minmax,
1414 .extra1 = SYSCTL_ZERO,
1415 .extra2 = &udp_child_hash_entries_max,
1418 .procname = "udp_rmem_min",
1419 .data = &init_net.ipv4.sysctl_udp_rmem_min,
1420 .maxlen = sizeof(init_net.ipv4.sysctl_udp_rmem_min),
1422 .proc_handler = proc_dointvec_minmax,
1423 .extra1 = SYSCTL_ONE
1426 .procname = "udp_wmem_min",
1427 .data = &init_net.ipv4.sysctl_udp_wmem_min,
1428 .maxlen = sizeof(init_net.ipv4.sysctl_udp_wmem_min),
1430 .proc_handler = proc_dointvec_minmax,
1431 .extra1 = SYSCTL_ONE
1434 .procname = "fib_notify_on_flag_change",
1435 .data = &init_net.ipv4.sysctl_fib_notify_on_flag_change,
1436 .maxlen = sizeof(u8),
1438 .proc_handler = proc_dou8vec_minmax,
1439 .extra1 = SYSCTL_ZERO,
1440 .extra2 = SYSCTL_TWO,
1443 .procname = "tcp_plb_enabled",
1444 .data = &init_net.ipv4.sysctl_tcp_plb_enabled,
1445 .maxlen = sizeof(u8),
1447 .proc_handler = proc_dou8vec_minmax,
1448 .extra1 = SYSCTL_ZERO,
1449 .extra2 = SYSCTL_ONE,
1452 .procname = "tcp_plb_idle_rehash_rounds",
1453 .data = &init_net.ipv4.sysctl_tcp_plb_idle_rehash_rounds,
1454 .maxlen = sizeof(u8),
1456 .proc_handler = proc_dou8vec_minmax,
1457 .extra2 = &tcp_plb_max_rounds,
1460 .procname = "tcp_plb_rehash_rounds",
1461 .data = &init_net.ipv4.sysctl_tcp_plb_rehash_rounds,
1462 .maxlen = sizeof(u8),
1464 .proc_handler = proc_dou8vec_minmax,
1465 .extra2 = &tcp_plb_max_rounds,
1468 .procname = "tcp_plb_suspend_rto_sec",
1469 .data = &init_net.ipv4.sysctl_tcp_plb_suspend_rto_sec,
1470 .maxlen = sizeof(u8),
1472 .proc_handler = proc_dou8vec_minmax,
1475 .procname = "tcp_plb_cong_thresh",
1476 .data = &init_net.ipv4.sysctl_tcp_plb_cong_thresh,
1477 .maxlen = sizeof(int),
1479 .proc_handler = proc_dointvec_minmax,
1480 .extra1 = SYSCTL_ZERO,
1481 .extra2 = &tcp_plb_max_cong_thresh,
1484 .procname = "tcp_syn_linear_timeouts",
1485 .data = &init_net.ipv4.sysctl_tcp_syn_linear_timeouts,
1486 .maxlen = sizeof(u8),
1488 .proc_handler = proc_dou8vec_minmax,
1489 .extra1 = SYSCTL_ZERO,
1490 .extra2 = &tcp_syn_linear_timeouts_max,
1493 .procname = "tcp_shrink_window",
1494 .data = &init_net.ipv4.sysctl_tcp_shrink_window,
1495 .maxlen = sizeof(u8),
1497 .proc_handler = proc_dou8vec_minmax,
1498 .extra1 = SYSCTL_ZERO,
1499 .extra2 = SYSCTL_ONE,
1502 .procname = "tcp_pingpong_thresh",
1503 .data = &init_net.ipv4.sysctl_tcp_pingpong_thresh,
1504 .maxlen = sizeof(u8),
1506 .proc_handler = proc_dou8vec_minmax,
1507 .extra1 = SYSCTL_ONE,
1512 static __net_init int ipv4_sysctl_init_net(struct net *net)
1514 struct ctl_table *table;
1516 table = ipv4_net_table;
1517 if (!net_eq(net, &init_net)) {
1520 table = kmemdup(table, sizeof(ipv4_net_table), GFP_KERNEL);
1524 for (i = 0; i < ARRAY_SIZE(ipv4_net_table) - 1; i++) {
1525 if (table[i].data) {
1526 /* Update the variables to point into
1527 * the current struct net
1529 table[i].data += (void *)net - (void *)&init_net;
1531 /* Entries without data pointer are global;
1532 * Make them read-only in non-init_net ns
1534 table[i].mode &= ~0222;
1539 net->ipv4.ipv4_hdr = register_net_sysctl_sz(net, "net/ipv4", table,
1540 ARRAY_SIZE(ipv4_net_table));
1541 if (!net->ipv4.ipv4_hdr)
1544 net->ipv4.sysctl_local_reserved_ports = kzalloc(65536 / 8, GFP_KERNEL);
1545 if (!net->ipv4.sysctl_local_reserved_ports)
1551 unregister_net_sysctl_table(net->ipv4.ipv4_hdr);
1553 if (!net_eq(net, &init_net))
1559 static __net_exit void ipv4_sysctl_exit_net(struct net *net)
1561 struct ctl_table *table;
1563 kfree(net->ipv4.sysctl_local_reserved_ports);
1564 table = net->ipv4.ipv4_hdr->ctl_table_arg;
1565 unregister_net_sysctl_table(net->ipv4.ipv4_hdr);
1569 static __net_initdata struct pernet_operations ipv4_sysctl_ops = {
1570 .init = ipv4_sysctl_init_net,
1571 .exit = ipv4_sysctl_exit_net,
1574 static __init int sysctl_ipv4_init(void)
1576 struct ctl_table_header *hdr;
1578 hdr = register_net_sysctl(&init_net, "net/ipv4", ipv4_table);
1582 if (register_pernet_subsys(&ipv4_sysctl_ops)) {
1583 unregister_net_sysctl_table(hdr);
1590 __initcall(sysctl_ipv4_init);