Commit | Line | Data |
---|---|---|
b2441318 | 1 | // SPDX-License-Identifier: GPL-2.0 |
1da177e4 LT |
2 | /* |
3 | * sysctl_net_ipv4.c: sysctl interface to net IPV4 subsystem. | |
4 | * | |
1da177e4 LT |
5 | * Begun April 1, 1996, Mike Shaver. |
6 | * Added /proc/sys/net/ipv4 directory entry (empty =) ). [MS] | |
7 | */ | |
8 | ||
9 | #include <linux/mm.h> | |
10 | #include <linux/module.h> | |
11 | #include <linux/sysctl.h> | |
20380731 | 12 | #include <linux/igmp.h> |
14c85021 | 13 | #include <linux/inetdevice.h> |
227b60f5 | 14 | #include <linux/seqlock.h> |
3e37c3f9 | 15 | #include <linux/init.h> |
5a0e3ad6 | 16 | #include <linux/slab.h> |
c319b4d7 | 17 | #include <linux/nsproxy.h> |
3dc43e3e | 18 | #include <linux/swap.h> |
1da177e4 | 19 | #include <net/snmp.h> |
20380731 | 20 | #include <net/icmp.h> |
1da177e4 LT |
21 | #include <net/ip.h> |
22 | #include <net/route.h> | |
23 | #include <net/tcp.h> | |
95766fff | 24 | #include <net/udp.h> |
446fda4f | 25 | #include <net/cipso_ipv4.h> |
04128f23 | 26 | #include <net/inet_frag.h> |
c319b4d7 | 27 | #include <net/ping.h> |
dddb64bc | 28 | #include <net/protocol.h> |
3ae6ec08 | 29 | #include <net/netevent.h> |
1da177e4 | 30 | |
79e9fed4 | 31 | static int two = 2; |
6ba8a3b1 | 32 | static int four = 4; |
43e122b0 | 33 | static int thousand = 1000; |
95bd09eb | 34 | static int gso_max_segs = GSO_MAX_SEGS; |
e905a9ed | 35 | static int tcp_retr1_max = 255; |
1da177e4 LT |
36 | static int ip_local_port_range_min[] = { 1, 1 }; |
37 | static int ip_local_port_range_max[] = { 65535, 65535 }; | |
0147fc05 AD |
38 | static int tcp_adv_win_scale_min = -31; |
39 | static int tcp_adv_win_scale_max = 31; | |
5f3e2bf0 ED |
40 | static int tcp_min_snd_mss_min = TCP_MIN_SND_MSS; |
41 | static int tcp_min_snd_mss_max = 65535; | |
4548b683 KJ |
42 | static int ip_privileged_port_min; |
43 | static int ip_privileged_port_max = 65535; | |
249fab77 ED |
44 | static int ip_ttl_min = 1; |
45 | static int ip_ttl_max = 255; | |
651e9271 MT |
46 | static int tcp_syn_retries_min = 1; |
47 | static int tcp_syn_retries_max = MAX_TCP_SYNCNT; | |
c319b4d7 VK |
48 | static int ip_ping_group_range_min[] = { 0, 0 }; |
49 | static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX }; | |
9c21d2fc | 50 | static int comp_sack_nr_max = 255; |
d4ce5808 | 51 | static u32 u32_max_div_HZ = UINT_MAX / HZ; |
19fad20d | 52 | static int one_day_secs = 24 * 3600; |
1da177e4 | 53 | |
b6690b14 FW |
54 | /* obsolete */ |
55 | static int sysctl_tcp_low_latency __read_mostly; | |
56 | ||
227b60f5 | 57 | /* Update system visible IP port range */ |
0bbf87d8 | 58 | static void set_local_port_range(struct net *net, int range[2]) |
227b60f5 | 59 | { |
ed2dfd90 ED |
60 | bool same_parity = !((range[0] ^ range[1]) & 1); |
61 | ||
4ee3bd4a | 62 | write_seqlock_bh(&net->ipv4.ip_local_ports.lock); |
ed2dfd90 ED |
63 | if (same_parity && !net->ipv4.ip_local_ports.warned) { |
64 | net->ipv4.ip_local_ports.warned = true; | |
65 | pr_err_ratelimited("ip_local_port_range: prefer different parity for start/end values.\n"); | |
66 | } | |
c9d8f1a6 CW |
67 | net->ipv4.ip_local_ports.range[0] = range[0]; |
68 | net->ipv4.ip_local_ports.range[1] = range[1]; | |
4ee3bd4a | 69 | write_sequnlock_bh(&net->ipv4.ip_local_ports.lock); |
227b60f5 SH |
70 | } |
71 | ||
72 | /* Validate changes from /proc interface. */ | |
fe2c6338 | 73 | static int ipv4_local_port_range(struct ctl_table *table, int write, |
32927393 | 74 | void *buffer, size_t *lenp, loff_t *ppos) |
227b60f5 | 75 | { |
0bbf87d8 | 76 | struct net *net = |
c9d8f1a6 | 77 | container_of(table->data, struct net, ipv4.ip_local_ports.range); |
227b60f5 | 78 | int ret; |
3c689b73 | 79 | int range[2]; |
fe2c6338 | 80 | struct ctl_table tmp = { |
227b60f5 SH |
81 | .data = &range, |
82 | .maxlen = sizeof(range), | |
83 | .mode = table->mode, | |
84 | .extra1 = &ip_local_port_range_min, | |
85 | .extra2 = &ip_local_port_range_max, | |
86 | }; | |
87 | ||
0bbf87d8 EB |
88 | inet_get_local_port_range(net, &range[0], &range[1]); |
89 | ||
8d65af78 | 90 | ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos); |
227b60f5 SH |
91 | |
92 | if (write && ret == 0) { | |
4548b683 KJ |
93 | /* Ensure that the upper limit is not smaller than the lower, |
94 | * and that the lower does not encroach upon the privileged | |
95 | * port limit. | |
96 | */ | |
97 | if ((range[1] < range[0]) || | |
98 | (range[0] < net->ipv4.sysctl_ip_prot_sock)) | |
227b60f5 SH |
99 | ret = -EINVAL; |
100 | else | |
0bbf87d8 | 101 | set_local_port_range(net, range); |
227b60f5 SH |
102 | } |
103 | ||
104 | return ret; | |
105 | } | |
106 | ||
4548b683 KJ |
107 | /* Validate changes from /proc interface. */ |
108 | static int ipv4_privileged_ports(struct ctl_table *table, int write, | |
32927393 | 109 | void *buffer, size_t *lenp, loff_t *ppos) |
4548b683 KJ |
110 | { |
111 | struct net *net = container_of(table->data, struct net, | |
112 | ipv4.sysctl_ip_prot_sock); | |
113 | int ret; | |
114 | int pports; | |
115 | int range[2]; | |
116 | struct ctl_table tmp = { | |
117 | .data = &pports, | |
118 | .maxlen = sizeof(pports), | |
119 | .mode = table->mode, | |
120 | .extra1 = &ip_privileged_port_min, | |
121 | .extra2 = &ip_privileged_port_max, | |
122 | }; | |
123 | ||
124 | pports = net->ipv4.sysctl_ip_prot_sock; | |
125 | ||
126 | ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos); | |
127 | ||
128 | if (write && ret == 0) { | |
129 | inet_get_local_port_range(net, &range[0], &range[1]); | |
130 | /* Ensure that the local port range doesn't overlap with the | |
131 | * privileged port range. | |
132 | */ | |
133 | if (range[0] < pports) | |
134 | ret = -EINVAL; | |
135 | else | |
136 | net->ipv4.sysctl_ip_prot_sock = pports; | |
137 | } | |
138 | ||
139 | return ret; | |
140 | } | |
c319b4d7 | 141 | |
7064d16e | 142 | static void inet_get_ping_group_range_table(struct ctl_table *table, kgid_t *low, kgid_t *high) |
c319b4d7 | 143 | { |
7064d16e | 144 | kgid_t *data = table->data; |
0bbf87d8 | 145 | struct net *net = |
ba6b918a | 146 | container_of(table->data, struct net, ipv4.ping_group_range.range); |
95c96174 | 147 | unsigned int seq; |
c319b4d7 | 148 | do { |
396a30cc | 149 | seq = read_seqbegin(&net->ipv4.ping_group_range.lock); |
c319b4d7 VK |
150 | |
151 | *low = data[0]; | |
152 | *high = data[1]; | |
396a30cc | 153 | } while (read_seqretry(&net->ipv4.ping_group_range.lock, seq)); |
c319b4d7 VK |
154 | } |
155 | ||
156 | /* Update system visible IP port range */ | |
7064d16e | 157 | static void set_ping_group_range(struct ctl_table *table, kgid_t low, kgid_t high) |
c319b4d7 | 158 | { |
7064d16e | 159 | kgid_t *data = table->data; |
0bbf87d8 | 160 | struct net *net = |
ba6b918a | 161 | container_of(table->data, struct net, ipv4.ping_group_range.range); |
396a30cc | 162 | write_seqlock(&net->ipv4.ping_group_range.lock); |
7064d16e EB |
163 | data[0] = low; |
164 | data[1] = high; | |
396a30cc | 165 | write_sequnlock(&net->ipv4.ping_group_range.lock); |
c319b4d7 VK |
166 | } |
167 | ||
168 | /* Validate changes from /proc interface. */ | |
fe2c6338 | 169 | static int ipv4_ping_group_range(struct ctl_table *table, int write, |
32927393 | 170 | void *buffer, size_t *lenp, loff_t *ppos) |
c319b4d7 | 171 | { |
7064d16e | 172 | struct user_namespace *user_ns = current_user_ns(); |
c319b4d7 | 173 | int ret; |
7064d16e EB |
174 | gid_t urange[2]; |
175 | kgid_t low, high; | |
fe2c6338 | 176 | struct ctl_table tmp = { |
7064d16e EB |
177 | .data = &urange, |
178 | .maxlen = sizeof(urange), | |
c319b4d7 VK |
179 | .mode = table->mode, |
180 | .extra1 = &ip_ping_group_range_min, | |
181 | .extra2 = &ip_ping_group_range_max, | |
182 | }; | |
183 | ||
7064d16e EB |
184 | inet_get_ping_group_range_table(table, &low, &high); |
185 | urange[0] = from_kgid_munged(user_ns, low); | |
186 | urange[1] = from_kgid_munged(user_ns, high); | |
c319b4d7 VK |
187 | ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos); |
188 | ||
7064d16e EB |
189 | if (write && ret == 0) { |
190 | low = make_kgid(user_ns, urange[0]); | |
191 | high = make_kgid(user_ns, urange[1]); | |
70ba5b6d TH |
192 | if (!gid_valid(low) || !gid_valid(high)) |
193 | return -EINVAL; | |
194 | if (urange[1] < urange[0] || gid_lt(high, low)) { | |
7064d16e EB |
195 | low = make_kgid(&init_user_ns, 1); |
196 | high = make_kgid(&init_user_ns, 0); | |
197 | } | |
198 | set_ping_group_range(table, low, high); | |
199 | } | |
c319b4d7 VK |
200 | |
201 | return ret; | |
202 | } | |
203 | ||
d18c5d19 | 204 | static int ipv4_fwd_update_priority(struct ctl_table *table, int write, |
32927393 | 205 | void *buffer, size_t *lenp, loff_t *ppos) |
d18c5d19 PM |
206 | { |
207 | struct net *net; | |
208 | int ret; | |
209 | ||
210 | net = container_of(table->data, struct net, | |
211 | ipv4.sysctl_ip_fwd_update_priority); | |
212 | ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); | |
213 | if (write && ret == 0) | |
214 | call_netevent_notifiers(NETEVENT_IPV4_FWD_UPDATE_PRIORITY_UPDATE, | |
215 | net); | |
216 | ||
217 | return ret; | |
218 | } | |
219 | ||
fe2c6338 | 220 | static int proc_tcp_congestion_control(struct ctl_table *ctl, int write, |
32927393 | 221 | void *buffer, size_t *lenp, loff_t *ppos) |
317a76f9 | 222 | { |
6670e152 SH |
223 | struct net *net = container_of(ctl->data, struct net, |
224 | ipv4.tcp_congestion_control); | |
317a76f9 | 225 | char val[TCP_CA_NAME_MAX]; |
fe2c6338 | 226 | struct ctl_table tbl = { |
317a76f9 SH |
227 | .data = val, |
228 | .maxlen = TCP_CA_NAME_MAX, | |
229 | }; | |
230 | int ret; | |
231 | ||
6670e152 | 232 | tcp_get_default_congestion_control(net, val); |
317a76f9 | 233 | |
8d65af78 | 234 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
317a76f9 | 235 | if (write && ret == 0) |
6670e152 | 236 | ret = tcp_set_default_congestion_control(net, val); |
317a76f9 SH |
237 | return ret; |
238 | } | |
239 | ||
fe2c6338 | 240 | static int proc_tcp_available_congestion_control(struct ctl_table *ctl, |
32927393 CH |
241 | int write, void *buffer, |
242 | size_t *lenp, loff_t *ppos) | |
3ff825b2 | 243 | { |
fe2c6338 | 244 | struct ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX, }; |
3ff825b2 SH |
245 | int ret; |
246 | ||
247 | tbl.data = kmalloc(tbl.maxlen, GFP_USER); | |
248 | if (!tbl.data) | |
249 | return -ENOMEM; | |
250 | tcp_get_available_congestion_control(tbl.data, TCP_CA_BUF_MAX); | |
8d65af78 | 251 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
3ff825b2 SH |
252 | kfree(tbl.data); |
253 | return ret; | |
254 | } | |
255 | ||
fe2c6338 | 256 | static int proc_allowed_congestion_control(struct ctl_table *ctl, |
32927393 CH |
257 | int write, void *buffer, |
258 | size_t *lenp, loff_t *ppos) | |
ce7bc3bf | 259 | { |
fe2c6338 | 260 | struct ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX }; |
ce7bc3bf SH |
261 | int ret; |
262 | ||
263 | tbl.data = kmalloc(tbl.maxlen, GFP_USER); | |
264 | if (!tbl.data) | |
265 | return -ENOMEM; | |
266 | ||
267 | tcp_get_allowed_congestion_control(tbl.data, tbl.maxlen); | |
8d65af78 | 268 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
ce7bc3bf SH |
269 | if (write && ret == 0) |
270 | ret = tcp_set_allowed_congestion_control(tbl.data); | |
271 | kfree(tbl.data); | |
272 | return ret; | |
273 | } | |
274 | ||
aa1236cd JB |
275 | static int sscanf_key(char *buf, __le32 *key) |
276 | { | |
277 | u32 user_key[4]; | |
278 | int i, ret = 0; | |
279 | ||
280 | if (sscanf(buf, "%x-%x-%x-%x", user_key, user_key + 1, | |
281 | user_key + 2, user_key + 3) != 4) { | |
282 | ret = -EINVAL; | |
283 | } else { | |
284 | for (i = 0; i < ARRAY_SIZE(user_key); i++) | |
285 | key[i] = cpu_to_le32(user_key[i]); | |
286 | } | |
287 | pr_debug("proc TFO key set 0x%x-%x-%x-%x <- 0x%s: %u\n", | |
288 | user_key[0], user_key[1], user_key[2], user_key[3], buf, ret); | |
289 | ||
290 | return ret; | |
291 | } | |
292 | ||
43713848 | 293 | static int proc_tcp_fastopen_key(struct ctl_table *table, int write, |
32927393 | 294 | void *buffer, size_t *lenp, loff_t *ppos) |
10467163 | 295 | { |
43713848 HY |
296 | struct net *net = container_of(table->data, struct net, |
297 | ipv4.sysctl_tcp_fastopen); | |
aa1236cd JB |
298 | /* maxlen to print the list of keys in hex (*2), with dashes |
299 | * separating doublewords and a comma in between keys. | |
300 | */ | |
301 | struct ctl_table tbl = { .maxlen = ((TCP_FASTOPEN_KEY_LENGTH * | |
302 | 2 * TCP_FASTOPEN_KEY_MAX) + | |
303 | (TCP_FASTOPEN_KEY_MAX * 5)) }; | |
f19008e6 JB |
304 | u32 user_key[TCP_FASTOPEN_KEY_BUF_LENGTH / sizeof(u32)]; |
305 | __le32 key[TCP_FASTOPEN_KEY_BUF_LENGTH / sizeof(__le32)]; | |
aa1236cd | 306 | char *backup_data; |
f19008e6 | 307 | int ret, i = 0, off = 0, n_keys; |
10467163 JC |
308 | |
309 | tbl.data = kmalloc(tbl.maxlen, GFP_KERNEL); | |
310 | if (!tbl.data) | |
311 | return -ENOMEM; | |
312 | ||
f19008e6 | 313 | n_keys = tcp_fastopen_get_cipher(net, NULL, (u64 *)key); |
aa1236cd JB |
314 | if (!n_keys) { |
315 | memset(&key[0], 0, TCP_FASTOPEN_KEY_LENGTH); | |
316 | n_keys = 1; | |
317 | } | |
318 | ||
319 | for (i = 0; i < n_keys * 4; i++) | |
c860e997 YC |
320 | user_key[i] = le32_to_cpu(key[i]); |
321 | ||
aa1236cd JB |
322 | for (i = 0; i < n_keys; i++) { |
323 | off += snprintf(tbl.data + off, tbl.maxlen - off, | |
324 | "%08x-%08x-%08x-%08x", | |
325 | user_key[i * 4], | |
326 | user_key[i * 4 + 1], | |
327 | user_key[i * 4 + 2], | |
328 | user_key[i * 4 + 3]); | |
9bb59a21 HL |
329 | |
330 | if (WARN_ON_ONCE(off >= tbl.maxlen - 1)) | |
331 | break; | |
332 | ||
aa1236cd JB |
333 | if (i + 1 < n_keys) |
334 | off += snprintf(tbl.data + off, tbl.maxlen - off, ","); | |
335 | } | |
336 | ||
10467163 JC |
337 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
338 | ||
339 | if (write && ret == 0) { | |
aa1236cd JB |
340 | backup_data = strchr(tbl.data, ','); |
341 | if (backup_data) { | |
342 | *backup_data = '\0'; | |
343 | backup_data++; | |
344 | } | |
345 | if (sscanf_key(tbl.data, key)) { | |
10467163 JC |
346 | ret = -EINVAL; |
347 | goto bad_key; | |
348 | } | |
aa1236cd JB |
349 | if (backup_data) { |
350 | if (sscanf_key(backup_data, key + 4)) { | |
351 | ret = -EINVAL; | |
352 | goto bad_key; | |
353 | } | |
354 | } | |
355 | tcp_fastopen_reset_cipher(net, NULL, key, | |
438ac880 | 356 | backup_data ? key + 4 : NULL); |
10467163 JC |
357 | } |
358 | ||
359 | bad_key: | |
10467163 JC |
360 | kfree(tbl.data); |
361 | return ret; | |
362 | } | |
363 | ||
dddb64bc | 364 | static void proc_configure_early_demux(int enabled, int protocol) |
365 | { | |
366 | struct net_protocol *ipprot; | |
367 | #if IS_ENABLED(CONFIG_IPV6) | |
368 | struct inet6_protocol *ip6prot; | |
369 | #endif | |
370 | ||
58c4c6a3 DA |
371 | rcu_read_lock(); |
372 | ||
dddb64bc | 373 | ipprot = rcu_dereference(inet_protos[protocol]); |
374 | if (ipprot) | |
375 | ipprot->early_demux = enabled ? ipprot->early_demux_handler : | |
376 | NULL; | |
377 | ||
378 | #if IS_ENABLED(CONFIG_IPV6) | |
379 | ip6prot = rcu_dereference(inet6_protos[protocol]); | |
380 | if (ip6prot) | |
381 | ip6prot->early_demux = enabled ? ip6prot->early_demux_handler : | |
382 | NULL; | |
383 | #endif | |
58c4c6a3 | 384 | rcu_read_unlock(); |
dddb64bc | 385 | } |
386 | ||
387 | static int proc_tcp_early_demux(struct ctl_table *table, int write, | |
32927393 | 388 | void *buffer, size_t *lenp, loff_t *ppos) |
dddb64bc | 389 | { |
390 | int ret = 0; | |
391 | ||
392 | ret = proc_dointvec(table, write, buffer, lenp, ppos); | |
393 | ||
394 | if (write && !ret) { | |
395 | int enabled = init_net.ipv4.sysctl_tcp_early_demux; | |
396 | ||
397 | proc_configure_early_demux(enabled, IPPROTO_TCP); | |
398 | } | |
399 | ||
400 | return ret; | |
401 | } | |
402 | ||
403 | static int proc_udp_early_demux(struct ctl_table *table, int write, | |
32927393 | 404 | void *buffer, size_t *lenp, loff_t *ppos) |
dddb64bc | 405 | { |
406 | int ret = 0; | |
407 | ||
408 | ret = proc_dointvec(table, write, buffer, lenp, ppos); | |
409 | ||
410 | if (write && !ret) { | |
411 | int enabled = init_net.ipv4.sysctl_udp_early_demux; | |
412 | ||
413 | proc_configure_early_demux(enabled, IPPROTO_UDP); | |
414 | } | |
415 | ||
416 | return ret; | |
417 | } | |
418 | ||
cf1ef3f0 | 419 | static int proc_tfo_blackhole_detect_timeout(struct ctl_table *table, |
32927393 | 420 | int write, void *buffer, |
cf1ef3f0 WW |
421 | size_t *lenp, loff_t *ppos) |
422 | { | |
3733be14 HY |
423 | struct net *net = container_of(table->data, struct net, |
424 | ipv4.sysctl_tcp_fastopen_blackhole_timeout); | |
cf1ef3f0 WW |
425 | int ret; |
426 | ||
427 | ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); | |
428 | if (write && ret == 0) | |
3733be14 | 429 | atomic_set(&net->ipv4.tfo_active_disable_times, 0); |
734942cc DW |
430 | |
431 | return ret; | |
432 | } | |
433 | ||
434 | static int proc_tcp_available_ulp(struct ctl_table *ctl, | |
32927393 | 435 | int write, void *buffer, size_t *lenp, |
734942cc DW |
436 | loff_t *ppos) |
437 | { | |
438 | struct ctl_table tbl = { .maxlen = TCP_ULP_BUF_MAX, }; | |
439 | int ret; | |
440 | ||
441 | tbl.data = kmalloc(tbl.maxlen, GFP_USER); | |
442 | if (!tbl.data) | |
443 | return -ENOMEM; | |
444 | tcp_get_available_ulp(tbl.data, TCP_ULP_BUF_MAX); | |
445 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); | |
446 | kfree(tbl.data); | |
447 | ||
cf1ef3f0 WW |
448 | return ret; |
449 | } | |
450 | ||
3ae6ec08 IS |
451 | #ifdef CONFIG_IP_ROUTE_MULTIPATH |
452 | static int proc_fib_multipath_hash_policy(struct ctl_table *table, int write, | |
32927393 | 453 | void *buffer, size_t *lenp, |
3ae6ec08 IS |
454 | loff_t *ppos) |
455 | { | |
456 | struct net *net = container_of(table->data, struct net, | |
457 | ipv4.sysctl_fib_multipath_hash_policy); | |
458 | int ret; | |
459 | ||
460 | ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); | |
461 | if (write && ret == 0) | |
3192dac6 | 462 | call_netevent_notifiers(NETEVENT_IPV4_MPATH_HASH_UPDATE, net); |
3ae6ec08 IS |
463 | |
464 | return ret; | |
465 | } | |
466 | #endif | |
467 | ||
3e37c3f9 | 468 | static struct ctl_table ipv4_table[] = { |
1da177e4 | 469 | { |
1da177e4 LT |
470 | .procname = "tcp_max_orphans", |
471 | .data = &sysctl_tcp_max_orphans, | |
472 | .maxlen = sizeof(int), | |
473 | .mode = 0644, | |
6d9f239a | 474 | .proc_handler = proc_dointvec |
1da177e4 | 475 | }, |
1da177e4 | 476 | { |
1da177e4 LT |
477 | .procname = "inet_peer_threshold", |
478 | .data = &inet_peer_threshold, | |
479 | .maxlen = sizeof(int), | |
480 | .mode = 0644, | |
6d9f239a | 481 | .proc_handler = proc_dointvec |
1da177e4 LT |
482 | }, |
483 | { | |
1da177e4 LT |
484 | .procname = "inet_peer_minttl", |
485 | .data = &inet_peer_minttl, | |
486 | .maxlen = sizeof(int), | |
487 | .mode = 0644, | |
6d9f239a | 488 | .proc_handler = proc_dointvec_jiffies, |
1da177e4 LT |
489 | }, |
490 | { | |
1da177e4 LT |
491 | .procname = "inet_peer_maxttl", |
492 | .data = &inet_peer_maxttl, | |
493 | .maxlen = sizeof(int), | |
494 | .mode = 0644, | |
6d9f239a | 495 | .proc_handler = proc_dointvec_jiffies, |
1da177e4 | 496 | }, |
a4fe34bf EB |
497 | { |
498 | .procname = "tcp_mem", | |
499 | .maxlen = sizeof(sysctl_tcp_mem), | |
500 | .data = &sysctl_tcp_mem, | |
501 | .mode = 0644, | |
502 | .proc_handler = proc_doulongvec_minmax, | |
503 | }, | |
1da177e4 | 504 | { |
1da177e4 LT |
505 | .procname = "tcp_low_latency", |
506 | .data = &sysctl_tcp_low_latency, | |
507 | .maxlen = sizeof(int), | |
508 | .mode = 0644, | |
6d9f239a | 509 | .proc_handler = proc_dointvec |
1da177e4 | 510 | }, |
446fda4f PM |
511 | #ifdef CONFIG_NETLABEL |
512 | { | |
446fda4f PM |
513 | .procname = "cipso_cache_enable", |
514 | .data = &cipso_v4_cache_enabled, | |
515 | .maxlen = sizeof(int), | |
516 | .mode = 0644, | |
6d9f239a | 517 | .proc_handler = proc_dointvec, |
446fda4f PM |
518 | }, |
519 | { | |
446fda4f PM |
520 | .procname = "cipso_cache_bucket_size", |
521 | .data = &cipso_v4_cache_bucketsize, | |
522 | .maxlen = sizeof(int), | |
523 | .mode = 0644, | |
6d9f239a | 524 | .proc_handler = proc_dointvec, |
446fda4f PM |
525 | }, |
526 | { | |
446fda4f PM |
527 | .procname = "cipso_rbm_optfmt", |
528 | .data = &cipso_v4_rbm_optfmt, | |
529 | .maxlen = sizeof(int), | |
530 | .mode = 0644, | |
6d9f239a | 531 | .proc_handler = proc_dointvec, |
446fda4f PM |
532 | }, |
533 | { | |
446fda4f PM |
534 | .procname = "cipso_rbm_strictvalid", |
535 | .data = &cipso_v4_rbm_strictvalid, | |
536 | .maxlen = sizeof(int), | |
537 | .mode = 0644, | |
6d9f239a | 538 | .proc_handler = proc_dointvec, |
446fda4f PM |
539 | }, |
540 | #endif /* CONFIG_NETLABEL */ | |
734942cc DW |
541 | { |
542 | .procname = "tcp_available_ulp", | |
543 | .maxlen = TCP_ULP_BUF_MAX, | |
544 | .mode = 0444, | |
545 | .proc_handler = proc_tcp_available_ulp, | |
546 | }, | |
4cdf507d ED |
547 | { |
548 | .procname = "icmp_msgs_per_sec", | |
549 | .data = &sysctl_icmp_msgs_per_sec, | |
550 | .maxlen = sizeof(int), | |
551 | .mode = 0644, | |
552 | .proc_handler = proc_dointvec_minmax, | |
eec4844f | 553 | .extra1 = SYSCTL_ZERO, |
4cdf507d ED |
554 | }, |
555 | { | |
556 | .procname = "icmp_msgs_burst", | |
557 | .data = &sysctl_icmp_msgs_burst, | |
558 | .maxlen = sizeof(int), | |
559 | .mode = 0644, | |
560 | .proc_handler = proc_dointvec_minmax, | |
eec4844f | 561 | .extra1 = SYSCTL_ZERO, |
4cdf507d | 562 | }, |
95766fff | 563 | { |
95766fff HA |
564 | .procname = "udp_mem", |
565 | .data = &sysctl_udp_mem, | |
566 | .maxlen = sizeof(sysctl_udp_mem), | |
567 | .mode = 0644, | |
8d987e5c | 568 | .proc_handler = proc_doulongvec_minmax, |
95766fff | 569 | }, |
9ab948a9 DA |
570 | { |
571 | .procname = "fib_sync_mem", | |
572 | .data = &sysctl_fib_sync_mem, | |
573 | .maxlen = sizeof(sysctl_fib_sync_mem), | |
574 | .mode = 0644, | |
575 | .proc_handler = proc_douintvec_minmax, | |
576 | .extra1 = &sysctl_fib_sync_mem_min, | |
577 | .extra2 = &sysctl_fib_sync_mem_max, | |
578 | }, | |
ede61ca4 ED |
579 | { |
580 | .procname = "tcp_rx_skb_cache", | |
581 | .data = &tcp_rx_skb_cache_key.key, | |
582 | .mode = 0644, | |
583 | .proc_handler = proc_do_static_key, | |
584 | }, | |
0b7d7f6b ED |
585 | { |
586 | .procname = "tcp_tx_skb_cache", | |
587 | .data = &tcp_tx_skb_cache_key.key, | |
588 | .mode = 0644, | |
589 | .proc_handler = proc_do_static_key, | |
590 | }, | |
f8572d8f | 591 | { } |
1da177e4 | 592 | }; |
3e37c3f9 | 593 | |
68528f09 PE |
594 | static struct ctl_table ipv4_net_table[] = { |
595 | { | |
68528f09 PE |
596 | .procname = "icmp_echo_ignore_all", |
597 | .data = &init_net.ipv4.sysctl_icmp_echo_ignore_all, | |
598 | .maxlen = sizeof(int), | |
599 | .mode = 0644, | |
6d9f239a | 600 | .proc_handler = proc_dointvec |
68528f09 PE |
601 | }, |
602 | { | |
68528f09 PE |
603 | .procname = "icmp_echo_ignore_broadcasts", |
604 | .data = &init_net.ipv4.sysctl_icmp_echo_ignore_broadcasts, | |
605 | .maxlen = sizeof(int), | |
606 | .mode = 0644, | |
6d9f239a | 607 | .proc_handler = proc_dointvec |
68528f09 PE |
608 | }, |
609 | { | |
68528f09 PE |
610 | .procname = "icmp_ignore_bogus_error_responses", |
611 | .data = &init_net.ipv4.sysctl_icmp_ignore_bogus_error_responses, | |
612 | .maxlen = sizeof(int), | |
613 | .mode = 0644, | |
6d9f239a | 614 | .proc_handler = proc_dointvec |
68528f09 PE |
615 | }, |
616 | { | |
68528f09 PE |
617 | .procname = "icmp_errors_use_inbound_ifaddr", |
618 | .data = &init_net.ipv4.sysctl_icmp_errors_use_inbound_ifaddr, | |
619 | .maxlen = sizeof(int), | |
620 | .mode = 0644, | |
6d9f239a | 621 | .proc_handler = proc_dointvec |
68528f09 PE |
622 | }, |
623 | { | |
68528f09 PE |
624 | .procname = "icmp_ratelimit", |
625 | .data = &init_net.ipv4.sysctl_icmp_ratelimit, | |
626 | .maxlen = sizeof(int), | |
627 | .mode = 0644, | |
6d9f239a | 628 | .proc_handler = proc_dointvec_ms_jiffies, |
68528f09 PE |
629 | }, |
630 | { | |
68528f09 PE |
631 | .procname = "icmp_ratemask", |
632 | .data = &init_net.ipv4.sysctl_icmp_ratemask, | |
633 | .maxlen = sizeof(int), | |
634 | .mode = 0644, | |
6d9f239a | 635 | .proc_handler = proc_dointvec |
68528f09 | 636 | }, |
c319b4d7 VK |
637 | { |
638 | .procname = "ping_group_range", | |
ba6b918a | 639 | .data = &init_net.ipv4.ping_group_range.range, |
7064d16e | 640 | .maxlen = sizeof(gid_t)*2, |
c319b4d7 VK |
641 | .mode = 0644, |
642 | .proc_handler = ipv4_ping_group_range, | |
643 | }, | |
6897445f MM |
644 | #ifdef CONFIG_NET_L3_MASTER_DEV |
645 | { | |
646 | .procname = "raw_l3mdev_accept", | |
647 | .data = &init_net.ipv4.sysctl_raw_l3mdev_accept, | |
648 | .maxlen = sizeof(int), | |
649 | .mode = 0644, | |
650 | .proc_handler = proc_dointvec_minmax, | |
eec4844f MC |
651 | .extra1 = SYSCTL_ZERO, |
652 | .extra2 = SYSCTL_ONE, | |
6897445f MM |
653 | }, |
654 | #endif | |
5d134f1c HFS |
655 | { |
656 | .procname = "tcp_ecn", | |
657 | .data = &init_net.ipv4.sysctl_tcp_ecn, | |
658 | .maxlen = sizeof(int), | |
659 | .mode = 0644, | |
660 | .proc_handler = proc_dointvec | |
661 | }, | |
49213555 DB |
662 | { |
663 | .procname = "tcp_ecn_fallback", | |
664 | .data = &init_net.ipv4.sysctl_tcp_ecn_fallback, | |
665 | .maxlen = sizeof(int), | |
666 | .mode = 0644, | |
667 | .proc_handler = proc_dointvec | |
668 | }, | |
287b7f38 NB |
669 | { |
670 | .procname = "ip_dynaddr", | |
671 | .data = &init_net.ipv4.sysctl_ip_dynaddr, | |
672 | .maxlen = sizeof(int), | |
673 | .mode = 0644, | |
674 | .proc_handler = proc_dointvec | |
675 | }, | |
e21145a9 NB |
676 | { |
677 | .procname = "ip_early_demux", | |
678 | .data = &init_net.ipv4.sysctl_ip_early_demux, | |
679 | .maxlen = sizeof(int), | |
680 | .mode = 0644, | |
681 | .proc_handler = proc_dointvec | |
682 | }, | |
dddb64bc | 683 | { |
684 | .procname = "udp_early_demux", | |
685 | .data = &init_net.ipv4.sysctl_udp_early_demux, | |
686 | .maxlen = sizeof(int), | |
687 | .mode = 0644, | |
688 | .proc_handler = proc_udp_early_demux | |
689 | }, | |
690 | { | |
691 | .procname = "tcp_early_demux", | |
692 | .data = &init_net.ipv4.sysctl_tcp_early_demux, | |
693 | .maxlen = sizeof(int), | |
694 | .mode = 0644, | |
695 | .proc_handler = proc_tcp_early_demux | |
696 | }, | |
4f80116d RP |
697 | { |
698 | .procname = "nexthop_compat_mode", | |
699 | .data = &init_net.ipv4.sysctl_nexthop_compat_mode, | |
700 | .maxlen = sizeof(int), | |
701 | .mode = 0644, | |
702 | .proc_handler = proc_dointvec_minmax, | |
703 | .extra1 = SYSCTL_ZERO, | |
704 | .extra2 = SYSCTL_ONE, | |
705 | }, | |
fa50d974 NB |
706 | { |
707 | .procname = "ip_default_ttl", | |
708 | .data = &init_net.ipv4.sysctl_ip_default_ttl, | |
709 | .maxlen = sizeof(int), | |
710 | .mode = 0644, | |
711 | .proc_handler = proc_dointvec_minmax, | |
712 | .extra1 = &ip_ttl_min, | |
713 | .extra2 = &ip_ttl_max, | |
714 | }, | |
0bbf87d8 EB |
715 | { |
716 | .procname = "ip_local_port_range", | |
c9d8f1a6 CW |
717 | .maxlen = sizeof(init_net.ipv4.ip_local_ports.range), |
718 | .data = &init_net.ipv4.ip_local_ports.range, | |
0bbf87d8 EB |
719 | .mode = 0644, |
720 | .proc_handler = ipv4_local_port_range, | |
721 | }, | |
122ff243 WC |
722 | { |
723 | .procname = "ip_local_reserved_ports", | |
724 | .data = &init_net.ipv4.sysctl_local_reserved_ports, | |
725 | .maxlen = 65536, | |
726 | .mode = 0644, | |
727 | .proc_handler = proc_do_large_bitmap, | |
728 | }, | |
974eda11 HFS |
729 | { |
730 | .procname = "ip_no_pmtu_disc", | |
731 | .data = &init_net.ipv4.sysctl_ip_no_pmtu_disc, | |
732 | .maxlen = sizeof(int), | |
733 | .mode = 0644, | |
734 | .proc_handler = proc_dointvec | |
735 | }, | |
f87c10a8 HFS |
736 | { |
737 | .procname = "ip_forward_use_pmtu", | |
738 | .data = &init_net.ipv4.sysctl_ip_fwd_use_pmtu, | |
739 | .maxlen = sizeof(int), | |
740 | .mode = 0644, | |
741 | .proc_handler = proc_dointvec, | |
742 | }, | |
432e05d3 PM |
743 | { |
744 | .procname = "ip_forward_update_priority", | |
745 | .data = &init_net.ipv4.sysctl_ip_fwd_update_priority, | |
746 | .maxlen = sizeof(int), | |
747 | .mode = 0644, | |
d18c5d19 | 748 | .proc_handler = ipv4_fwd_update_priority, |
eec4844f MC |
749 | .extra1 = SYSCTL_ZERO, |
750 | .extra2 = SYSCTL_ONE, | |
432e05d3 | 751 | }, |
49a60158 VB |
752 | { |
753 | .procname = "ip_nonlocal_bind", | |
754 | .data = &init_net.ipv4.sysctl_ip_nonlocal_bind, | |
755 | .maxlen = sizeof(int), | |
756 | .mode = 0644, | |
757 | .proc_handler = proc_dointvec | |
758 | }, | |
4b01a967 KI |
759 | { |
760 | .procname = "ip_autobind_reuse", | |
761 | .data = &init_net.ipv4.sysctl_ip_autobind_reuse, | |
762 | .maxlen = sizeof(int), | |
763 | .mode = 0644, | |
764 | .proc_handler = proc_dointvec_minmax, | |
765 | .extra1 = SYSCTL_ZERO, | |
766 | .extra2 = SYSCTL_ONE, | |
767 | }, | |
e110861f LC |
768 | { |
769 | .procname = "fwmark_reflect", | |
770 | .data = &init_net.ipv4.sysctl_fwmark_reflect, | |
771 | .maxlen = sizeof(int), | |
772 | .mode = 0644, | |
773 | .proc_handler = proc_dointvec, | |
774 | }, | |
84f39b08 LC |
775 | { |
776 | .procname = "tcp_fwmark_accept", | |
777 | .data = &init_net.ipv4.sysctl_tcp_fwmark_accept, | |
778 | .maxlen = sizeof(int), | |
779 | .mode = 0644, | |
780 | .proc_handler = proc_dointvec, | |
781 | }, | |
6dd9a14e DA |
782 | #ifdef CONFIG_NET_L3_MASTER_DEV |
783 | { | |
784 | .procname = "tcp_l3mdev_accept", | |
785 | .data = &init_net.ipv4.sysctl_tcp_l3mdev_accept, | |
786 | .maxlen = sizeof(int), | |
787 | .mode = 0644, | |
788 | .proc_handler = proc_dointvec_minmax, | |
eec4844f MC |
789 | .extra1 = SYSCTL_ZERO, |
790 | .extra2 = SYSCTL_ONE, | |
6dd9a14e DA |
791 | }, |
792 | #endif | |
b0f9ca53 FD |
793 | { |
794 | .procname = "tcp_mtu_probing", | |
795 | .data = &init_net.ipv4.sysctl_tcp_mtu_probing, | |
796 | .maxlen = sizeof(int), | |
797 | .mode = 0644, | |
798 | .proc_handler = proc_dointvec, | |
799 | }, | |
800 | { | |
801 | .procname = "tcp_base_mss", | |
802 | .data = &init_net.ipv4.sysctl_tcp_base_mss, | |
803 | .maxlen = sizeof(int), | |
804 | .mode = 0644, | |
805 | .proc_handler = proc_dointvec, | |
806 | }, | |
5f3e2bf0 ED |
807 | { |
808 | .procname = "tcp_min_snd_mss", | |
809 | .data = &init_net.ipv4.sysctl_tcp_min_snd_mss, | |
810 | .maxlen = sizeof(int), | |
811 | .mode = 0644, | |
812 | .proc_handler = proc_dointvec_minmax, | |
813 | .extra1 = &tcp_min_snd_mss_min, | |
814 | .extra2 = &tcp_min_snd_mss_max, | |
815 | }, | |
c04b79b6 JH |
816 | { |
817 | .procname = "tcp_mtu_probe_floor", | |
818 | .data = &init_net.ipv4.sysctl_tcp_mtu_probe_floor, | |
819 | .maxlen = sizeof(int), | |
820 | .mode = 0644, | |
821 | .proc_handler = proc_dointvec_minmax, | |
822 | .extra1 = &tcp_min_snd_mss_min, | |
823 | .extra2 = &tcp_min_snd_mss_max, | |
824 | }, | |
6b58e0a5 FD |
825 | { |
826 | .procname = "tcp_probe_threshold", | |
827 | .data = &init_net.ipv4.sysctl_tcp_probe_threshold, | |
828 | .maxlen = sizeof(int), | |
829 | .mode = 0644, | |
830 | .proc_handler = proc_dointvec, | |
831 | }, | |
05cbc0db FD |
832 | { |
833 | .procname = "tcp_probe_interval", | |
834 | .data = &init_net.ipv4.sysctl_tcp_probe_interval, | |
d4ce5808 | 835 | .maxlen = sizeof(u32), |
05cbc0db | 836 | .mode = 0644, |
d4ce5808 MŻ |
837 | .proc_handler = proc_douintvec_minmax, |
838 | .extra2 = &u32_max_div_HZ, | |
05cbc0db | 839 | }, |
df2cf4a7 PD |
840 | { |
841 | .procname = "igmp_link_local_mcast_reports", | |
87a8a2ae | 842 | .data = &init_net.ipv4.sysctl_igmp_llm_reports, |
df2cf4a7 PD |
843 | .maxlen = sizeof(int), |
844 | .mode = 0644, | |
845 | .proc_handler = proc_dointvec | |
846 | }, | |
815c5270 NB |
847 | { |
848 | .procname = "igmp_max_memberships", | |
849 | .data = &init_net.ipv4.sysctl_igmp_max_memberships, | |
850 | .maxlen = sizeof(int), | |
851 | .mode = 0644, | |
852 | .proc_handler = proc_dointvec | |
853 | }, | |
166b6b2d NB |
854 | { |
855 | .procname = "igmp_max_msf", | |
856 | .data = &init_net.ipv4.sysctl_igmp_max_msf, | |
857 | .maxlen = sizeof(int), | |
858 | .mode = 0644, | |
859 | .proc_handler = proc_dointvec | |
860 | }, | |
165094af NB |
861 | #ifdef CONFIG_IP_MULTICAST |
862 | { | |
863 | .procname = "igmp_qrv", | |
864 | .data = &init_net.ipv4.sysctl_igmp_qrv, | |
865 | .maxlen = sizeof(int), | |
866 | .mode = 0644, | |
867 | .proc_handler = proc_dointvec_minmax, | |
eec4844f | 868 | .extra1 = SYSCTL_ONE |
165094af NB |
869 | }, |
870 | #endif | |
6670e152 SH |
871 | { |
872 | .procname = "tcp_congestion_control", | |
873 | .data = &init_net.ipv4.tcp_congestion_control, | |
874 | .mode = 0644, | |
875 | .maxlen = TCP_CA_NAME_MAX, | |
876 | .proc_handler = proc_tcp_congestion_control, | |
877 | }, | |
9cb8e048 CB |
878 | { |
879 | .procname = "tcp_available_congestion_control", | |
880 | .maxlen = TCP_CA_BUF_MAX, | |
881 | .mode = 0444, | |
882 | .proc_handler = proc_tcp_available_congestion_control, | |
883 | }, | |
884 | { | |
885 | .procname = "tcp_allowed_congestion_control", | |
886 | .maxlen = TCP_CA_BUF_MAX, | |
887 | .mode = 0644, | |
888 | .proc_handler = proc_allowed_congestion_control, | |
889 | }, | |
13b287e8 NB |
890 | { |
891 | .procname = "tcp_keepalive_time", | |
892 | .data = &init_net.ipv4.sysctl_tcp_keepalive_time, | |
893 | .maxlen = sizeof(int), | |
894 | .mode = 0644, | |
895 | .proc_handler = proc_dointvec_jiffies, | |
896 | }, | |
9bd6861b NB |
897 | { |
898 | .procname = "tcp_keepalive_probes", | |
899 | .data = &init_net.ipv4.sysctl_tcp_keepalive_probes, | |
900 | .maxlen = sizeof(int), | |
901 | .mode = 0644, | |
902 | .proc_handler = proc_dointvec | |
903 | }, | |
b840d15d NB |
904 | { |
905 | .procname = "tcp_keepalive_intvl", | |
906 | .data = &init_net.ipv4.sysctl_tcp_keepalive_intvl, | |
907 | .maxlen = sizeof(int), | |
908 | .mode = 0644, | |
909 | .proc_handler = proc_dointvec_jiffies, | |
910 | }, | |
6fa25166 NB |
911 | { |
912 | .procname = "tcp_syn_retries", | |
913 | .data = &init_net.ipv4.sysctl_tcp_syn_retries, | |
914 | .maxlen = sizeof(int), | |
915 | .mode = 0644, | |
916 | .proc_handler = proc_dointvec_minmax, | |
917 | .extra1 = &tcp_syn_retries_min, | |
918 | .extra2 = &tcp_syn_retries_max | |
919 | }, | |
7c083ecb NB |
920 | { |
921 | .procname = "tcp_synack_retries", | |
922 | .data = &init_net.ipv4.sysctl_tcp_synack_retries, | |
923 | .maxlen = sizeof(int), | |
924 | .mode = 0644, | |
925 | .proc_handler = proc_dointvec | |
926 | }, | |
12ed8244 NB |
927 | #ifdef CONFIG_SYN_COOKIES |
928 | { | |
929 | .procname = "tcp_syncookies", | |
930 | .data = &init_net.ipv4.sysctl_tcp_syncookies, | |
931 | .maxlen = sizeof(int), | |
932 | .mode = 0644, | |
933 | .proc_handler = proc_dointvec | |
934 | }, | |
935 | #endif | |
1043e25f NB |
936 | { |
937 | .procname = "tcp_reordering", | |
938 | .data = &init_net.ipv4.sysctl_tcp_reordering, | |
939 | .maxlen = sizeof(int), | |
940 | .mode = 0644, | |
941 | .proc_handler = proc_dointvec | |
942 | }, | |
ae5c3f40 NB |
943 | { |
944 | .procname = "tcp_retries1", | |
945 | .data = &init_net.ipv4.sysctl_tcp_retries1, | |
946 | .maxlen = sizeof(int), | |
947 | .mode = 0644, | |
948 | .proc_handler = proc_dointvec_minmax, | |
949 | .extra2 = &tcp_retr1_max | |
950 | }, | |
c6214a97 NB |
951 | { |
952 | .procname = "tcp_retries2", | |
953 | .data = &init_net.ipv4.sysctl_tcp_retries2, | |
954 | .maxlen = sizeof(int), | |
955 | .mode = 0644, | |
956 | .proc_handler = proc_dointvec | |
957 | }, | |
c402d9be NB |
958 | { |
959 | .procname = "tcp_orphan_retries", | |
960 | .data = &init_net.ipv4.sysctl_tcp_orphan_retries, | |
961 | .maxlen = sizeof(int), | |
962 | .mode = 0644, | |
963 | .proc_handler = proc_dointvec | |
964 | }, | |
1e579caa NB |
965 | { |
966 | .procname = "tcp_fin_timeout", | |
967 | .data = &init_net.ipv4.sysctl_tcp_fin_timeout, | |
968 | .maxlen = sizeof(int), | |
969 | .mode = 0644, | |
970 | .proc_handler = proc_dointvec_jiffies, | |
971 | }, | |
4979f2d9 NB |
972 | { |
973 | .procname = "tcp_notsent_lowat", | |
974 | .data = &init_net.ipv4.sysctl_tcp_notsent_lowat, | |
975 | .maxlen = sizeof(unsigned int), | |
976 | .mode = 0644, | |
b007f090 | 977 | .proc_handler = proc_douintvec, |
4979f2d9 | 978 | }, |
56ab6b93 HY |
979 | { |
980 | .procname = "tcp_tw_reuse", | |
981 | .data = &init_net.ipv4.sysctl_tcp_tw_reuse, | |
982 | .maxlen = sizeof(int), | |
983 | .mode = 0644, | |
79e9fed4 | 984 | .proc_handler = proc_dointvec_minmax, |
eec4844f | 985 | .extra1 = SYSCTL_ZERO, |
79e9fed4 | 986 | .extra2 = &two, |
56ab6b93 | 987 | }, |
1946e672 HY |
988 | { |
989 | .procname = "tcp_max_tw_buckets", | |
990 | .data = &init_net.ipv4.tcp_death_row.sysctl_max_tw_buckets, | |
991 | .maxlen = sizeof(int), | |
992 | .mode = 0644, | |
993 | .proc_handler = proc_dointvec | |
994 | }, | |
fee83d09 HY |
995 | { |
996 | .procname = "tcp_max_syn_backlog", | |
997 | .data = &init_net.ipv4.sysctl_max_syn_backlog, | |
998 | .maxlen = sizeof(int), | |
999 | .mode = 0644, | |
1000 | .proc_handler = proc_dointvec | |
1001 | }, | |
e1cfcbe8 HY |
1002 | { |
1003 | .procname = "tcp_fastopen", | |
1004 | .data = &init_net.ipv4.sysctl_tcp_fastopen, | |
1005 | .maxlen = sizeof(int), | |
1006 | .mode = 0644, | |
1007 | .proc_handler = proc_dointvec, | |
1008 | }, | |
43713848 HY |
1009 | { |
1010 | .procname = "tcp_fastopen_key", | |
1011 | .mode = 0600, | |
1012 | .data = &init_net.ipv4.sysctl_tcp_fastopen, | |
aa1236cd JB |
1013 | /* maxlen to print the list of keys in hex (*2), with dashes |
1014 | * separating doublewords and a comma in between keys. | |
1015 | */ | |
1016 | .maxlen = ((TCP_FASTOPEN_KEY_LENGTH * | |
1017 | 2 * TCP_FASTOPEN_KEY_MAX) + | |
1018 | (TCP_FASTOPEN_KEY_MAX * 5)), | |
43713848 HY |
1019 | .proc_handler = proc_tcp_fastopen_key, |
1020 | }, | |
3733be14 HY |
1021 | { |
1022 | .procname = "tcp_fastopen_blackhole_timeout_sec", | |
1023 | .data = &init_net.ipv4.sysctl_tcp_fastopen_blackhole_timeout, | |
1024 | .maxlen = sizeof(int), | |
1025 | .mode = 0644, | |
1026 | .proc_handler = proc_tfo_blackhole_detect_timeout, | |
eec4844f | 1027 | .extra1 = SYSCTL_ZERO, |
3733be14 | 1028 | }, |
a6db4494 DA |
1029 | #ifdef CONFIG_IP_ROUTE_MULTIPATH |
1030 | { | |
1031 | .procname = "fib_multipath_use_neigh", | |
1032 | .data = &init_net.ipv4.sysctl_fib_multipath_use_neigh, | |
1033 | .maxlen = sizeof(int), | |
1034 | .mode = 0644, | |
1035 | .proc_handler = proc_dointvec_minmax, | |
eec4844f MC |
1036 | .extra1 = SYSCTL_ZERO, |
1037 | .extra2 = SYSCTL_ONE, | |
bf4e0a3d NA |
1038 | }, |
1039 | { | |
1040 | .procname = "fib_multipath_hash_policy", | |
1041 | .data = &init_net.ipv4.sysctl_fib_multipath_hash_policy, | |
1042 | .maxlen = sizeof(int), | |
1043 | .mode = 0644, | |
3ae6ec08 | 1044 | .proc_handler = proc_fib_multipath_hash_policy, |
eec4844f | 1045 | .extra1 = SYSCTL_ZERO, |
ca749bbb | 1046 | .extra2 = &two, |
a6db4494 DA |
1047 | }, |
1048 | #endif | |
4548b683 KJ |
1049 | { |
1050 | .procname = "ip_unprivileged_port_start", | |
1051 | .maxlen = sizeof(int), | |
1052 | .data = &init_net.ipv4.sysctl_ip_prot_sock, | |
1053 | .mode = 0644, | |
1054 | .proc_handler = ipv4_privileged_ports, | |
1055 | }, | |
63a6fff3 RS |
1056 | #ifdef CONFIG_NET_L3_MASTER_DEV |
1057 | { | |
1058 | .procname = "udp_l3mdev_accept", | |
1059 | .data = &init_net.ipv4.sysctl_udp_l3mdev_accept, | |
1060 | .maxlen = sizeof(int), | |
1061 | .mode = 0644, | |
1062 | .proc_handler = proc_dointvec_minmax, | |
eec4844f MC |
1063 | .extra1 = SYSCTL_ZERO, |
1064 | .extra2 = SYSCTL_ONE, | |
63a6fff3 RS |
1065 | }, |
1066 | #endif | |
f9301034 ED |
1067 | { |
1068 | .procname = "tcp_sack", | |
1069 | .data = &init_net.ipv4.sysctl_tcp_sack, | |
1070 | .maxlen = sizeof(int), | |
1071 | .mode = 0644, | |
1072 | .proc_handler = proc_dointvec | |
1073 | }, | |
9bb37ef0 ED |
1074 | { |
1075 | .procname = "tcp_window_scaling", | |
1076 | .data = &init_net.ipv4.sysctl_tcp_window_scaling, | |
1077 | .maxlen = sizeof(int), | |
1078 | .mode = 0644, | |
1079 | .proc_handler = proc_dointvec | |
1080 | }, | |
5d2ed052 ED |
1081 | { |
1082 | .procname = "tcp_timestamps", | |
1083 | .data = &init_net.ipv4.sysctl_tcp_timestamps, | |
1084 | .maxlen = sizeof(int), | |
1085 | .mode = 0644, | |
1086 | .proc_handler = proc_dointvec | |
1087 | }, | |
2ae21cf5 ED |
1088 | { |
1089 | .procname = "tcp_early_retrans", | |
1090 | .data = &init_net.ipv4.sysctl_tcp_early_retrans, | |
1091 | .maxlen = sizeof(int), | |
1092 | .mode = 0644, | |
1093 | .proc_handler = proc_dointvec_minmax, | |
eec4844f | 1094 | .extra1 = SYSCTL_ZERO, |
2ae21cf5 ED |
1095 | .extra2 = &four, |
1096 | }, | |
e20223f1 ED |
1097 | { |
1098 | .procname = "tcp_recovery", | |
1099 | .data = &init_net.ipv4.sysctl_tcp_recovery, | |
1100 | .maxlen = sizeof(int), | |
1101 | .mode = 0644, | |
1102 | .proc_handler = proc_dointvec, | |
1103 | }, | |
2c04ac8a ED |
1104 | { |
1105 | .procname = "tcp_thin_linear_timeouts", | |
1106 | .data = &init_net.ipv4.sysctl_tcp_thin_linear_timeouts, | |
1107 | .maxlen = sizeof(int), | |
1108 | .mode = 0644, | |
1109 | .proc_handler = proc_dointvec | |
1110 | }, | |
b510f0d2 ED |
1111 | { |
1112 | .procname = "tcp_slow_start_after_idle", | |
1113 | .data = &init_net.ipv4.sysctl_tcp_slow_start_after_idle, | |
1114 | .maxlen = sizeof(int), | |
1115 | .mode = 0644, | |
1116 | .proc_handler = proc_dointvec | |
1117 | }, | |
e0a1e5b5 ED |
1118 | { |
1119 | .procname = "tcp_retrans_collapse", | |
1120 | .data = &init_net.ipv4.sysctl_tcp_retrans_collapse, | |
1121 | .maxlen = sizeof(int), | |
1122 | .mode = 0644, | |
1123 | .proc_handler = proc_dointvec | |
1124 | }, | |
3f4c7c6f ED |
1125 | { |
1126 | .procname = "tcp_stdurg", | |
1127 | .data = &init_net.ipv4.sysctl_tcp_stdurg, | |
1128 | .maxlen = sizeof(int), | |
1129 | .mode = 0644, | |
1130 | .proc_handler = proc_dointvec | |
1131 | }, | |
625357aa ED |
1132 | { |
1133 | .procname = "tcp_rfc1337", | |
1134 | .data = &init_net.ipv4.sysctl_tcp_rfc1337, | |
1135 | .maxlen = sizeof(int), | |
1136 | .mode = 0644, | |
1137 | .proc_handler = proc_dointvec | |
1138 | }, | |
65c9410c ED |
1139 | { |
1140 | .procname = "tcp_abort_on_overflow", | |
1141 | .data = &init_net.ipv4.sysctl_tcp_abort_on_overflow, | |
1142 | .maxlen = sizeof(int), | |
1143 | .mode = 0644, | |
1144 | .proc_handler = proc_dointvec | |
1145 | }, | |
0bc65a28 ED |
1146 | { |
1147 | .procname = "tcp_fack", | |
1148 | .data = &init_net.ipv4.sysctl_tcp_fack, | |
1149 | .maxlen = sizeof(int), | |
1150 | .mode = 0644, | |
1151 | .proc_handler = proc_dointvec | |
1152 | }, | |
c6e21803 ED |
1153 | { |
1154 | .procname = "tcp_max_reordering", | |
1155 | .data = &init_net.ipv4.sysctl_tcp_max_reordering, | |
1156 | .maxlen = sizeof(int), | |
1157 | .mode = 0644, | |
1158 | .proc_handler = proc_dointvec | |
1159 | }, | |
6496f6bd ED |
1160 | { |
1161 | .procname = "tcp_dsack", | |
1162 | .data = &init_net.ipv4.sysctl_tcp_dsack, | |
1163 | .maxlen = sizeof(int), | |
1164 | .mode = 0644, | |
1165 | .proc_handler = proc_dointvec | |
1166 | }, | |
0c12654a ED |
1167 | { |
1168 | .procname = "tcp_app_win", | |
1169 | .data = &init_net.ipv4.sysctl_tcp_app_win, | |
1170 | .maxlen = sizeof(int), | |
1171 | .mode = 0644, | |
1172 | .proc_handler = proc_dointvec | |
1173 | }, | |
94f0893e ED |
1174 | { |
1175 | .procname = "tcp_adv_win_scale", | |
1176 | .data = &init_net.ipv4.sysctl_tcp_adv_win_scale, | |
1177 | .maxlen = sizeof(int), | |
1178 | .mode = 0644, | |
1179 | .proc_handler = proc_dointvec_minmax, | |
1180 | .extra1 = &tcp_adv_win_scale_min, | |
1181 | .extra2 = &tcp_adv_win_scale_max, | |
1182 | }, | |
af9b69a7 ED |
1183 | { |
1184 | .procname = "tcp_frto", | |
1185 | .data = &init_net.ipv4.sysctl_tcp_frto, | |
1186 | .maxlen = sizeof(int), | |
1187 | .mode = 0644, | |
1188 | .proc_handler = proc_dointvec | |
1189 | }, | |
ec36e416 ED |
1190 | { |
1191 | .procname = "tcp_no_metrics_save", | |
1192 | .data = &init_net.ipv4.sysctl_tcp_nometrics_save, | |
1193 | .maxlen = sizeof(int), | |
1194 | .mode = 0644, | |
1195 | .proc_handler = proc_dointvec, | |
1196 | }, | |
65e6d901 KYY |
1197 | { |
1198 | .procname = "tcp_no_ssthresh_metrics_save", | |
1199 | .data = &init_net.ipv4.sysctl_tcp_no_ssthresh_metrics_save, | |
1200 | .maxlen = sizeof(int), | |
1201 | .mode = 0644, | |
1202 | .proc_handler = proc_dointvec_minmax, | |
1203 | .extra1 = SYSCTL_ZERO, | |
1204 | .extra2 = SYSCTL_ONE, | |
1205 | }, | |
4540c0cf ED |
1206 | { |
1207 | .procname = "tcp_moderate_rcvbuf", | |
1208 | .data = &init_net.ipv4.sysctl_tcp_moderate_rcvbuf, | |
1209 | .maxlen = sizeof(int), | |
1210 | .mode = 0644, | |
1211 | .proc_handler = proc_dointvec, | |
1212 | }, | |
d06a9904 ED |
1213 | { |
1214 | .procname = "tcp_tso_win_divisor", | |
1215 | .data = &init_net.ipv4.sysctl_tcp_tso_win_divisor, | |
1216 | .maxlen = sizeof(int), | |
1217 | .mode = 0644, | |
1218 | .proc_handler = proc_dointvec, | |
1219 | }, | |
ceef9ab6 ED |
1220 | { |
1221 | .procname = "tcp_workaround_signed_windows", | |
1222 | .data = &init_net.ipv4.sysctl_tcp_workaround_signed_windows, | |
1223 | .maxlen = sizeof(int), | |
1224 | .mode = 0644, | |
1225 | .proc_handler = proc_dointvec | |
1226 | }, | |
9184d8bb ED |
1227 | { |
1228 | .procname = "tcp_limit_output_bytes", | |
1229 | .data = &init_net.ipv4.sysctl_tcp_limit_output_bytes, | |
1230 | .maxlen = sizeof(int), | |
1231 | .mode = 0644, | |
1232 | .proc_handler = proc_dointvec | |
1233 | }, | |
b530b681 ED |
1234 | { |
1235 | .procname = "tcp_challenge_ack_limit", | |
1236 | .data = &init_net.ipv4.sysctl_tcp_challenge_ack_limit, | |
1237 | .maxlen = sizeof(int), | |
1238 | .mode = 0644, | |
1239 | .proc_handler = proc_dointvec | |
1240 | }, | |
26e9596e ED |
1241 | { |
1242 | .procname = "tcp_min_tso_segs", | |
1243 | .data = &init_net.ipv4.sysctl_tcp_min_tso_segs, | |
1244 | .maxlen = sizeof(int), | |
1245 | .mode = 0644, | |
1246 | .proc_handler = proc_dointvec_minmax, | |
eec4844f | 1247 | .extra1 = SYSCTL_ONE, |
26e9596e ED |
1248 | .extra2 = &gso_max_segs, |
1249 | }, | |
bd239704 ED |
1250 | { |
1251 | .procname = "tcp_min_rtt_wlen", | |
1252 | .data = &init_net.ipv4.sysctl_tcp_min_rtt_wlen, | |
1253 | .maxlen = sizeof(int), | |
1254 | .mode = 0644, | |
19fad20d | 1255 | .proc_handler = proc_dointvec_minmax, |
eec4844f | 1256 | .extra1 = SYSCTL_ZERO, |
19fad20d | 1257 | .extra2 = &one_day_secs |
bd239704 | 1258 | }, |
790f00e1 ED |
1259 | { |
1260 | .procname = "tcp_autocorking", | |
1261 | .data = &init_net.ipv4.sysctl_tcp_autocorking, | |
1262 | .maxlen = sizeof(int), | |
1263 | .mode = 0644, | |
1264 | .proc_handler = proc_dointvec_minmax, | |
eec4844f MC |
1265 | .extra1 = SYSCTL_ZERO, |
1266 | .extra2 = SYSCTL_ONE, | |
790f00e1 | 1267 | }, |
4170ba6b ED |
1268 | { |
1269 | .procname = "tcp_invalid_ratelimit", | |
1270 | .data = &init_net.ipv4.sysctl_tcp_invalid_ratelimit, | |
1271 | .maxlen = sizeof(int), | |
1272 | .mode = 0644, | |
1273 | .proc_handler = proc_dointvec_ms_jiffies, | |
1274 | }, | |
23a7102a ED |
1275 | { |
1276 | .procname = "tcp_pacing_ss_ratio", | |
1277 | .data = &init_net.ipv4.sysctl_tcp_pacing_ss_ratio, | |
1278 | .maxlen = sizeof(int), | |
1279 | .mode = 0644, | |
1280 | .proc_handler = proc_dointvec_minmax, | |
eec4844f | 1281 | .extra1 = SYSCTL_ZERO, |
23a7102a ED |
1282 | .extra2 = &thousand, |
1283 | }, | |
c26e91f8 ED |
1284 | { |
1285 | .procname = "tcp_pacing_ca_ratio", | |
1286 | .data = &init_net.ipv4.sysctl_tcp_pacing_ca_ratio, | |
1287 | .maxlen = sizeof(int), | |
1288 | .mode = 0644, | |
1289 | .proc_handler = proc_dointvec_minmax, | |
eec4844f | 1290 | .extra1 = SYSCTL_ZERO, |
c26e91f8 ED |
1291 | .extra2 = &thousand, |
1292 | }, | |
356d1833 ED |
1293 | { |
1294 | .procname = "tcp_wmem", | |
1295 | .data = &init_net.ipv4.sysctl_tcp_wmem, | |
1296 | .maxlen = sizeof(init_net.ipv4.sysctl_tcp_wmem), | |
1297 | .mode = 0644, | |
1298 | .proc_handler = proc_dointvec_minmax, | |
eec4844f | 1299 | .extra1 = SYSCTL_ONE, |
356d1833 ED |
1300 | }, |
1301 | { | |
1302 | .procname = "tcp_rmem", | |
1303 | .data = &init_net.ipv4.sysctl_tcp_rmem, | |
1304 | .maxlen = sizeof(init_net.ipv4.sysctl_tcp_rmem), | |
1305 | .mode = 0644, | |
1306 | .proc_handler = proc_dointvec_minmax, | |
eec4844f | 1307 | .extra1 = SYSCTL_ONE, |
356d1833 | 1308 | }, |
6d82aa24 ED |
1309 | { |
1310 | .procname = "tcp_comp_sack_delay_ns", | |
1311 | .data = &init_net.ipv4.sysctl_tcp_comp_sack_delay_ns, | |
1312 | .maxlen = sizeof(unsigned long), | |
1313 | .mode = 0644, | |
1314 | .proc_handler = proc_doulongvec_minmax, | |
1315 | }, | |
a70437cc ED |
1316 | { |
1317 | .procname = "tcp_comp_sack_slack_ns", | |
1318 | .data = &init_net.ipv4.sysctl_tcp_comp_sack_slack_ns, | |
1319 | .maxlen = sizeof(unsigned long), | |
1320 | .mode = 0644, | |
1321 | .proc_handler = proc_doulongvec_minmax, | |
1322 | }, | |
9c21d2fc ED |
1323 | { |
1324 | .procname = "tcp_comp_sack_nr", | |
1325 | .data = &init_net.ipv4.sysctl_tcp_comp_sack_nr, | |
1326 | .maxlen = sizeof(int), | |
1327 | .mode = 0644, | |
1328 | .proc_handler = proc_dointvec_minmax, | |
eec4844f | 1329 | .extra1 = SYSCTL_ZERO, |
9c21d2fc ED |
1330 | .extra2 = &comp_sack_nr_max, |
1331 | }, | |
ac8f1710 WW |
1332 | { |
1333 | .procname = "tcp_reflect_tos", | |
1334 | .data = &init_net.ipv4.sysctl_tcp_reflect_tos, | |
1335 | .maxlen = sizeof(int), | |
1336 | .mode = 0644, | |
1337 | .proc_handler = proc_dointvec_minmax, | |
1338 | .extra1 = SYSCTL_ZERO, | |
1339 | .extra2 = SYSCTL_ONE, | |
1340 | }, | |
1e802951 TZ |
1341 | { |
1342 | .procname = "udp_rmem_min", | |
1343 | .data = &init_net.ipv4.sysctl_udp_rmem_min, | |
1344 | .maxlen = sizeof(init_net.ipv4.sysctl_udp_rmem_min), | |
1345 | .mode = 0644, | |
1346 | .proc_handler = proc_dointvec_minmax, | |
eec4844f | 1347 | .extra1 = SYSCTL_ONE |
1e802951 TZ |
1348 | }, |
1349 | { | |
1350 | .procname = "udp_wmem_min", | |
1351 | .data = &init_net.ipv4.sysctl_udp_wmem_min, | |
1352 | .maxlen = sizeof(init_net.ipv4.sysctl_udp_wmem_min), | |
1353 | .mode = 0644, | |
1354 | .proc_handler = proc_dointvec_minmax, | |
eec4844f | 1355 | .extra1 = SYSCTL_ONE |
1e802951 | 1356 | }, |
680aea08 AC |
1357 | { |
1358 | .procname = "fib_notify_on_flag_change", | |
1359 | .data = &init_net.ipv4.sysctl_fib_notify_on_flag_change, | |
1360 | .maxlen = sizeof(int), | |
1361 | .mode = 0644, | |
1362 | .proc_handler = proc_dointvec_minmax, | |
1363 | .extra1 = SYSCTL_ZERO, | |
648106c3 | 1364 | .extra2 = &two, |
680aea08 | 1365 | }, |
68528f09 PE |
1366 | { } |
1367 | }; | |
1368 | ||
1577519d PE |
1369 | static __net_init int ipv4_sysctl_init_net(struct net *net) |
1370 | { | |
68528f09 PE |
1371 | struct ctl_table *table; |
1372 | ||
1373 | table = ipv4_net_table; | |
09ad9bc7 | 1374 | if (!net_eq(net, &init_net)) { |
0a6fa23d EB |
1375 | int i; |
1376 | ||
68528f09 | 1377 | table = kmemdup(table, sizeof(ipv4_net_table), GFP_KERNEL); |
51456b29 | 1378 | if (!table) |
68528f09 PE |
1379 | goto err_alloc; |
1380 | ||
97684f09 JR |
1381 | for (i = 0; i < ARRAY_SIZE(ipv4_net_table) - 1; i++) { |
1382 | if (table[i].data) { | |
1383 | /* Update the variables to point into | |
1384 | * the current struct net | |
1385 | */ | |
1386 | table[i].data += (void *)net - (void *)&init_net; | |
1387 | } else { | |
1388 | /* Entries without data pointer are global; | |
1389 | * Make them read-only in non-init_net ns | |
1390 | */ | |
1391 | table[i].mode &= ~0222; | |
1392 | } | |
1393 | } | |
68528f09 PE |
1394 | } |
1395 | ||
ec8f23ce | 1396 | net->ipv4.ipv4_hdr = register_net_sysctl(net, "net/ipv4", table); |
51456b29 | 1397 | if (!net->ipv4.ipv4_hdr) |
68528f09 PE |
1398 | goto err_reg; |
1399 | ||
122ff243 WC |
1400 | net->ipv4.sysctl_local_reserved_ports = kzalloc(65536 / 8, GFP_KERNEL); |
1401 | if (!net->ipv4.sysctl_local_reserved_ports) | |
1402 | goto err_ports; | |
1403 | ||
1577519d | 1404 | return 0; |
68528f09 | 1405 | |
122ff243 WC |
1406 | err_ports: |
1407 | unregister_net_sysctl_table(net->ipv4.ipv4_hdr); | |
68528f09 | 1408 | err_reg: |
09ad9bc7 | 1409 | if (!net_eq(net, &init_net)) |
68528f09 PE |
1410 | kfree(table); |
1411 | err_alloc: | |
1412 | return -ENOMEM; | |
1577519d PE |
1413 | } |
1414 | ||
1415 | static __net_exit void ipv4_sysctl_exit_net(struct net *net) | |
1416 | { | |
68528f09 PE |
1417 | struct ctl_table *table; |
1418 | ||
122ff243 | 1419 | kfree(net->ipv4.sysctl_local_reserved_ports); |
68528f09 PE |
1420 | table = net->ipv4.ipv4_hdr->ctl_table_arg; |
1421 | unregister_net_sysctl_table(net->ipv4.ipv4_hdr); | |
1422 | kfree(table); | |
1577519d PE |
1423 | } |
1424 | ||
1425 | static __net_initdata struct pernet_operations ipv4_sysctl_ops = { | |
1426 | .init = ipv4_sysctl_init_net, | |
1427 | .exit = ipv4_sysctl_exit_net, | |
1428 | }; | |
1429 | ||
3e37c3f9 PE |
1430 | static __init int sysctl_ipv4_init(void) |
1431 | { | |
1432 | struct ctl_table_header *hdr; | |
1433 | ||
ec8f23ce | 1434 | hdr = register_net_sysctl(&init_net, "net/ipv4", ipv4_table); |
51456b29 | 1435 | if (!hdr) |
1577519d PE |
1436 | return -ENOMEM; |
1437 | ||
1438 | if (register_pernet_subsys(&ipv4_sysctl_ops)) { | |
5dd3df10 | 1439 | unregister_net_sysctl_table(hdr); |
1577519d PE |
1440 | return -ENOMEM; |
1441 | } | |
1442 | ||
1443 | return 0; | |
3e37c3f9 PE |
1444 | } |
1445 | ||
1446 | __initcall(sysctl_ipv4_init); |