Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * sysctl_net_ipv4.c: sysctl interface to net IPV4 subsystem. |
| 3 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * Begun April 1, 1996, Mike Shaver. |
| 5 | * Added /proc/sys/net/ipv4 directory entry (empty =) ). [MS] |
| 6 | */ |
| 7 | |
| 8 | #include <linux/mm.h> |
| 9 | #include <linux/module.h> |
| 10 | #include <linux/sysctl.h> |
Arnaldo Carvalho de Melo | 2038073 | 2005-08-16 02:18:02 -0300 | [diff] [blame] | 11 | #include <linux/igmp.h> |
Arnaldo Carvalho de Melo | 14c8502 | 2005-12-27 02:43:12 -0200 | [diff] [blame] | 12 | #include <linux/inetdevice.h> |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 13 | #include <linux/seqlock.h> |
Pavel Emelyanov | 3e37c3f | 2007-12-05 01:41:26 -0800 | [diff] [blame] | 14 | #include <linux/init.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 15 | #include <linux/slab.h> |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 16 | #include <linux/nsproxy.h> |
Glauber Costa | 3dc43e3 | 2011-12-11 21:47:05 +0000 | [diff] [blame] | 17 | #include <linux/swap.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | #include <net/snmp.h> |
Arnaldo Carvalho de Melo | 2038073 | 2005-08-16 02:18:02 -0300 | [diff] [blame] | 19 | #include <net/icmp.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | #include <net/ip.h> |
| 21 | #include <net/route.h> |
| 22 | #include <net/tcp.h> |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 23 | #include <net/udp.h> |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 24 | #include <net/cipso_ipv4.h> |
Pavel Emelyanov | 04128f2 | 2007-10-15 02:33:45 -0700 | [diff] [blame] | 25 | #include <net/inet_frag.h> |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 26 | #include <net/ping.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | |
Herbert Xu | 89cee8b | 2005-12-13 23:14:27 -0800 | [diff] [blame] | 28 | static int zero; |
bingtian.ly@taobao.com | cdda889 | 2013-01-23 20:35:28 +0000 | [diff] [blame] | 29 | static int one = 1; |
Nandita Dukkipati | 6ba8a3b | 2013-03-11 10:00:43 +0000 | [diff] [blame] | 30 | static int four = 4; |
Eric Dumazet | 43e122b | 2015-08-21 17:38:02 -0700 | [diff] [blame] | 31 | static int thousand = 1000; |
Eric Dumazet | 95bd09e | 2013-08-27 05:46:32 -0700 | [diff] [blame] | 32 | static int gso_max_segs = GSO_MAX_SEGS; |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 33 | static int tcp_retr1_max = 255; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | static int ip_local_port_range_min[] = { 1, 1 }; |
| 35 | static int ip_local_port_range_max[] = { 65535, 65535 }; |
Alexey Dobriyan | 0147fc0 | 2010-11-22 12:54:21 +0000 | [diff] [blame] | 36 | static int tcp_adv_win_scale_min = -31; |
| 37 | static int tcp_adv_win_scale_max = 31; |
Eric Dumazet | 249fab7 | 2010-12-13 12:16:14 -0800 | [diff] [blame] | 38 | static int ip_ttl_min = 1; |
| 39 | static int ip_ttl_max = 255; |
Michal Tesar | 651e927 | 2013-07-19 14:09:01 +0200 | [diff] [blame] | 40 | static int tcp_syn_retries_min = 1; |
| 41 | static int tcp_syn_retries_max = MAX_TCP_SYNCNT; |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 42 | static int ip_ping_group_range_min[] = { 0, 0 }; |
| 43 | static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 45 | /* Update system visible IP port range */ |
Eric W. Biederman | 0bbf87d | 2013-09-28 14:10:59 -0700 | [diff] [blame] | 46 | static void set_local_port_range(struct net *net, int range[2]) |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 47 | { |
Eric Dumazet | ed2dfd9 | 2015-05-27 11:34:37 -0700 | [diff] [blame] | 48 | bool same_parity = !((range[0] ^ range[1]) & 1); |
| 49 | |
WANG Cong | 4ee3bd4 | 2015-11-03 14:32:57 -0800 | [diff] [blame] | 50 | write_seqlock_bh(&net->ipv4.ip_local_ports.lock); |
Eric Dumazet | ed2dfd9 | 2015-05-27 11:34:37 -0700 | [diff] [blame] | 51 | if (same_parity && !net->ipv4.ip_local_ports.warned) { |
| 52 | net->ipv4.ip_local_ports.warned = true; |
| 53 | pr_err_ratelimited("ip_local_port_range: prefer different parity for start/end values.\n"); |
| 54 | } |
Cong Wang | c9d8f1a | 2014-05-06 11:02:49 -0700 | [diff] [blame] | 55 | net->ipv4.ip_local_ports.range[0] = range[0]; |
| 56 | net->ipv4.ip_local_ports.range[1] = range[1]; |
WANG Cong | 4ee3bd4 | 2015-11-03 14:32:57 -0800 | [diff] [blame] | 57 | write_sequnlock_bh(&net->ipv4.ip_local_ports.lock); |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 58 | } |
| 59 | |
| 60 | /* Validate changes from /proc interface. */ |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 61 | static int ipv4_local_port_range(struct ctl_table *table, int write, |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 62 | void __user *buffer, |
| 63 | size_t *lenp, loff_t *ppos) |
| 64 | { |
Eric W. Biederman | 0bbf87d | 2013-09-28 14:10:59 -0700 | [diff] [blame] | 65 | struct net *net = |
Cong Wang | c9d8f1a | 2014-05-06 11:02:49 -0700 | [diff] [blame] | 66 | container_of(table->data, struct net, ipv4.ip_local_ports.range); |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 67 | int ret; |
Eric Dumazet | 3c689b7 | 2008-10-08 14:18:04 -0700 | [diff] [blame] | 68 | int range[2]; |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 69 | struct ctl_table tmp = { |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 70 | .data = &range, |
| 71 | .maxlen = sizeof(range), |
| 72 | .mode = table->mode, |
| 73 | .extra1 = &ip_local_port_range_min, |
| 74 | .extra2 = &ip_local_port_range_max, |
| 75 | }; |
| 76 | |
Eric W. Biederman | 0bbf87d | 2013-09-28 14:10:59 -0700 | [diff] [blame] | 77 | inet_get_local_port_range(net, &range[0], &range[1]); |
| 78 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 79 | ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos); |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 80 | |
| 81 | if (write && ret == 0) { |
Anton Arapov | a25de53 | 2007-10-18 22:00:17 -0700 | [diff] [blame] | 82 | if (range[1] < range[0]) |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 83 | ret = -EINVAL; |
| 84 | else |
Eric W. Biederman | 0bbf87d | 2013-09-28 14:10:59 -0700 | [diff] [blame] | 85 | set_local_port_range(net, range); |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 86 | } |
| 87 | |
| 88 | return ret; |
| 89 | } |
| 90 | |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 91 | |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 92 | static void inet_get_ping_group_range_table(struct ctl_table *table, kgid_t *low, kgid_t *high) |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 93 | { |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 94 | kgid_t *data = table->data; |
Eric W. Biederman | 0bbf87d | 2013-09-28 14:10:59 -0700 | [diff] [blame] | 95 | struct net *net = |
Cong Wang | ba6b918 | 2014-05-06 11:02:50 -0700 | [diff] [blame] | 96 | container_of(table->data, struct net, ipv4.ping_group_range.range); |
Eric Dumazet | 95c9617 | 2012-04-15 05:58:06 +0000 | [diff] [blame] | 97 | unsigned int seq; |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 98 | do { |
Cong Wang | c9d8f1a | 2014-05-06 11:02:49 -0700 | [diff] [blame] | 99 | seq = read_seqbegin(&net->ipv4.ip_local_ports.lock); |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 100 | |
| 101 | *low = data[0]; |
| 102 | *high = data[1]; |
Cong Wang | c9d8f1a | 2014-05-06 11:02:49 -0700 | [diff] [blame] | 103 | } while (read_seqretry(&net->ipv4.ip_local_ports.lock, seq)); |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | /* Update system visible IP port range */ |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 107 | static void set_ping_group_range(struct ctl_table *table, kgid_t low, kgid_t high) |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 108 | { |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 109 | kgid_t *data = table->data; |
Eric W. Biederman | 0bbf87d | 2013-09-28 14:10:59 -0700 | [diff] [blame] | 110 | struct net *net = |
Cong Wang | ba6b918 | 2014-05-06 11:02:50 -0700 | [diff] [blame] | 111 | container_of(table->data, struct net, ipv4.ping_group_range.range); |
Cong Wang | c9d8f1a | 2014-05-06 11:02:49 -0700 | [diff] [blame] | 112 | write_seqlock(&net->ipv4.ip_local_ports.lock); |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 113 | data[0] = low; |
| 114 | data[1] = high; |
Cong Wang | c9d8f1a | 2014-05-06 11:02:49 -0700 | [diff] [blame] | 115 | write_sequnlock(&net->ipv4.ip_local_ports.lock); |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 116 | } |
| 117 | |
| 118 | /* Validate changes from /proc interface. */ |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 119 | static int ipv4_ping_group_range(struct ctl_table *table, int write, |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 120 | void __user *buffer, |
| 121 | size_t *lenp, loff_t *ppos) |
| 122 | { |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 123 | struct user_namespace *user_ns = current_user_ns(); |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 124 | int ret; |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 125 | gid_t urange[2]; |
| 126 | kgid_t low, high; |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 127 | struct ctl_table tmp = { |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 128 | .data = &urange, |
| 129 | .maxlen = sizeof(urange), |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 130 | .mode = table->mode, |
| 131 | .extra1 = &ip_ping_group_range_min, |
| 132 | .extra2 = &ip_ping_group_range_max, |
| 133 | }; |
| 134 | |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 135 | inet_get_ping_group_range_table(table, &low, &high); |
| 136 | urange[0] = from_kgid_munged(user_ns, low); |
| 137 | urange[1] = from_kgid_munged(user_ns, high); |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 138 | ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos); |
| 139 | |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 140 | if (write && ret == 0) { |
| 141 | low = make_kgid(user_ns, urange[0]); |
| 142 | high = make_kgid(user_ns, urange[1]); |
| 143 | if (!gid_valid(low) || !gid_valid(high) || |
| 144 | (urange[1] < urange[0]) || gid_lt(high, low)) { |
| 145 | low = make_kgid(&init_user_ns, 1); |
| 146 | high = make_kgid(&init_user_ns, 0); |
| 147 | } |
| 148 | set_ping_group_range(table, low, high); |
| 149 | } |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 150 | |
| 151 | return ret; |
| 152 | } |
| 153 | |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 154 | static int proc_tcp_congestion_control(struct ctl_table *ctl, int write, |
Stephen Hemminger | 317a76f | 2005-06-23 12:19:55 -0700 | [diff] [blame] | 155 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 156 | { |
| 157 | char val[TCP_CA_NAME_MAX]; |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 158 | struct ctl_table tbl = { |
Stephen Hemminger | 317a76f | 2005-06-23 12:19:55 -0700 | [diff] [blame] | 159 | .data = val, |
| 160 | .maxlen = TCP_CA_NAME_MAX, |
| 161 | }; |
| 162 | int ret; |
| 163 | |
| 164 | tcp_get_default_congestion_control(val); |
| 165 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 166 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
Stephen Hemminger | 317a76f | 2005-06-23 12:19:55 -0700 | [diff] [blame] | 167 | if (write && ret == 0) |
| 168 | ret = tcp_set_default_congestion_control(val); |
| 169 | return ret; |
| 170 | } |
| 171 | |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 172 | static int proc_tcp_available_congestion_control(struct ctl_table *ctl, |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 173 | int write, |
Stephen Hemminger | 3ff825b | 2006-11-09 16:32:06 -0800 | [diff] [blame] | 174 | void __user *buffer, size_t *lenp, |
| 175 | loff_t *ppos) |
| 176 | { |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 177 | struct ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX, }; |
Stephen Hemminger | 3ff825b | 2006-11-09 16:32:06 -0800 | [diff] [blame] | 178 | int ret; |
| 179 | |
| 180 | tbl.data = kmalloc(tbl.maxlen, GFP_USER); |
| 181 | if (!tbl.data) |
| 182 | return -ENOMEM; |
| 183 | tcp_get_available_congestion_control(tbl.data, TCP_CA_BUF_MAX); |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 184 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
Stephen Hemminger | 3ff825b | 2006-11-09 16:32:06 -0800 | [diff] [blame] | 185 | kfree(tbl.data); |
| 186 | return ret; |
| 187 | } |
| 188 | |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 189 | static int proc_allowed_congestion_control(struct ctl_table *ctl, |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 190 | int write, |
Stephen Hemminger | ce7bc3b | 2006-11-09 16:35:15 -0800 | [diff] [blame] | 191 | void __user *buffer, size_t *lenp, |
| 192 | loff_t *ppos) |
| 193 | { |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 194 | struct ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX }; |
Stephen Hemminger | ce7bc3b | 2006-11-09 16:35:15 -0800 | [diff] [blame] | 195 | int ret; |
| 196 | |
| 197 | tbl.data = kmalloc(tbl.maxlen, GFP_USER); |
| 198 | if (!tbl.data) |
| 199 | return -ENOMEM; |
| 200 | |
| 201 | tcp_get_allowed_congestion_control(tbl.data, tbl.maxlen); |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 202 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
Stephen Hemminger | ce7bc3b | 2006-11-09 16:35:15 -0800 | [diff] [blame] | 203 | if (write && ret == 0) |
| 204 | ret = tcp_set_allowed_congestion_control(tbl.data); |
| 205 | kfree(tbl.data); |
| 206 | return ret; |
| 207 | } |
| 208 | |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 209 | static int proc_tcp_fastopen_key(struct ctl_table *ctl, int write, |
| 210 | void __user *buffer, size_t *lenp, |
| 211 | loff_t *ppos) |
Jerry Chu | 1046716 | 2012-08-31 12:29:11 +0000 | [diff] [blame] | 212 | { |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 213 | struct ctl_table tbl = { .maxlen = (TCP_FASTOPEN_KEY_LENGTH * 2 + 10) }; |
Jerry Chu | 1046716 | 2012-08-31 12:29:11 +0000 | [diff] [blame] | 214 | struct tcp_fastopen_context *ctxt; |
| 215 | int ret; |
| 216 | u32 user_key[4]; /* 16 bytes, matching TCP_FASTOPEN_KEY_LENGTH */ |
| 217 | |
| 218 | tbl.data = kmalloc(tbl.maxlen, GFP_KERNEL); |
| 219 | if (!tbl.data) |
| 220 | return -ENOMEM; |
| 221 | |
| 222 | rcu_read_lock(); |
| 223 | ctxt = rcu_dereference(tcp_fastopen_ctx); |
| 224 | if (ctxt) |
| 225 | memcpy(user_key, ctxt->key, TCP_FASTOPEN_KEY_LENGTH); |
Alan Cox | 0e24c4f | 2012-10-11 06:24:14 +0000 | [diff] [blame] | 226 | else |
| 227 | memset(user_key, 0, sizeof(user_key)); |
Jerry Chu | 1046716 | 2012-08-31 12:29:11 +0000 | [diff] [blame] | 228 | rcu_read_unlock(); |
| 229 | |
| 230 | snprintf(tbl.data, tbl.maxlen, "%08x-%08x-%08x-%08x", |
| 231 | user_key[0], user_key[1], user_key[2], user_key[3]); |
| 232 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
| 233 | |
| 234 | if (write && ret == 0) { |
| 235 | if (sscanf(tbl.data, "%x-%x-%x-%x", user_key, user_key + 1, |
| 236 | user_key + 2, user_key + 3) != 4) { |
| 237 | ret = -EINVAL; |
| 238 | goto bad_key; |
| 239 | } |
Hannes Frederic Sowa | 222e83d | 2013-10-19 21:48:58 +0200 | [diff] [blame] | 240 | /* Generate a dummy secret but don't publish it. This |
| 241 | * is needed so we don't regenerate a new key on the |
| 242 | * first invocation of tcp_fastopen_cookie_gen |
| 243 | */ |
| 244 | tcp_fastopen_init_key_once(false); |
Jerry Chu | 1046716 | 2012-08-31 12:29:11 +0000 | [diff] [blame] | 245 | tcp_fastopen_reset_cipher(user_key, TCP_FASTOPEN_KEY_LENGTH); |
| 246 | } |
| 247 | |
| 248 | bad_key: |
| 249 | pr_debug("proc FO key set 0x%x-%x-%x-%x <- 0x%s: %u\n", |
| 250 | user_key[0], user_key[1], user_key[2], user_key[3], |
| 251 | (char *)tbl.data, ret); |
| 252 | kfree(tbl.data); |
| 253 | return ret; |
| 254 | } |
| 255 | |
Pavel Emelyanov | 3e37c3f | 2007-12-05 01:41:26 -0800 | [diff] [blame] | 256 | static struct ctl_table ipv4_table[] = { |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 257 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 258 | .procname = "tcp_timestamps", |
| 259 | .data = &sysctl_tcp_timestamps, |
| 260 | .maxlen = sizeof(int), |
| 261 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 262 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 263 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 264 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | .procname = "tcp_window_scaling", |
| 266 | .data = &sysctl_tcp_window_scaling, |
| 267 | .maxlen = sizeof(int), |
| 268 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 269 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 270 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 271 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | .procname = "tcp_sack", |
| 273 | .data = &sysctl_tcp_sack, |
| 274 | .maxlen = sizeof(int), |
| 275 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 276 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 278 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | .procname = "tcp_retrans_collapse", |
| 280 | .data = &sysctl_tcp_retrans_collapse, |
| 281 | .maxlen = sizeof(int), |
| 282 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 283 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 284 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 285 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 286 | .procname = "ip_default_ttl", |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 287 | .data = &sysctl_ip_default_ttl, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 288 | .maxlen = sizeof(int), |
| 289 | .mode = 0644, |
Eric Dumazet | 249fab7 | 2010-12-13 12:16:14 -0800 | [diff] [blame] | 290 | .proc_handler = proc_dointvec_minmax, |
| 291 | .extra1 = &ip_ttl_min, |
| 292 | .extra2 = &ip_ttl_max, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 294 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 295 | .procname = "tcp_syn_retries", |
| 296 | .data = &sysctl_tcp_syn_retries, |
| 297 | .maxlen = sizeof(int), |
| 298 | .mode = 0644, |
Michal Tesar | 651e927 | 2013-07-19 14:09:01 +0200 | [diff] [blame] | 299 | .proc_handler = proc_dointvec_minmax, |
| 300 | .extra1 = &tcp_syn_retries_min, |
| 301 | .extra2 = &tcp_syn_retries_max |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | }, |
| 303 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 304 | .procname = "tcp_synack_retries", |
| 305 | .data = &sysctl_tcp_synack_retries, |
| 306 | .maxlen = sizeof(int), |
| 307 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 308 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | }, |
| 310 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | .procname = "tcp_max_orphans", |
| 312 | .data = &sysctl_tcp_max_orphans, |
| 313 | .maxlen = sizeof(int), |
| 314 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 315 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 316 | }, |
| 317 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | .procname = "tcp_max_tw_buckets", |
Arnaldo Carvalho de Melo | 295ff7e | 2005-08-09 20:44:40 -0700 | [diff] [blame] | 319 | .data = &tcp_death_row.sysctl_max_tw_buckets, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | .maxlen = sizeof(int), |
| 321 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 322 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | }, |
| 324 | { |
Alexander Duyck | 6648bd7 | 2012-06-21 13:58:31 +0000 | [diff] [blame] | 325 | .procname = "ip_early_demux", |
| 326 | .data = &sysctl_ip_early_demux, |
| 327 | .maxlen = sizeof(int), |
| 328 | .mode = 0644, |
| 329 | .proc_handler = proc_dointvec |
| 330 | }, |
| 331 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 332 | .procname = "ip_dynaddr", |
| 333 | .data = &sysctl_ip_dynaddr, |
| 334 | .maxlen = sizeof(int), |
| 335 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 336 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 337 | }, |
| 338 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | .procname = "tcp_retries1", |
| 340 | .data = &sysctl_tcp_retries1, |
| 341 | .maxlen = sizeof(int), |
| 342 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 343 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 344 | .extra2 = &tcp_retr1_max |
| 345 | }, |
| 346 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 347 | .procname = "tcp_retries2", |
| 348 | .data = &sysctl_tcp_retries2, |
| 349 | .maxlen = sizeof(int), |
| 350 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 351 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | }, |
| 353 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 354 | .procname = "tcp_fin_timeout", |
| 355 | .data = &sysctl_tcp_fin_timeout, |
| 356 | .maxlen = sizeof(int), |
| 357 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 358 | .proc_handler = proc_dointvec_jiffies, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 359 | }, |
| 360 | #ifdef CONFIG_SYN_COOKIES |
| 361 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 362 | .procname = "tcp_syncookies", |
| 363 | .data = &sysctl_tcp_syncookies, |
| 364 | .maxlen = sizeof(int), |
| 365 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 366 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 367 | }, |
| 368 | #endif |
| 369 | { |
Yuchung Cheng | 2100c8d | 2012-07-19 06:43:05 +0000 | [diff] [blame] | 370 | .procname = "tcp_fastopen", |
| 371 | .data = &sysctl_tcp_fastopen, |
| 372 | .maxlen = sizeof(int), |
| 373 | .mode = 0644, |
| 374 | .proc_handler = proc_dointvec, |
| 375 | }, |
| 376 | { |
Jerry Chu | 1046716 | 2012-08-31 12:29:11 +0000 | [diff] [blame] | 377 | .procname = "tcp_fastopen_key", |
| 378 | .mode = 0600, |
| 379 | .maxlen = ((TCP_FASTOPEN_KEY_LENGTH * 2) + 10), |
| 380 | .proc_handler = proc_tcp_fastopen_key, |
| 381 | }, |
| 382 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 | .procname = "tcp_tw_recycle", |
Arnaldo Carvalho de Melo | 295ff7e | 2005-08-09 20:44:40 -0700 | [diff] [blame] | 384 | .data = &tcp_death_row.sysctl_tw_recycle, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 385 | .maxlen = sizeof(int), |
| 386 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 387 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 388 | }, |
| 389 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 390 | .procname = "tcp_abort_on_overflow", |
| 391 | .data = &sysctl_tcp_abort_on_overflow, |
| 392 | .maxlen = sizeof(int), |
| 393 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 394 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 395 | }, |
| 396 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 397 | .procname = "tcp_stdurg", |
| 398 | .data = &sysctl_tcp_stdurg, |
| 399 | .maxlen = sizeof(int), |
| 400 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 401 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 402 | }, |
| 403 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 404 | .procname = "tcp_rfc1337", |
| 405 | .data = &sysctl_tcp_rfc1337, |
| 406 | .maxlen = sizeof(int), |
| 407 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 408 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 409 | }, |
| 410 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 411 | .procname = "tcp_max_syn_backlog", |
| 412 | .data = &sysctl_max_syn_backlog, |
| 413 | .maxlen = sizeof(int), |
| 414 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 415 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 416 | }, |
| 417 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 418 | .procname = "igmp_max_memberships", |
| 419 | .data = &sysctl_igmp_max_memberships, |
| 420 | .maxlen = sizeof(int), |
| 421 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 422 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 423 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 424 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 425 | .procname = "igmp_max_msf", |
| 426 | .data = &sysctl_igmp_max_msf, |
| 427 | .maxlen = sizeof(int), |
| 428 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 429 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 430 | }, |
Hannes Frederic Sowa | a9fe8e2 | 2014-09-02 15:49:26 +0200 | [diff] [blame] | 431 | #ifdef CONFIG_IP_MULTICAST |
| 432 | { |
| 433 | .procname = "igmp_qrv", |
| 434 | .data = &sysctl_igmp_qrv, |
| 435 | .maxlen = sizeof(int), |
| 436 | .mode = 0644, |
| 437 | .proc_handler = proc_dointvec_minmax, |
| 438 | .extra1 = &one |
| 439 | }, |
| 440 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 441 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 442 | .procname = "inet_peer_threshold", |
| 443 | .data = &inet_peer_threshold, |
| 444 | .maxlen = sizeof(int), |
| 445 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 446 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 447 | }, |
| 448 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 449 | .procname = "inet_peer_minttl", |
| 450 | .data = &inet_peer_minttl, |
| 451 | .maxlen = sizeof(int), |
| 452 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 453 | .proc_handler = proc_dointvec_jiffies, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 454 | }, |
| 455 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 456 | .procname = "inet_peer_maxttl", |
| 457 | .data = &inet_peer_maxttl, |
| 458 | .maxlen = sizeof(int), |
| 459 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 460 | .proc_handler = proc_dointvec_jiffies, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 461 | }, |
| 462 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 463 | .procname = "tcp_orphan_retries", |
| 464 | .data = &sysctl_tcp_orphan_retries, |
| 465 | .maxlen = sizeof(int), |
| 466 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 467 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 468 | }, |
| 469 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 470 | .procname = "tcp_fack", |
| 471 | .data = &sysctl_tcp_fack, |
| 472 | .maxlen = sizeof(int), |
| 473 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 474 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 475 | }, |
| 476 | { |
Yuchung Cheng | 4f41b1c | 2015-10-16 21:57:47 -0700 | [diff] [blame] | 477 | .procname = "tcp_recovery", |
| 478 | .data = &sysctl_tcp_recovery, |
| 479 | .maxlen = sizeof(int), |
| 480 | .mode = 0644, |
| 481 | .proc_handler = proc_dointvec, |
| 482 | }, |
| 483 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 484 | .procname = "tcp_reordering", |
| 485 | .data = &sysctl_tcp_reordering, |
| 486 | .maxlen = sizeof(int), |
| 487 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 488 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 489 | }, |
| 490 | { |
Eric Dumazet | dca145f | 2014-10-27 21:45:24 -0700 | [diff] [blame] | 491 | .procname = "tcp_max_reordering", |
| 492 | .data = &sysctl_tcp_max_reordering, |
| 493 | .maxlen = sizeof(int), |
| 494 | .mode = 0644, |
| 495 | .proc_handler = proc_dointvec |
| 496 | }, |
| 497 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 498 | .procname = "tcp_dsack", |
| 499 | .data = &sysctl_tcp_dsack, |
| 500 | .maxlen = sizeof(int), |
| 501 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 502 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 503 | }, |
| 504 | { |
Eric W. Biederman | a4fe34b | 2013-10-19 16:25:36 -0700 | [diff] [blame] | 505 | .procname = "tcp_mem", |
| 506 | .maxlen = sizeof(sysctl_tcp_mem), |
| 507 | .data = &sysctl_tcp_mem, |
| 508 | .mode = 0644, |
| 509 | .proc_handler = proc_doulongvec_minmax, |
| 510 | }, |
| 511 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 512 | .procname = "tcp_wmem", |
| 513 | .data = &sysctl_tcp_wmem, |
| 514 | .maxlen = sizeof(sysctl_tcp_wmem), |
| 515 | .mode = 0644, |
bingtian.ly@taobao.com | cdda889 | 2013-01-23 20:35:28 +0000 | [diff] [blame] | 516 | .proc_handler = proc_dointvec_minmax, |
Calvin Owens | 5d37852 | 2015-08-13 14:21:34 -0700 | [diff] [blame] | 517 | .extra1 = &one, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 518 | }, |
| 519 | { |
Eric Dumazet | c9bee3b7 | 2013-07-22 20:27:07 -0700 | [diff] [blame] | 520 | .procname = "tcp_notsent_lowat", |
| 521 | .data = &sysctl_tcp_notsent_lowat, |
| 522 | .maxlen = sizeof(sysctl_tcp_notsent_lowat), |
| 523 | .mode = 0644, |
| 524 | .proc_handler = proc_dointvec, |
| 525 | }, |
| 526 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 527 | .procname = "tcp_rmem", |
| 528 | .data = &sysctl_tcp_rmem, |
| 529 | .maxlen = sizeof(sysctl_tcp_rmem), |
| 530 | .mode = 0644, |
bingtian.ly@taobao.com | cdda889 | 2013-01-23 20:35:28 +0000 | [diff] [blame] | 531 | .proc_handler = proc_dointvec_minmax, |
Calvin Owens | 5d37852 | 2015-08-13 14:21:34 -0700 | [diff] [blame] | 532 | .extra1 = &one, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 533 | }, |
| 534 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 535 | .procname = "tcp_app_win", |
| 536 | .data = &sysctl_tcp_app_win, |
| 537 | .maxlen = sizeof(int), |
| 538 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 539 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 540 | }, |
| 541 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 542 | .procname = "tcp_adv_win_scale", |
| 543 | .data = &sysctl_tcp_adv_win_scale, |
| 544 | .maxlen = sizeof(int), |
| 545 | .mode = 0644, |
Alexey Dobriyan | 0147fc0 | 2010-11-22 12:54:21 +0000 | [diff] [blame] | 546 | .proc_handler = proc_dointvec_minmax, |
| 547 | .extra1 = &tcp_adv_win_scale_min, |
| 548 | .extra2 = &tcp_adv_win_scale_max, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 549 | }, |
| 550 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 551 | .procname = "tcp_tw_reuse", |
| 552 | .data = &sysctl_tcp_tw_reuse, |
| 553 | .maxlen = sizeof(int), |
| 554 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 555 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 556 | }, |
| 557 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 558 | .procname = "tcp_frto", |
| 559 | .data = &sysctl_tcp_frto, |
| 560 | .maxlen = sizeof(int), |
| 561 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 562 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 563 | }, |
| 564 | { |
Yuchung Cheng | f672258 | 2015-10-16 21:57:42 -0700 | [diff] [blame] | 565 | .procname = "tcp_min_rtt_wlen", |
| 566 | .data = &sysctl_tcp_min_rtt_wlen, |
| 567 | .maxlen = sizeof(int), |
| 568 | .mode = 0644, |
| 569 | .proc_handler = proc_dointvec |
| 570 | }, |
| 571 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 572 | .procname = "tcp_low_latency", |
| 573 | .data = &sysctl_tcp_low_latency, |
| 574 | .maxlen = sizeof(int), |
| 575 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 576 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 577 | }, |
| 578 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 579 | .procname = "tcp_no_metrics_save", |
| 580 | .data = &sysctl_tcp_nometrics_save, |
| 581 | .maxlen = sizeof(int), |
| 582 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 583 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 584 | }, |
| 585 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 586 | .procname = "tcp_moderate_rcvbuf", |
| 587 | .data = &sysctl_tcp_moderate_rcvbuf, |
| 588 | .maxlen = sizeof(int), |
| 589 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 590 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 591 | }, |
| 592 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 593 | .procname = "tcp_tso_win_divisor", |
| 594 | .data = &sysctl_tcp_tso_win_divisor, |
| 595 | .maxlen = sizeof(int), |
| 596 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 597 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 598 | }, |
| 599 | { |
Stephen Hemminger | 317a76f | 2005-06-23 12:19:55 -0700 | [diff] [blame] | 600 | .procname = "tcp_congestion_control", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 601 | .mode = 0644, |
Stephen Hemminger | 317a76f | 2005-06-23 12:19:55 -0700 | [diff] [blame] | 602 | .maxlen = TCP_CA_NAME_MAX, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 603 | .proc_handler = proc_tcp_congestion_control, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 604 | }, |
Stephen Hemminger | 9772efb | 2005-11-10 17:09:53 -0800 | [diff] [blame] | 605 | { |
Rick Jones | 15d99e0 | 2006-03-20 22:40:29 -0800 | [diff] [blame] | 606 | .procname = "tcp_workaround_signed_windows", |
| 607 | .data = &sysctl_tcp_workaround_signed_windows, |
| 608 | .maxlen = sizeof(int), |
| 609 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 610 | .proc_handler = proc_dointvec |
Rick Jones | 15d99e0 | 2006-03-20 22:40:29 -0800 | [diff] [blame] | 611 | }, |
Eric Dumazet | 46d3cea | 2012-07-11 05:50:31 +0000 | [diff] [blame] | 612 | { |
| 613 | .procname = "tcp_limit_output_bytes", |
| 614 | .data = &sysctl_tcp_limit_output_bytes, |
| 615 | .maxlen = sizeof(int), |
| 616 | .mode = 0644, |
| 617 | .proc_handler = proc_dointvec |
| 618 | }, |
Eric Dumazet | 282f23c | 2012-07-17 10:13:05 +0200 | [diff] [blame] | 619 | { |
| 620 | .procname = "tcp_challenge_ack_limit", |
| 621 | .data = &sysctl_tcp_challenge_ack_limit, |
| 622 | .maxlen = sizeof(int), |
| 623 | .mode = 0644, |
| 624 | .proc_handler = proc_dointvec |
| 625 | }, |
David S. Miller | 35089bb | 2006-06-13 22:33:04 -0700 | [diff] [blame] | 626 | { |
David S. Miller | 35089bb | 2006-06-13 22:33:04 -0700 | [diff] [blame] | 627 | .procname = "tcp_slow_start_after_idle", |
| 628 | .data = &sysctl_tcp_slow_start_after_idle, |
| 629 | .maxlen = sizeof(int), |
| 630 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 631 | .proc_handler = proc_dointvec |
David S. Miller | 35089bb | 2006-06-13 22:33:04 -0700 | [diff] [blame] | 632 | }, |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 633 | #ifdef CONFIG_NETLABEL |
| 634 | { |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 635 | .procname = "cipso_cache_enable", |
| 636 | .data = &cipso_v4_cache_enabled, |
| 637 | .maxlen = sizeof(int), |
| 638 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 639 | .proc_handler = proc_dointvec, |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 640 | }, |
| 641 | { |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 642 | .procname = "cipso_cache_bucket_size", |
| 643 | .data = &cipso_v4_cache_bucketsize, |
| 644 | .maxlen = sizeof(int), |
| 645 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 646 | .proc_handler = proc_dointvec, |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 647 | }, |
| 648 | { |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 649 | .procname = "cipso_rbm_optfmt", |
| 650 | .data = &cipso_v4_rbm_optfmt, |
| 651 | .maxlen = sizeof(int), |
| 652 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 653 | .proc_handler = proc_dointvec, |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 654 | }, |
| 655 | { |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 656 | .procname = "cipso_rbm_strictvalid", |
| 657 | .data = &cipso_v4_rbm_strictvalid, |
| 658 | .maxlen = sizeof(int), |
| 659 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 660 | .proc_handler = proc_dointvec, |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 661 | }, |
| 662 | #endif /* CONFIG_NETLABEL */ |
Stephen Hemminger | 3ff825b | 2006-11-09 16:32:06 -0800 | [diff] [blame] | 663 | { |
Stephen Hemminger | 3ff825b | 2006-11-09 16:32:06 -0800 | [diff] [blame] | 664 | .procname = "tcp_available_congestion_control", |
| 665 | .maxlen = TCP_CA_BUF_MAX, |
| 666 | .mode = 0444, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 667 | .proc_handler = proc_tcp_available_congestion_control, |
Stephen Hemminger | 3ff825b | 2006-11-09 16:32:06 -0800 | [diff] [blame] | 668 | }, |
Stephen Hemminger | ce7bc3b | 2006-11-09 16:35:15 -0800 | [diff] [blame] | 669 | { |
Stephen Hemminger | ce7bc3b | 2006-11-09 16:35:15 -0800 | [diff] [blame] | 670 | .procname = "tcp_allowed_congestion_control", |
| 671 | .maxlen = TCP_CA_BUF_MAX, |
| 672 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 673 | .proc_handler = proc_allowed_congestion_control, |
Stephen Hemminger | ce7bc3b | 2006-11-09 16:35:15 -0800 | [diff] [blame] | 674 | }, |
John Heffner | 886236c | 2007-03-25 19:21:45 -0700 | [diff] [blame] | 675 | { |
Andreas Petlund | 36e31b0a | 2010-02-18 02:47:01 +0000 | [diff] [blame] | 676 | .procname = "tcp_thin_linear_timeouts", |
| 677 | .data = &sysctl_tcp_thin_linear_timeouts, |
| 678 | .maxlen = sizeof(int), |
| 679 | .mode = 0644, |
| 680 | .proc_handler = proc_dointvec |
| 681 | }, |
Weilong Chen | 5797deb | 2013-12-23 14:37:31 +0800 | [diff] [blame] | 682 | { |
Andreas Petlund | 7e38017 | 2010-02-18 04:48:19 +0000 | [diff] [blame] | 683 | .procname = "tcp_thin_dupack", |
| 684 | .data = &sysctl_tcp_thin_dupack, |
| 685 | .maxlen = sizeof(int), |
| 686 | .mode = 0644, |
| 687 | .proc_handler = proc_dointvec |
| 688 | }, |
Andreas Petlund | 36e31b0a | 2010-02-18 02:47:01 +0000 | [diff] [blame] | 689 | { |
Yuchung Cheng | eed530b | 2012-05-02 13:30:03 +0000 | [diff] [blame] | 690 | .procname = "tcp_early_retrans", |
| 691 | .data = &sysctl_tcp_early_retrans, |
| 692 | .maxlen = sizeof(int), |
| 693 | .mode = 0644, |
| 694 | .proc_handler = proc_dointvec_minmax, |
| 695 | .extra1 = &zero, |
Nandita Dukkipati | 6ba8a3b | 2013-03-11 10:00:43 +0000 | [diff] [blame] | 696 | .extra2 = &four, |
Yuchung Cheng | eed530b | 2012-05-02 13:30:03 +0000 | [diff] [blame] | 697 | }, |
| 698 | { |
Eric Dumazet | 95bd09e | 2013-08-27 05:46:32 -0700 | [diff] [blame] | 699 | .procname = "tcp_min_tso_segs", |
| 700 | .data = &sysctl_tcp_min_tso_segs, |
| 701 | .maxlen = sizeof(int), |
| 702 | .mode = 0644, |
| 703 | .proc_handler = proc_dointvec_minmax, |
Eric Dumazet | d6a4e26 | 2015-05-26 08:55:28 -0700 | [diff] [blame] | 704 | .extra1 = &one, |
Eric Dumazet | 95bd09e | 2013-08-27 05:46:32 -0700 | [diff] [blame] | 705 | .extra2 = &gso_max_segs, |
| 706 | }, |
| 707 | { |
Eric Dumazet | 43e122b | 2015-08-21 17:38:02 -0700 | [diff] [blame] | 708 | .procname = "tcp_pacing_ss_ratio", |
| 709 | .data = &sysctl_tcp_pacing_ss_ratio, |
| 710 | .maxlen = sizeof(int), |
| 711 | .mode = 0644, |
| 712 | .proc_handler = proc_dointvec_minmax, |
| 713 | .extra1 = &zero, |
| 714 | .extra2 = &thousand, |
| 715 | }, |
| 716 | { |
| 717 | .procname = "tcp_pacing_ca_ratio", |
| 718 | .data = &sysctl_tcp_pacing_ca_ratio, |
| 719 | .maxlen = sizeof(int), |
| 720 | .mode = 0644, |
| 721 | .proc_handler = proc_dointvec_minmax, |
| 722 | .extra1 = &zero, |
| 723 | .extra2 = &thousand, |
| 724 | }, |
| 725 | { |
Eric Dumazet | f54b311 | 2013-12-05 22:36:05 -0800 | [diff] [blame] | 726 | .procname = "tcp_autocorking", |
| 727 | .data = &sysctl_tcp_autocorking, |
| 728 | .maxlen = sizeof(int), |
| 729 | .mode = 0644, |
| 730 | .proc_handler = proc_dointvec_minmax, |
| 731 | .extra1 = &zero, |
| 732 | .extra2 = &one, |
| 733 | }, |
| 734 | { |
Neal Cardwell | 032ee42 | 2015-02-06 16:04:38 -0500 | [diff] [blame] | 735 | .procname = "tcp_invalid_ratelimit", |
| 736 | .data = &sysctl_tcp_invalid_ratelimit, |
| 737 | .maxlen = sizeof(int), |
| 738 | .mode = 0644, |
| 739 | .proc_handler = proc_dointvec_ms_jiffies, |
| 740 | }, |
| 741 | { |
Eric Dumazet | 4cdf507 | 2014-09-19 07:38:40 -0700 | [diff] [blame] | 742 | .procname = "icmp_msgs_per_sec", |
| 743 | .data = &sysctl_icmp_msgs_per_sec, |
| 744 | .maxlen = sizeof(int), |
| 745 | .mode = 0644, |
| 746 | .proc_handler = proc_dointvec_minmax, |
| 747 | .extra1 = &zero, |
| 748 | }, |
| 749 | { |
| 750 | .procname = "icmp_msgs_burst", |
| 751 | .data = &sysctl_icmp_msgs_burst, |
| 752 | .maxlen = sizeof(int), |
| 753 | .mode = 0644, |
| 754 | .proc_handler = proc_dointvec_minmax, |
| 755 | .extra1 = &zero, |
| 756 | }, |
| 757 | { |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 758 | .procname = "udp_mem", |
| 759 | .data = &sysctl_udp_mem, |
| 760 | .maxlen = sizeof(sysctl_udp_mem), |
| 761 | .mode = 0644, |
Eric Dumazet | 8d987e5 | 2010-11-09 23:24:26 +0000 | [diff] [blame] | 762 | .proc_handler = proc_doulongvec_minmax, |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 763 | }, |
| 764 | { |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 765 | .procname = "udp_rmem_min", |
| 766 | .data = &sysctl_udp_rmem_min, |
| 767 | .maxlen = sizeof(sysctl_udp_rmem_min), |
| 768 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 769 | .proc_handler = proc_dointvec_minmax, |
Calvin Owens | 5d37852 | 2015-08-13 14:21:34 -0700 | [diff] [blame] | 770 | .extra1 = &one |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 771 | }, |
| 772 | { |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 773 | .procname = "udp_wmem_min", |
| 774 | .data = &sysctl_udp_wmem_min, |
| 775 | .maxlen = sizeof(sysctl_udp_wmem_min), |
| 776 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 777 | .proc_handler = proc_dointvec_minmax, |
Calvin Owens | 5d37852 | 2015-08-13 14:21:34 -0700 | [diff] [blame] | 778 | .extra1 = &one |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 779 | }, |
Eric W. Biederman | f8572d8 | 2009-11-05 13:32:03 -0800 | [diff] [blame] | 780 | { } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 781 | }; |
Pavel Emelyanov | 3e37c3f | 2007-12-05 01:41:26 -0800 | [diff] [blame] | 782 | |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 783 | static struct ctl_table ipv4_net_table[] = { |
| 784 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 785 | .procname = "icmp_echo_ignore_all", |
| 786 | .data = &init_net.ipv4.sysctl_icmp_echo_ignore_all, |
| 787 | .maxlen = sizeof(int), |
| 788 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 789 | .proc_handler = proc_dointvec |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 790 | }, |
| 791 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 792 | .procname = "icmp_echo_ignore_broadcasts", |
| 793 | .data = &init_net.ipv4.sysctl_icmp_echo_ignore_broadcasts, |
| 794 | .maxlen = sizeof(int), |
| 795 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 796 | .proc_handler = proc_dointvec |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 797 | }, |
| 798 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 799 | .procname = "icmp_ignore_bogus_error_responses", |
| 800 | .data = &init_net.ipv4.sysctl_icmp_ignore_bogus_error_responses, |
| 801 | .maxlen = sizeof(int), |
| 802 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 803 | .proc_handler = proc_dointvec |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 804 | }, |
| 805 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 806 | .procname = "icmp_errors_use_inbound_ifaddr", |
| 807 | .data = &init_net.ipv4.sysctl_icmp_errors_use_inbound_ifaddr, |
| 808 | .maxlen = sizeof(int), |
| 809 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 810 | .proc_handler = proc_dointvec |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 811 | }, |
| 812 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 813 | .procname = "icmp_ratelimit", |
| 814 | .data = &init_net.ipv4.sysctl_icmp_ratelimit, |
| 815 | .maxlen = sizeof(int), |
| 816 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 817 | .proc_handler = proc_dointvec_ms_jiffies, |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 818 | }, |
| 819 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 820 | .procname = "icmp_ratemask", |
| 821 | .data = &init_net.ipv4.sysctl_icmp_ratemask, |
| 822 | .maxlen = sizeof(int), |
| 823 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 824 | .proc_handler = proc_dointvec |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 825 | }, |
Neil Horman | 1080d70 | 2008-10-27 12:28:25 -0700 | [diff] [blame] | 826 | { |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 827 | .procname = "ping_group_range", |
Cong Wang | ba6b918 | 2014-05-06 11:02:50 -0700 | [diff] [blame] | 828 | .data = &init_net.ipv4.ping_group_range.range, |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 829 | .maxlen = sizeof(gid_t)*2, |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 830 | .mode = 0644, |
| 831 | .proc_handler = ipv4_ping_group_range, |
| 832 | }, |
Glauber Costa | 3dc43e3 | 2011-12-11 21:47:05 +0000 | [diff] [blame] | 833 | { |
Hannes Frederic Sowa | 5d134f1 | 2013-01-05 16:10:48 +0000 | [diff] [blame] | 834 | .procname = "tcp_ecn", |
| 835 | .data = &init_net.ipv4.sysctl_tcp_ecn, |
| 836 | .maxlen = sizeof(int), |
| 837 | .mode = 0644, |
| 838 | .proc_handler = proc_dointvec |
| 839 | }, |
| 840 | { |
Daniel Borkmann | 4921355 | 2015-05-19 21:04:22 +0200 | [diff] [blame] | 841 | .procname = "tcp_ecn_fallback", |
| 842 | .data = &init_net.ipv4.sysctl_tcp_ecn_fallback, |
| 843 | .maxlen = sizeof(int), |
| 844 | .mode = 0644, |
| 845 | .proc_handler = proc_dointvec |
| 846 | }, |
| 847 | { |
Eric W. Biederman | 0bbf87d | 2013-09-28 14:10:59 -0700 | [diff] [blame] | 848 | .procname = "ip_local_port_range", |
Cong Wang | c9d8f1a | 2014-05-06 11:02:49 -0700 | [diff] [blame] | 849 | .maxlen = sizeof(init_net.ipv4.ip_local_ports.range), |
| 850 | .data = &init_net.ipv4.ip_local_ports.range, |
Eric W. Biederman | 0bbf87d | 2013-09-28 14:10:59 -0700 | [diff] [blame] | 851 | .mode = 0644, |
| 852 | .proc_handler = ipv4_local_port_range, |
| 853 | }, |
Hannes Frederic Sowa | 974eda1 | 2013-12-14 05:13:38 +0100 | [diff] [blame] | 854 | { |
WANG Cong | 122ff24 | 2014-05-12 16:04:53 -0700 | [diff] [blame] | 855 | .procname = "ip_local_reserved_ports", |
| 856 | .data = &init_net.ipv4.sysctl_local_reserved_ports, |
| 857 | .maxlen = 65536, |
| 858 | .mode = 0644, |
| 859 | .proc_handler = proc_do_large_bitmap, |
| 860 | }, |
| 861 | { |
Hannes Frederic Sowa | 974eda1 | 2013-12-14 05:13:38 +0100 | [diff] [blame] | 862 | .procname = "ip_no_pmtu_disc", |
| 863 | .data = &init_net.ipv4.sysctl_ip_no_pmtu_disc, |
| 864 | .maxlen = sizeof(int), |
| 865 | .mode = 0644, |
| 866 | .proc_handler = proc_dointvec |
| 867 | }, |
Hannes Frederic Sowa | f87c10a | 2014-01-09 10:01:15 +0100 | [diff] [blame] | 868 | { |
| 869 | .procname = "ip_forward_use_pmtu", |
| 870 | .data = &init_net.ipv4.sysctl_ip_fwd_use_pmtu, |
| 871 | .maxlen = sizeof(int), |
| 872 | .mode = 0644, |
| 873 | .proc_handler = proc_dointvec, |
| 874 | }, |
Lorenzo Colitti | e110861 | 2014-05-13 10:17:33 -0700 | [diff] [blame] | 875 | { |
Vincent Bernat | 49a6015 | 2014-09-05 15:09:03 +0200 | [diff] [blame] | 876 | .procname = "ip_nonlocal_bind", |
| 877 | .data = &init_net.ipv4.sysctl_ip_nonlocal_bind, |
| 878 | .maxlen = sizeof(int), |
| 879 | .mode = 0644, |
| 880 | .proc_handler = proc_dointvec |
| 881 | }, |
| 882 | { |
Lorenzo Colitti | e110861 | 2014-05-13 10:17:33 -0700 | [diff] [blame] | 883 | .procname = "fwmark_reflect", |
| 884 | .data = &init_net.ipv4.sysctl_fwmark_reflect, |
| 885 | .maxlen = sizeof(int), |
| 886 | .mode = 0644, |
| 887 | .proc_handler = proc_dointvec, |
| 888 | }, |
Lorenzo Colitti | 84f39b0 | 2014-05-13 10:17:35 -0700 | [diff] [blame] | 889 | { |
| 890 | .procname = "tcp_fwmark_accept", |
| 891 | .data = &init_net.ipv4.sysctl_tcp_fwmark_accept, |
| 892 | .maxlen = sizeof(int), |
| 893 | .mode = 0644, |
| 894 | .proc_handler = proc_dointvec, |
| 895 | }, |
David Ahern | 6dd9a14 | 2015-12-16 13:20:44 -0800 | [diff] [blame] | 896 | #ifdef CONFIG_NET_L3_MASTER_DEV |
| 897 | { |
| 898 | .procname = "tcp_l3mdev_accept", |
| 899 | .data = &init_net.ipv4.sysctl_tcp_l3mdev_accept, |
| 900 | .maxlen = sizeof(int), |
| 901 | .mode = 0644, |
| 902 | .proc_handler = proc_dointvec_minmax, |
| 903 | .extra1 = &zero, |
| 904 | .extra2 = &one, |
| 905 | }, |
| 906 | #endif |
Fan Du | b0f9ca5 | 2015-02-10 09:53:16 +0800 | [diff] [blame] | 907 | { |
| 908 | .procname = "tcp_mtu_probing", |
| 909 | .data = &init_net.ipv4.sysctl_tcp_mtu_probing, |
| 910 | .maxlen = sizeof(int), |
| 911 | .mode = 0644, |
| 912 | .proc_handler = proc_dointvec, |
| 913 | }, |
| 914 | { |
| 915 | .procname = "tcp_base_mss", |
| 916 | .data = &init_net.ipv4.sysctl_tcp_base_mss, |
| 917 | .maxlen = sizeof(int), |
| 918 | .mode = 0644, |
| 919 | .proc_handler = proc_dointvec, |
| 920 | }, |
Fan Du | 6b58e0a | 2015-03-06 11:18:23 +0800 | [diff] [blame] | 921 | { |
| 922 | .procname = "tcp_probe_threshold", |
| 923 | .data = &init_net.ipv4.sysctl_tcp_probe_threshold, |
| 924 | .maxlen = sizeof(int), |
| 925 | .mode = 0644, |
| 926 | .proc_handler = proc_dointvec, |
| 927 | }, |
Fan Du | 05cbc0d | 2015-03-06 11:18:24 +0800 | [diff] [blame] | 928 | { |
| 929 | .procname = "tcp_probe_interval", |
| 930 | .data = &init_net.ipv4.sysctl_tcp_probe_interval, |
| 931 | .maxlen = sizeof(int), |
| 932 | .mode = 0644, |
| 933 | .proc_handler = proc_dointvec, |
| 934 | }, |
Philip Downey | df2cf4a | 2015-08-27 16:46:26 +0100 | [diff] [blame] | 935 | { |
| 936 | .procname = "igmp_link_local_mcast_reports", |
| 937 | .data = &sysctl_igmp_llm_reports, |
| 938 | .maxlen = sizeof(int), |
| 939 | .mode = 0644, |
| 940 | .proc_handler = proc_dointvec |
| 941 | }, |
Nikolay Borisov | 13b287e | 2016-01-07 16:38:43 +0200 | [diff] [blame] | 942 | { |
| 943 | .procname = "tcp_keepalive_time", |
| 944 | .data = &init_net.ipv4.sysctl_tcp_keepalive_time, |
| 945 | .maxlen = sizeof(int), |
| 946 | .mode = 0644, |
| 947 | .proc_handler = proc_dointvec_jiffies, |
| 948 | }, |
Nikolay Borisov | 9bd6861 | 2016-01-07 16:38:44 +0200 | [diff] [blame] | 949 | { |
| 950 | .procname = "tcp_keepalive_probes", |
| 951 | .data = &init_net.ipv4.sysctl_tcp_keepalive_probes, |
| 952 | .maxlen = sizeof(int), |
| 953 | .mode = 0644, |
| 954 | .proc_handler = proc_dointvec |
| 955 | }, |
Nikolay Borisov | b840d15 | 2016-01-07 16:38:45 +0200 | [diff] [blame] | 956 | { |
| 957 | .procname = "tcp_keepalive_intvl", |
| 958 | .data = &init_net.ipv4.sysctl_tcp_keepalive_intvl, |
| 959 | .maxlen = sizeof(int), |
| 960 | .mode = 0644, |
| 961 | .proc_handler = proc_dointvec_jiffies, |
| 962 | }, |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 963 | { } |
| 964 | }; |
| 965 | |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 966 | static __net_init int ipv4_sysctl_init_net(struct net *net) |
| 967 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 968 | struct ctl_table *table; |
| 969 | |
| 970 | table = ipv4_net_table; |
Octavian Purdila | 09ad9bc | 2009-11-25 15:14:13 -0800 | [diff] [blame] | 971 | if (!net_eq(net, &init_net)) { |
Eric W. Biederman | 0a6fa23 | 2013-10-19 16:27:03 -0700 | [diff] [blame] | 972 | int i; |
| 973 | |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 974 | table = kmemdup(table, sizeof(ipv4_net_table), GFP_KERNEL); |
Ian Morris | 51456b2 | 2015-04-03 09:17:26 +0100 | [diff] [blame] | 975 | if (!table) |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 976 | goto err_alloc; |
| 977 | |
Eric W. Biederman | 0a6fa23 | 2013-10-19 16:27:03 -0700 | [diff] [blame] | 978 | /* Update the variables to point into the current struct net */ |
| 979 | for (i = 0; i < ARRAY_SIZE(ipv4_net_table) - 1; i++) |
| 980 | table[i].data += (void *)net - (void *)&init_net; |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 981 | } |
| 982 | |
Eric W. Biederman | ec8f23c | 2012-04-19 13:44:49 +0000 | [diff] [blame] | 983 | net->ipv4.ipv4_hdr = register_net_sysctl(net, "net/ipv4", table); |
Ian Morris | 51456b2 | 2015-04-03 09:17:26 +0100 | [diff] [blame] | 984 | if (!net->ipv4.ipv4_hdr) |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 985 | goto err_reg; |
| 986 | |
WANG Cong | 122ff24 | 2014-05-12 16:04:53 -0700 | [diff] [blame] | 987 | net->ipv4.sysctl_local_reserved_ports = kzalloc(65536 / 8, GFP_KERNEL); |
| 988 | if (!net->ipv4.sysctl_local_reserved_ports) |
| 989 | goto err_ports; |
| 990 | |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 991 | return 0; |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 992 | |
WANG Cong | 122ff24 | 2014-05-12 16:04:53 -0700 | [diff] [blame] | 993 | err_ports: |
| 994 | unregister_net_sysctl_table(net->ipv4.ipv4_hdr); |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 995 | err_reg: |
Octavian Purdila | 09ad9bc | 2009-11-25 15:14:13 -0800 | [diff] [blame] | 996 | if (!net_eq(net, &init_net)) |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 997 | kfree(table); |
| 998 | err_alloc: |
| 999 | return -ENOMEM; |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 1000 | } |
| 1001 | |
| 1002 | static __net_exit void ipv4_sysctl_exit_net(struct net *net) |
| 1003 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 1004 | struct ctl_table *table; |
| 1005 | |
WANG Cong | 122ff24 | 2014-05-12 16:04:53 -0700 | [diff] [blame] | 1006 | kfree(net->ipv4.sysctl_local_reserved_ports); |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 1007 | table = net->ipv4.ipv4_hdr->ctl_table_arg; |
| 1008 | unregister_net_sysctl_table(net->ipv4.ipv4_hdr); |
| 1009 | kfree(table); |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 1010 | } |
| 1011 | |
| 1012 | static __net_initdata struct pernet_operations ipv4_sysctl_ops = { |
| 1013 | .init = ipv4_sysctl_init_net, |
| 1014 | .exit = ipv4_sysctl_exit_net, |
| 1015 | }; |
| 1016 | |
Pavel Emelyanov | 3e37c3f | 2007-12-05 01:41:26 -0800 | [diff] [blame] | 1017 | static __init int sysctl_ipv4_init(void) |
| 1018 | { |
| 1019 | struct ctl_table_header *hdr; |
| 1020 | |
Eric W. Biederman | ec8f23c | 2012-04-19 13:44:49 +0000 | [diff] [blame] | 1021 | hdr = register_net_sysctl(&init_net, "net/ipv4", ipv4_table); |
Ian Morris | 51456b2 | 2015-04-03 09:17:26 +0100 | [diff] [blame] | 1022 | if (!hdr) |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 1023 | return -ENOMEM; |
| 1024 | |
| 1025 | if (register_pernet_subsys(&ipv4_sysctl_ops)) { |
Eric W. Biederman | 5dd3df1 | 2012-04-19 13:24:33 +0000 | [diff] [blame] | 1026 | unregister_net_sysctl_table(hdr); |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 1027 | return -ENOMEM; |
| 1028 | } |
| 1029 | |
| 1030 | return 0; |
Pavel Emelyanov | 3e37c3f | 2007-12-05 01:41:26 -0800 | [diff] [blame] | 1031 | } |
| 1032 | |
| 1033 | __initcall(sysctl_ipv4_init); |