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