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> |
Glauber Costa | 3aaabe2 | 2011-12-11 21:47:06 +0000 | [diff] [blame] | 27 | #include <net/tcp_memcontrol.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | |
Herbert Xu | 89cee8b | 2005-12-13 23:14:27 -0800 | [diff] [blame] | 29 | static int zero; |
bingtian.ly@taobao.com | cdda889 | 2013-01-23 20:35:28 +0000 | [diff] [blame] | 30 | static int one = 1; |
Nandita Dukkipati | 6ba8a3b | 2013-03-11 10:00:43 +0000 | [diff] [blame] | 31 | static int four = 4; |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 32 | static int tcp_retr1_max = 255; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | static int ip_local_port_range_min[] = { 1, 1 }; |
| 34 | static int ip_local_port_range_max[] = { 65535, 65535 }; |
Alexey Dobriyan | 0147fc0 | 2010-11-22 12:54:21 +0000 | [diff] [blame] | 35 | static int tcp_adv_win_scale_min = -31; |
| 36 | static int tcp_adv_win_scale_max = 31; |
Eric Dumazet | 249fab7 | 2010-12-13 12:16:14 -0800 | [diff] [blame] | 37 | static int ip_ttl_min = 1; |
| 38 | static int ip_ttl_max = 255; |
Michal Tesar | 651e927 | 2013-07-19 14:09:01 +0200 | [diff] [blame] | 39 | static int tcp_syn_retries_min = 1; |
| 40 | static int tcp_syn_retries_max = MAX_TCP_SYNCNT; |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 41 | static int ip_ping_group_range_min[] = { 0, 0 }; |
| 42 | 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] | 43 | |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 44 | /* Update system visible IP port range */ |
| 45 | static void set_local_port_range(int range[2]) |
| 46 | { |
Eric Dumazet | 3c689b7 | 2008-10-08 14:18:04 -0700 | [diff] [blame] | 47 | write_seqlock(&sysctl_local_ports.lock); |
| 48 | sysctl_local_ports.range[0] = range[0]; |
| 49 | sysctl_local_ports.range[1] = range[1]; |
| 50 | write_sequnlock(&sysctl_local_ports.lock); |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | /* Validate changes from /proc interface. */ |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 54 | static int ipv4_local_port_range(struct ctl_table *table, int write, |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 55 | void __user *buffer, |
| 56 | size_t *lenp, loff_t *ppos) |
| 57 | { |
| 58 | int ret; |
Eric Dumazet | 3c689b7 | 2008-10-08 14:18:04 -0700 | [diff] [blame] | 59 | int range[2]; |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 60 | struct ctl_table tmp = { |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 61 | .data = &range, |
| 62 | .maxlen = sizeof(range), |
| 63 | .mode = table->mode, |
| 64 | .extra1 = &ip_local_port_range_min, |
| 65 | .extra2 = &ip_local_port_range_max, |
| 66 | }; |
| 67 | |
Eric Dumazet | 3c689b7 | 2008-10-08 14:18:04 -0700 | [diff] [blame] | 68 | inet_get_local_port_range(range, range + 1); |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 69 | ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos); |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 70 | |
| 71 | if (write && ret == 0) { |
Anton Arapov | a25de53 | 2007-10-18 22:00:17 -0700 | [diff] [blame] | 72 | if (range[1] < range[0]) |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 73 | ret = -EINVAL; |
| 74 | else |
| 75 | set_local_port_range(range); |
| 76 | } |
| 77 | |
| 78 | return ret; |
| 79 | } |
| 80 | |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 81 | |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 82 | 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] | 83 | { |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 84 | kgid_t *data = table->data; |
Eric Dumazet | 95c9617 | 2012-04-15 05:58:06 +0000 | [diff] [blame] | 85 | unsigned int seq; |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 86 | do { |
| 87 | seq = read_seqbegin(&sysctl_local_ports.lock); |
| 88 | |
| 89 | *low = data[0]; |
| 90 | *high = data[1]; |
| 91 | } while (read_seqretry(&sysctl_local_ports.lock, seq)); |
| 92 | } |
| 93 | |
| 94 | /* Update system visible IP port range */ |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 95 | 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] | 96 | { |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 97 | kgid_t *data = table->data; |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 98 | write_seqlock(&sysctl_local_ports.lock); |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 99 | data[0] = low; |
| 100 | data[1] = high; |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 101 | write_sequnlock(&sysctl_local_ports.lock); |
| 102 | } |
| 103 | |
| 104 | /* Validate changes from /proc interface. */ |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 105 | static int ipv4_ping_group_range(struct ctl_table *table, int write, |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 106 | void __user *buffer, |
| 107 | size_t *lenp, loff_t *ppos) |
| 108 | { |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 109 | struct user_namespace *user_ns = current_user_ns(); |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 110 | int ret; |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 111 | gid_t urange[2]; |
| 112 | kgid_t low, high; |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 113 | struct ctl_table tmp = { |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 114 | .data = &urange, |
| 115 | .maxlen = sizeof(urange), |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 116 | .mode = table->mode, |
| 117 | .extra1 = &ip_ping_group_range_min, |
| 118 | .extra2 = &ip_ping_group_range_max, |
| 119 | }; |
| 120 | |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 121 | inet_get_ping_group_range_table(table, &low, &high); |
| 122 | urange[0] = from_kgid_munged(user_ns, low); |
| 123 | urange[1] = from_kgid_munged(user_ns, high); |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 124 | ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos); |
| 125 | |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 126 | if (write && ret == 0) { |
| 127 | low = make_kgid(user_ns, urange[0]); |
| 128 | high = make_kgid(user_ns, urange[1]); |
| 129 | if (!gid_valid(low) || !gid_valid(high) || |
| 130 | (urange[1] < urange[0]) || gid_lt(high, low)) { |
| 131 | low = make_kgid(&init_user_ns, 1); |
| 132 | high = make_kgid(&init_user_ns, 0); |
| 133 | } |
| 134 | set_ping_group_range(table, low, high); |
| 135 | } |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 136 | |
| 137 | return ret; |
| 138 | } |
| 139 | |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 140 | static int proc_tcp_congestion_control(struct ctl_table *ctl, int write, |
Stephen Hemminger | 317a76f | 2005-06-23 12:19:55 -0700 | [diff] [blame] | 141 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 142 | { |
| 143 | char val[TCP_CA_NAME_MAX]; |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 144 | struct ctl_table tbl = { |
Stephen Hemminger | 317a76f | 2005-06-23 12:19:55 -0700 | [diff] [blame] | 145 | .data = val, |
| 146 | .maxlen = TCP_CA_NAME_MAX, |
| 147 | }; |
| 148 | int ret; |
| 149 | |
| 150 | tcp_get_default_congestion_control(val); |
| 151 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 152 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
Stephen Hemminger | 317a76f | 2005-06-23 12:19:55 -0700 | [diff] [blame] | 153 | if (write && ret == 0) |
| 154 | ret = tcp_set_default_congestion_control(val); |
| 155 | return ret; |
| 156 | } |
| 157 | |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 158 | static int proc_tcp_available_congestion_control(struct ctl_table *ctl, |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 159 | int write, |
Stephen Hemminger | 3ff825b | 2006-11-09 16:32:06 -0800 | [diff] [blame] | 160 | void __user *buffer, size_t *lenp, |
| 161 | loff_t *ppos) |
| 162 | { |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 163 | struct ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX, }; |
Stephen Hemminger | 3ff825b | 2006-11-09 16:32:06 -0800 | [diff] [blame] | 164 | int ret; |
| 165 | |
| 166 | tbl.data = kmalloc(tbl.maxlen, GFP_USER); |
| 167 | if (!tbl.data) |
| 168 | return -ENOMEM; |
| 169 | tcp_get_available_congestion_control(tbl.data, TCP_CA_BUF_MAX); |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 170 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
Stephen Hemminger | 3ff825b | 2006-11-09 16:32:06 -0800 | [diff] [blame] | 171 | kfree(tbl.data); |
| 172 | return ret; |
| 173 | } |
| 174 | |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 175 | static int proc_allowed_congestion_control(struct ctl_table *ctl, |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 176 | int write, |
Stephen Hemminger | ce7bc3b | 2006-11-09 16:35:15 -0800 | [diff] [blame] | 177 | void __user *buffer, size_t *lenp, |
| 178 | loff_t *ppos) |
| 179 | { |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 180 | struct ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX }; |
Stephen Hemminger | ce7bc3b | 2006-11-09 16:35:15 -0800 | [diff] [blame] | 181 | int ret; |
| 182 | |
| 183 | tbl.data = kmalloc(tbl.maxlen, GFP_USER); |
| 184 | if (!tbl.data) |
| 185 | return -ENOMEM; |
| 186 | |
| 187 | tcp_get_allowed_congestion_control(tbl.data, tbl.maxlen); |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 188 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
Stephen Hemminger | ce7bc3b | 2006-11-09 16:35:15 -0800 | [diff] [blame] | 189 | if (write && ret == 0) |
| 190 | ret = tcp_set_allowed_congestion_control(tbl.data); |
| 191 | kfree(tbl.data); |
| 192 | return ret; |
| 193 | } |
| 194 | |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 195 | static int ipv4_tcp_mem(struct ctl_table *ctl, int write, |
Glauber Costa | 3dc43e3 | 2011-12-11 21:47:05 +0000 | [diff] [blame] | 196 | void __user *buffer, size_t *lenp, |
| 197 | loff_t *ppos) |
| 198 | { |
| 199 | int ret; |
| 200 | unsigned long vec[3]; |
| 201 | struct net *net = current->nsproxy->net_ns; |
Andrew Morton | c255a45 | 2012-07-31 16:43:02 -0700 | [diff] [blame] | 202 | #ifdef CONFIG_MEMCG_KMEM |
Glauber Costa | 3aaabe2 | 2011-12-11 21:47:06 +0000 | [diff] [blame] | 203 | struct mem_cgroup *memcg; |
| 204 | #endif |
Glauber Costa | 3dc43e3 | 2011-12-11 21:47:05 +0000 | [diff] [blame] | 205 | |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 206 | struct ctl_table tmp = { |
Glauber Costa | 3dc43e3 | 2011-12-11 21:47:05 +0000 | [diff] [blame] | 207 | .data = &vec, |
| 208 | .maxlen = sizeof(vec), |
| 209 | .mode = ctl->mode, |
| 210 | }; |
| 211 | |
| 212 | if (!write) { |
| 213 | ctl->data = &net->ipv4.sysctl_tcp_mem; |
| 214 | return proc_doulongvec_minmax(ctl, write, buffer, lenp, ppos); |
| 215 | } |
| 216 | |
| 217 | ret = proc_doulongvec_minmax(&tmp, write, buffer, lenp, ppos); |
| 218 | if (ret) |
| 219 | return ret; |
| 220 | |
Andrew Morton | c255a45 | 2012-07-31 16:43:02 -0700 | [diff] [blame] | 221 | #ifdef CONFIG_MEMCG_KMEM |
Glauber Costa | 3aaabe2 | 2011-12-11 21:47:06 +0000 | [diff] [blame] | 222 | rcu_read_lock(); |
| 223 | memcg = mem_cgroup_from_task(current); |
| 224 | |
| 225 | tcp_prot_mem(memcg, vec[0], 0); |
| 226 | tcp_prot_mem(memcg, vec[1], 1); |
| 227 | tcp_prot_mem(memcg, vec[2], 2); |
| 228 | rcu_read_unlock(); |
| 229 | #endif |
| 230 | |
Glauber Costa | 3dc43e3 | 2011-12-11 21:47:05 +0000 | [diff] [blame] | 231 | net->ipv4.sysctl_tcp_mem[0] = vec[0]; |
| 232 | net->ipv4.sysctl_tcp_mem[1] = vec[1]; |
| 233 | net->ipv4.sysctl_tcp_mem[2] = vec[2]; |
| 234 | |
| 235 | return 0; |
| 236 | } |
| 237 | |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 238 | static int proc_tcp_fastopen_key(struct ctl_table *ctl, int write, |
| 239 | void __user *buffer, size_t *lenp, |
| 240 | loff_t *ppos) |
Jerry Chu | 1046716 | 2012-08-31 12:29:11 +0000 | [diff] [blame] | 241 | { |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 242 | struct ctl_table tbl = { .maxlen = (TCP_FASTOPEN_KEY_LENGTH * 2 + 10) }; |
Jerry Chu | 1046716 | 2012-08-31 12:29:11 +0000 | [diff] [blame] | 243 | struct tcp_fastopen_context *ctxt; |
| 244 | int ret; |
| 245 | u32 user_key[4]; /* 16 bytes, matching TCP_FASTOPEN_KEY_LENGTH */ |
| 246 | |
| 247 | tbl.data = kmalloc(tbl.maxlen, GFP_KERNEL); |
| 248 | if (!tbl.data) |
| 249 | return -ENOMEM; |
| 250 | |
| 251 | rcu_read_lock(); |
| 252 | ctxt = rcu_dereference(tcp_fastopen_ctx); |
| 253 | if (ctxt) |
| 254 | memcpy(user_key, ctxt->key, TCP_FASTOPEN_KEY_LENGTH); |
Alan Cox | 0e24c4f | 2012-10-11 06:24:14 +0000 | [diff] [blame] | 255 | else |
| 256 | memset(user_key, 0, sizeof(user_key)); |
Jerry Chu | 1046716 | 2012-08-31 12:29:11 +0000 | [diff] [blame] | 257 | rcu_read_unlock(); |
| 258 | |
| 259 | snprintf(tbl.data, tbl.maxlen, "%08x-%08x-%08x-%08x", |
| 260 | user_key[0], user_key[1], user_key[2], user_key[3]); |
| 261 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
| 262 | |
| 263 | if (write && ret == 0) { |
| 264 | if (sscanf(tbl.data, "%x-%x-%x-%x", user_key, user_key + 1, |
| 265 | user_key + 2, user_key + 3) != 4) { |
| 266 | ret = -EINVAL; |
| 267 | goto bad_key; |
| 268 | } |
| 269 | tcp_fastopen_reset_cipher(user_key, TCP_FASTOPEN_KEY_LENGTH); |
| 270 | } |
| 271 | |
| 272 | bad_key: |
| 273 | pr_debug("proc FO key set 0x%x-%x-%x-%x <- 0x%s: %u\n", |
| 274 | user_key[0], user_key[1], user_key[2], user_key[3], |
| 275 | (char *)tbl.data, ret); |
| 276 | kfree(tbl.data); |
| 277 | return ret; |
| 278 | } |
| 279 | |
Pavel Emelyanov | 3e37c3f | 2007-12-05 01:41:26 -0800 | [diff] [blame] | 280 | static struct ctl_table ipv4_table[] = { |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 281 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 282 | .procname = "tcp_timestamps", |
| 283 | .data = &sysctl_tcp_timestamps, |
| 284 | .maxlen = sizeof(int), |
| 285 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 286 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 288 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 289 | .procname = "tcp_window_scaling", |
| 290 | .data = &sysctl_tcp_window_scaling, |
| 291 | .maxlen = sizeof(int), |
| 292 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 293 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 295 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | .procname = "tcp_sack", |
| 297 | .data = &sysctl_tcp_sack, |
| 298 | .maxlen = sizeof(int), |
| 299 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 300 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 301 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 302 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | .procname = "tcp_retrans_collapse", |
| 304 | .data = &sysctl_tcp_retrans_collapse, |
| 305 | .maxlen = sizeof(int), |
| 306 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 307 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 309 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | .procname = "ip_default_ttl", |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 311 | .data = &sysctl_ip_default_ttl, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 | .maxlen = sizeof(int), |
| 313 | .mode = 0644, |
Eric Dumazet | 249fab7 | 2010-12-13 12:16:14 -0800 | [diff] [blame] | 314 | .proc_handler = proc_dointvec_minmax, |
| 315 | .extra1 = &ip_ttl_min, |
| 316 | .extra2 = &ip_ttl_max, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 318 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 319 | .procname = "ip_no_pmtu_disc", |
| 320 | .data = &ipv4_config.no_pmtu_disc, |
| 321 | .maxlen = sizeof(int), |
| 322 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 323 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 324 | }, |
| 325 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | .procname = "ip_nonlocal_bind", |
| 327 | .data = &sysctl_ip_nonlocal_bind, |
| 328 | .maxlen = sizeof(int), |
| 329 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 330 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 331 | }, |
| 332 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 333 | .procname = "tcp_syn_retries", |
| 334 | .data = &sysctl_tcp_syn_retries, |
| 335 | .maxlen = sizeof(int), |
| 336 | .mode = 0644, |
Michal Tesar | 651e927 | 2013-07-19 14:09:01 +0200 | [diff] [blame] | 337 | .proc_handler = proc_dointvec_minmax, |
| 338 | .extra1 = &tcp_syn_retries_min, |
| 339 | .extra2 = &tcp_syn_retries_max |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 340 | }, |
| 341 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 342 | .procname = "tcp_synack_retries", |
| 343 | .data = &sysctl_tcp_synack_retries, |
| 344 | .maxlen = sizeof(int), |
| 345 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 346 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 347 | }, |
| 348 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 349 | .procname = "tcp_max_orphans", |
| 350 | .data = &sysctl_tcp_max_orphans, |
| 351 | .maxlen = sizeof(int), |
| 352 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 353 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 354 | }, |
| 355 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 356 | .procname = "tcp_max_tw_buckets", |
Arnaldo Carvalho de Melo | 295ff7e | 2005-08-09 20:44:40 -0700 | [diff] [blame] | 357 | .data = &tcp_death_row.sysctl_max_tw_buckets, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 358 | .maxlen = sizeof(int), |
| 359 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 360 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | }, |
| 362 | { |
Alexander Duyck | 6648bd7 | 2012-06-21 13:58:31 +0000 | [diff] [blame] | 363 | .procname = "ip_early_demux", |
| 364 | .data = &sysctl_ip_early_demux, |
| 365 | .maxlen = sizeof(int), |
| 366 | .mode = 0644, |
| 367 | .proc_handler = proc_dointvec |
| 368 | }, |
| 369 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 370 | .procname = "ip_dynaddr", |
| 371 | .data = &sysctl_ip_dynaddr, |
| 372 | .maxlen = sizeof(int), |
| 373 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 374 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 375 | }, |
| 376 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 | .procname = "tcp_keepalive_time", |
| 378 | .data = &sysctl_tcp_keepalive_time, |
| 379 | .maxlen = sizeof(int), |
| 380 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 381 | .proc_handler = proc_dointvec_jiffies, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 382 | }, |
| 383 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 384 | .procname = "tcp_keepalive_probes", |
| 385 | .data = &sysctl_tcp_keepalive_probes, |
| 386 | .maxlen = sizeof(int), |
| 387 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 388 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 389 | }, |
| 390 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 391 | .procname = "tcp_keepalive_intvl", |
| 392 | .data = &sysctl_tcp_keepalive_intvl, |
| 393 | .maxlen = sizeof(int), |
| 394 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 395 | .proc_handler = proc_dointvec_jiffies, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 396 | }, |
| 397 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 398 | .procname = "tcp_retries1", |
| 399 | .data = &sysctl_tcp_retries1, |
| 400 | .maxlen = sizeof(int), |
| 401 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 402 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 403 | .extra2 = &tcp_retr1_max |
| 404 | }, |
| 405 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 406 | .procname = "tcp_retries2", |
| 407 | .data = &sysctl_tcp_retries2, |
| 408 | .maxlen = sizeof(int), |
| 409 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 410 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 411 | }, |
| 412 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 413 | .procname = "tcp_fin_timeout", |
| 414 | .data = &sysctl_tcp_fin_timeout, |
| 415 | .maxlen = sizeof(int), |
| 416 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 417 | .proc_handler = proc_dointvec_jiffies, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 418 | }, |
| 419 | #ifdef CONFIG_SYN_COOKIES |
| 420 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 421 | .procname = "tcp_syncookies", |
| 422 | .data = &sysctl_tcp_syncookies, |
| 423 | .maxlen = sizeof(int), |
| 424 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 425 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 426 | }, |
| 427 | #endif |
| 428 | { |
Yuchung Cheng | 2100c8d | 2012-07-19 06:43:05 +0000 | [diff] [blame] | 429 | .procname = "tcp_fastopen", |
| 430 | .data = &sysctl_tcp_fastopen, |
| 431 | .maxlen = sizeof(int), |
| 432 | .mode = 0644, |
| 433 | .proc_handler = proc_dointvec, |
| 434 | }, |
| 435 | { |
Jerry Chu | 1046716 | 2012-08-31 12:29:11 +0000 | [diff] [blame] | 436 | .procname = "tcp_fastopen_key", |
| 437 | .mode = 0600, |
| 438 | .maxlen = ((TCP_FASTOPEN_KEY_LENGTH * 2) + 10), |
| 439 | .proc_handler = proc_tcp_fastopen_key, |
| 440 | }, |
| 441 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 442 | .procname = "tcp_tw_recycle", |
Arnaldo Carvalho de Melo | 295ff7e | 2005-08-09 20:44:40 -0700 | [diff] [blame] | 443 | .data = &tcp_death_row.sysctl_tw_recycle, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 = "tcp_abort_on_overflow", |
| 450 | .data = &sysctl_tcp_abort_on_overflow, |
| 451 | .maxlen = sizeof(int), |
| 452 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 453 | .proc_handler = proc_dointvec |
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 = "tcp_stdurg", |
| 457 | .data = &sysctl_tcp_stdurg, |
| 458 | .maxlen = sizeof(int), |
| 459 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 460 | .proc_handler = proc_dointvec |
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_rfc1337", |
| 464 | .data = &sysctl_tcp_rfc1337, |
| 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_max_syn_backlog", |
| 471 | .data = &sysctl_max_syn_backlog, |
| 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 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 477 | .procname = "ip_local_port_range", |
Eric Dumazet | 3c689b7 | 2008-10-08 14:18:04 -0700 | [diff] [blame] | 478 | .data = &sysctl_local_ports.range, |
| 479 | .maxlen = sizeof(sysctl_local_ports.range), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 480 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 481 | .proc_handler = ipv4_local_port_range, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | }, |
Amerigo Wang | e3826f1 | 2010-05-05 00:27:06 +0000 | [diff] [blame] | 483 | { |
| 484 | .procname = "ip_local_reserved_ports", |
| 485 | .data = NULL, /* initialized in sysctl_ipv4_init */ |
| 486 | .maxlen = 65536, |
| 487 | .mode = 0644, |
| 488 | .proc_handler = proc_do_large_bitmap, |
| 489 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 490 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 491 | .procname = "igmp_max_memberships", |
| 492 | .data = &sysctl_igmp_max_memberships, |
| 493 | .maxlen = sizeof(int), |
| 494 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 495 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 496 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 497 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 498 | .procname = "igmp_max_msf", |
| 499 | .data = &sysctl_igmp_max_msf, |
| 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 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 505 | .procname = "inet_peer_threshold", |
| 506 | .data = &inet_peer_threshold, |
| 507 | .maxlen = sizeof(int), |
| 508 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 509 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 510 | }, |
| 511 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 512 | .procname = "inet_peer_minttl", |
| 513 | .data = &inet_peer_minttl, |
| 514 | .maxlen = sizeof(int), |
| 515 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 516 | .proc_handler = proc_dointvec_jiffies, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 517 | }, |
| 518 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 519 | .procname = "inet_peer_maxttl", |
| 520 | .data = &inet_peer_maxttl, |
| 521 | .maxlen = sizeof(int), |
| 522 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 523 | .proc_handler = proc_dointvec_jiffies, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 524 | }, |
| 525 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 526 | .procname = "tcp_orphan_retries", |
| 527 | .data = &sysctl_tcp_orphan_retries, |
| 528 | .maxlen = sizeof(int), |
| 529 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 530 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 531 | }, |
| 532 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 533 | .procname = "tcp_fack", |
| 534 | .data = &sysctl_tcp_fack, |
| 535 | .maxlen = sizeof(int), |
| 536 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 537 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 538 | }, |
| 539 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 540 | .procname = "tcp_reordering", |
| 541 | .data = &sysctl_tcp_reordering, |
| 542 | .maxlen = sizeof(int), |
| 543 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 544 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 545 | }, |
| 546 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 547 | .procname = "tcp_dsack", |
| 548 | .data = &sysctl_tcp_dsack, |
| 549 | .maxlen = sizeof(int), |
| 550 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 551 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 552 | }, |
| 553 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 554 | .procname = "tcp_wmem", |
| 555 | .data = &sysctl_tcp_wmem, |
| 556 | .maxlen = sizeof(sysctl_tcp_wmem), |
| 557 | .mode = 0644, |
bingtian.ly@taobao.com | cdda889 | 2013-01-23 20:35:28 +0000 | [diff] [blame] | 558 | .proc_handler = proc_dointvec_minmax, |
| 559 | .extra1 = &one, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 560 | }, |
| 561 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 562 | .procname = "tcp_rmem", |
| 563 | .data = &sysctl_tcp_rmem, |
| 564 | .maxlen = sizeof(sysctl_tcp_rmem), |
| 565 | .mode = 0644, |
bingtian.ly@taobao.com | cdda889 | 2013-01-23 20:35:28 +0000 | [diff] [blame] | 566 | .proc_handler = proc_dointvec_minmax, |
| 567 | .extra1 = &one, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 568 | }, |
| 569 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 570 | .procname = "tcp_app_win", |
| 571 | .data = &sysctl_tcp_app_win, |
| 572 | .maxlen = sizeof(int), |
| 573 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 574 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 575 | }, |
| 576 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 577 | .procname = "tcp_adv_win_scale", |
| 578 | .data = &sysctl_tcp_adv_win_scale, |
| 579 | .maxlen = sizeof(int), |
| 580 | .mode = 0644, |
Alexey Dobriyan | 0147fc0 | 2010-11-22 12:54:21 +0000 | [diff] [blame] | 581 | .proc_handler = proc_dointvec_minmax, |
| 582 | .extra1 = &tcp_adv_win_scale_min, |
| 583 | .extra2 = &tcp_adv_win_scale_max, |
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_tw_reuse", |
| 587 | .data = &sysctl_tcp_tw_reuse, |
| 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_frto", |
| 594 | .data = &sysctl_tcp_frto, |
| 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 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 600 | .procname = "tcp_low_latency", |
| 601 | .data = &sysctl_tcp_low_latency, |
| 602 | .maxlen = sizeof(int), |
| 603 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 604 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 605 | }, |
| 606 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 607 | .procname = "tcp_no_metrics_save", |
| 608 | .data = &sysctl_tcp_nometrics_save, |
| 609 | .maxlen = sizeof(int), |
| 610 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 611 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 612 | }, |
| 613 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 614 | .procname = "tcp_moderate_rcvbuf", |
| 615 | .data = &sysctl_tcp_moderate_rcvbuf, |
| 616 | .maxlen = sizeof(int), |
| 617 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 618 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 619 | }, |
| 620 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 621 | .procname = "tcp_tso_win_divisor", |
| 622 | .data = &sysctl_tcp_tso_win_divisor, |
| 623 | .maxlen = sizeof(int), |
| 624 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 625 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 626 | }, |
| 627 | { |
Stephen Hemminger | 317a76f | 2005-06-23 12:19:55 -0700 | [diff] [blame] | 628 | .procname = "tcp_congestion_control", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 629 | .mode = 0644, |
Stephen Hemminger | 317a76f | 2005-06-23 12:19:55 -0700 | [diff] [blame] | 630 | .maxlen = TCP_CA_NAME_MAX, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 631 | .proc_handler = proc_tcp_congestion_control, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 632 | }, |
Stephen Hemminger | 9772efb | 2005-11-10 17:09:53 -0800 | [diff] [blame] | 633 | { |
John Heffner | 5d424d5 | 2006-03-20 17:53:41 -0800 | [diff] [blame] | 634 | .procname = "tcp_mtu_probing", |
| 635 | .data = &sysctl_tcp_mtu_probing, |
| 636 | .maxlen = sizeof(int), |
| 637 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 638 | .proc_handler = proc_dointvec, |
John Heffner | 5d424d5 | 2006-03-20 17:53:41 -0800 | [diff] [blame] | 639 | }, |
| 640 | { |
John Heffner | 5d424d5 | 2006-03-20 17:53:41 -0800 | [diff] [blame] | 641 | .procname = "tcp_base_mss", |
| 642 | .data = &sysctl_tcp_base_mss, |
| 643 | .maxlen = sizeof(int), |
| 644 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 645 | .proc_handler = proc_dointvec, |
John Heffner | 5d424d5 | 2006-03-20 17:53:41 -0800 | [diff] [blame] | 646 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 647 | { |
Rick Jones | 15d99e0 | 2006-03-20 22:40:29 -0800 | [diff] [blame] | 648 | .procname = "tcp_workaround_signed_windows", |
| 649 | .data = &sysctl_tcp_workaround_signed_windows, |
| 650 | .maxlen = sizeof(int), |
| 651 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 652 | .proc_handler = proc_dointvec |
Rick Jones | 15d99e0 | 2006-03-20 22:40:29 -0800 | [diff] [blame] | 653 | }, |
Eric Dumazet | 46d3cea | 2012-07-11 05:50:31 +0000 | [diff] [blame] | 654 | { |
| 655 | .procname = "tcp_limit_output_bytes", |
| 656 | .data = &sysctl_tcp_limit_output_bytes, |
| 657 | .maxlen = sizeof(int), |
| 658 | .mode = 0644, |
| 659 | .proc_handler = proc_dointvec |
| 660 | }, |
Eric Dumazet | 282f23c | 2012-07-17 10:13:05 +0200 | [diff] [blame] | 661 | { |
| 662 | .procname = "tcp_challenge_ack_limit", |
| 663 | .data = &sysctl_tcp_challenge_ack_limit, |
| 664 | .maxlen = sizeof(int), |
| 665 | .mode = 0644, |
| 666 | .proc_handler = proc_dointvec |
| 667 | }, |
Chris Leech | 9593782 | 2006-05-23 18:02:55 -0700 | [diff] [blame] | 668 | #ifdef CONFIG_NET_DMA |
| 669 | { |
Chris Leech | 9593782 | 2006-05-23 18:02:55 -0700 | [diff] [blame] | 670 | .procname = "tcp_dma_copybreak", |
| 671 | .data = &sysctl_tcp_dma_copybreak, |
| 672 | .maxlen = sizeof(int), |
| 673 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 674 | .proc_handler = proc_dointvec |
Chris Leech | 9593782 | 2006-05-23 18:02:55 -0700 | [diff] [blame] | 675 | }, |
| 676 | #endif |
David S. Miller | 35089bb | 2006-06-13 22:33:04 -0700 | [diff] [blame] | 677 | { |
David S. Miller | 35089bb | 2006-06-13 22:33:04 -0700 | [diff] [blame] | 678 | .procname = "tcp_slow_start_after_idle", |
| 679 | .data = &sysctl_tcp_slow_start_after_idle, |
| 680 | .maxlen = sizeof(int), |
| 681 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 682 | .proc_handler = proc_dointvec |
David S. Miller | 35089bb | 2006-06-13 22:33:04 -0700 | [diff] [blame] | 683 | }, |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 684 | #ifdef CONFIG_NETLABEL |
| 685 | { |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 686 | .procname = "cipso_cache_enable", |
| 687 | .data = &cipso_v4_cache_enabled, |
| 688 | .maxlen = sizeof(int), |
| 689 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 690 | .proc_handler = proc_dointvec, |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 691 | }, |
| 692 | { |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 693 | .procname = "cipso_cache_bucket_size", |
| 694 | .data = &cipso_v4_cache_bucketsize, |
| 695 | .maxlen = sizeof(int), |
| 696 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 697 | .proc_handler = proc_dointvec, |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 698 | }, |
| 699 | { |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 700 | .procname = "cipso_rbm_optfmt", |
| 701 | .data = &cipso_v4_rbm_optfmt, |
| 702 | .maxlen = sizeof(int), |
| 703 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 704 | .proc_handler = proc_dointvec, |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 705 | }, |
| 706 | { |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 707 | .procname = "cipso_rbm_strictvalid", |
| 708 | .data = &cipso_v4_rbm_strictvalid, |
| 709 | .maxlen = sizeof(int), |
| 710 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 711 | .proc_handler = proc_dointvec, |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 712 | }, |
| 713 | #endif /* CONFIG_NETLABEL */ |
Stephen Hemminger | 3ff825b | 2006-11-09 16:32:06 -0800 | [diff] [blame] | 714 | { |
Stephen Hemminger | 3ff825b | 2006-11-09 16:32:06 -0800 | [diff] [blame] | 715 | .procname = "tcp_available_congestion_control", |
| 716 | .maxlen = TCP_CA_BUF_MAX, |
| 717 | .mode = 0444, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 718 | .proc_handler = proc_tcp_available_congestion_control, |
Stephen Hemminger | 3ff825b | 2006-11-09 16:32:06 -0800 | [diff] [blame] | 719 | }, |
Stephen Hemminger | ce7bc3b | 2006-11-09 16:35:15 -0800 | [diff] [blame] | 720 | { |
Stephen Hemminger | ce7bc3b | 2006-11-09 16:35:15 -0800 | [diff] [blame] | 721 | .procname = "tcp_allowed_congestion_control", |
| 722 | .maxlen = TCP_CA_BUF_MAX, |
| 723 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 724 | .proc_handler = proc_allowed_congestion_control, |
Stephen Hemminger | ce7bc3b | 2006-11-09 16:35:15 -0800 | [diff] [blame] | 725 | }, |
John Heffner | 886236c | 2007-03-25 19:21:45 -0700 | [diff] [blame] | 726 | { |
John Heffner | 886236c | 2007-03-25 19:21:45 -0700 | [diff] [blame] | 727 | .procname = "tcp_max_ssthresh", |
| 728 | .data = &sysctl_tcp_max_ssthresh, |
| 729 | .maxlen = sizeof(int), |
| 730 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 731 | .proc_handler = proc_dointvec, |
John Heffner | 886236c | 2007-03-25 19:21:45 -0700 | [diff] [blame] | 732 | }, |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 733 | { |
Andreas Petlund | 36e31b0a | 2010-02-18 02:47:01 +0000 | [diff] [blame] | 734 | .procname = "tcp_thin_linear_timeouts", |
| 735 | .data = &sysctl_tcp_thin_linear_timeouts, |
| 736 | .maxlen = sizeof(int), |
| 737 | .mode = 0644, |
| 738 | .proc_handler = proc_dointvec |
| 739 | }, |
Andreas Petlund | 7e38017 | 2010-02-18 04:48:19 +0000 | [diff] [blame] | 740 | { |
| 741 | .procname = "tcp_thin_dupack", |
| 742 | .data = &sysctl_tcp_thin_dupack, |
| 743 | .maxlen = sizeof(int), |
| 744 | .mode = 0644, |
| 745 | .proc_handler = proc_dointvec |
| 746 | }, |
Andreas Petlund | 36e31b0a | 2010-02-18 02:47:01 +0000 | [diff] [blame] | 747 | { |
Yuchung Cheng | eed530b | 2012-05-02 13:30:03 +0000 | [diff] [blame] | 748 | .procname = "tcp_early_retrans", |
| 749 | .data = &sysctl_tcp_early_retrans, |
| 750 | .maxlen = sizeof(int), |
| 751 | .mode = 0644, |
| 752 | .proc_handler = proc_dointvec_minmax, |
| 753 | .extra1 = &zero, |
Nandita Dukkipati | 6ba8a3b | 2013-03-11 10:00:43 +0000 | [diff] [blame] | 754 | .extra2 = &four, |
Yuchung Cheng | eed530b | 2012-05-02 13:30:03 +0000 | [diff] [blame] | 755 | }, |
| 756 | { |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 757 | .procname = "udp_mem", |
| 758 | .data = &sysctl_udp_mem, |
| 759 | .maxlen = sizeof(sysctl_udp_mem), |
| 760 | .mode = 0644, |
Eric Dumazet | 8d987e5 | 2010-11-09 23:24:26 +0000 | [diff] [blame] | 761 | .proc_handler = proc_doulongvec_minmax, |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 762 | }, |
| 763 | { |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 764 | .procname = "udp_rmem_min", |
| 765 | .data = &sysctl_udp_rmem_min, |
| 766 | .maxlen = sizeof(sysctl_udp_rmem_min), |
| 767 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 768 | .proc_handler = proc_dointvec_minmax, |
bingtian.ly@taobao.com | cdda889 | 2013-01-23 20:35:28 +0000 | [diff] [blame] | 769 | .extra1 = &one |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 770 | }, |
| 771 | { |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 772 | .procname = "udp_wmem_min", |
| 773 | .data = &sysctl_udp_wmem_min, |
| 774 | .maxlen = sizeof(sysctl_udp_wmem_min), |
| 775 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 776 | .proc_handler = proc_dointvec_minmax, |
bingtian.ly@taobao.com | cdda889 | 2013-01-23 20:35:28 +0000 | [diff] [blame] | 777 | .extra1 = &one |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 778 | }, |
Eric W. Biederman | f8572d8 | 2009-11-05 13:32:03 -0800 | [diff] [blame] | 779 | { } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 780 | }; |
Pavel Emelyanov | 3e37c3f | 2007-12-05 01:41:26 -0800 | [diff] [blame] | 781 | |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 782 | static struct ctl_table ipv4_net_table[] = { |
| 783 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 784 | .procname = "icmp_echo_ignore_all", |
| 785 | .data = &init_net.ipv4.sysctl_icmp_echo_ignore_all, |
| 786 | .maxlen = sizeof(int), |
| 787 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 788 | .proc_handler = proc_dointvec |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 789 | }, |
| 790 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 791 | .procname = "icmp_echo_ignore_broadcasts", |
| 792 | .data = &init_net.ipv4.sysctl_icmp_echo_ignore_broadcasts, |
| 793 | .maxlen = sizeof(int), |
| 794 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 795 | .proc_handler = proc_dointvec |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 796 | }, |
| 797 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 798 | .procname = "icmp_ignore_bogus_error_responses", |
| 799 | .data = &init_net.ipv4.sysctl_icmp_ignore_bogus_error_responses, |
| 800 | .maxlen = sizeof(int), |
| 801 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 802 | .proc_handler = proc_dointvec |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 803 | }, |
| 804 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 805 | .procname = "icmp_errors_use_inbound_ifaddr", |
| 806 | .data = &init_net.ipv4.sysctl_icmp_errors_use_inbound_ifaddr, |
| 807 | .maxlen = sizeof(int), |
| 808 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 809 | .proc_handler = proc_dointvec |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 810 | }, |
| 811 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 812 | .procname = "icmp_ratelimit", |
| 813 | .data = &init_net.ipv4.sysctl_icmp_ratelimit, |
| 814 | .maxlen = sizeof(int), |
| 815 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 816 | .proc_handler = proc_dointvec_ms_jiffies, |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 817 | }, |
| 818 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 819 | .procname = "icmp_ratemask", |
| 820 | .data = &init_net.ipv4.sysctl_icmp_ratemask, |
| 821 | .maxlen = sizeof(int), |
| 822 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 823 | .proc_handler = proc_dointvec |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 824 | }, |
Neil Horman | 1080d70 | 2008-10-27 12:28:25 -0700 | [diff] [blame] | 825 | { |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 826 | .procname = "ping_group_range", |
| 827 | .data = &init_net.ipv4.sysctl_ping_group_range, |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 828 | .maxlen = sizeof(gid_t)*2, |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 829 | .mode = 0644, |
| 830 | .proc_handler = ipv4_ping_group_range, |
| 831 | }, |
Glauber Costa | 3dc43e3 | 2011-12-11 21:47:05 +0000 | [diff] [blame] | 832 | { |
Hannes Frederic Sowa | 5d134f1 | 2013-01-05 16:10:48 +0000 | [diff] [blame] | 833 | .procname = "tcp_ecn", |
| 834 | .data = &init_net.ipv4.sysctl_tcp_ecn, |
| 835 | .maxlen = sizeof(int), |
| 836 | .mode = 0644, |
| 837 | .proc_handler = proc_dointvec |
| 838 | }, |
| 839 | { |
Glauber Costa | 3dc43e3 | 2011-12-11 21:47:05 +0000 | [diff] [blame] | 840 | .procname = "tcp_mem", |
| 841 | .maxlen = sizeof(init_net.ipv4.sysctl_tcp_mem), |
| 842 | .mode = 0644, |
| 843 | .proc_handler = ipv4_tcp_mem, |
| 844 | }, |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 845 | { } |
| 846 | }; |
| 847 | |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 848 | static __net_init int ipv4_sysctl_init_net(struct net *net) |
| 849 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 850 | struct ctl_table *table; |
| 851 | |
| 852 | table = ipv4_net_table; |
Octavian Purdila | 09ad9bc | 2009-11-25 15:14:13 -0800 | [diff] [blame] | 853 | if (!net_eq(net, &init_net)) { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 854 | table = kmemdup(table, sizeof(ipv4_net_table), GFP_KERNEL); |
| 855 | if (table == NULL) |
| 856 | goto err_alloc; |
| 857 | |
| 858 | table[0].data = |
| 859 | &net->ipv4.sysctl_icmp_echo_ignore_all; |
| 860 | table[1].data = |
| 861 | &net->ipv4.sysctl_icmp_echo_ignore_broadcasts; |
| 862 | table[2].data = |
| 863 | &net->ipv4.sysctl_icmp_ignore_bogus_error_responses; |
| 864 | table[3].data = |
| 865 | &net->ipv4.sysctl_icmp_errors_use_inbound_ifaddr; |
| 866 | table[4].data = |
| 867 | &net->ipv4.sysctl_icmp_ratelimit; |
| 868 | table[5].data = |
| 869 | &net->ipv4.sysctl_icmp_ratemask; |
Neil Horman | 1080d70 | 2008-10-27 12:28:25 -0700 | [diff] [blame] | 870 | table[6].data = |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 871 | &net->ipv4.sysctl_ping_group_range; |
Hannes Frederic Sowa | 5d134f1 | 2013-01-05 16:10:48 +0000 | [diff] [blame] | 872 | table[7].data = |
| 873 | &net->ipv4.sysctl_tcp_ecn; |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 874 | |
Eric W. Biederman | 464dc80 | 2012-11-16 03:02:59 +0000 | [diff] [blame] | 875 | /* Don't export sysctls to unprivileged users */ |
| 876 | if (net->user_ns != &init_user_ns) |
| 877 | table[0].procname = NULL; |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 878 | } |
| 879 | |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 880 | /* |
| 881 | * Sane defaults - nobody may create ping sockets. |
| 882 | * Boot scripts should set this to distro-specific group. |
| 883 | */ |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 884 | net->ipv4.sysctl_ping_group_range[0] = make_kgid(&init_user_ns, 1); |
| 885 | net->ipv4.sysctl_ping_group_range[1] = make_kgid(&init_user_ns, 0); |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 886 | |
Glauber Costa | 4acb419 | 2012-01-30 01:20:17 +0000 | [diff] [blame] | 887 | tcp_init_mem(net); |
Glauber Costa | 3dc43e3 | 2011-12-11 21:47:05 +0000 | [diff] [blame] | 888 | |
Eric W. Biederman | ec8f23c | 2012-04-19 13:44:49 +0000 | [diff] [blame] | 889 | net->ipv4.ipv4_hdr = register_net_sysctl(net, "net/ipv4", table); |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 890 | if (net->ipv4.ipv4_hdr == NULL) |
| 891 | goto err_reg; |
| 892 | |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 893 | return 0; |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 894 | |
| 895 | err_reg: |
Octavian Purdila | 09ad9bc | 2009-11-25 15:14:13 -0800 | [diff] [blame] | 896 | if (!net_eq(net, &init_net)) |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 897 | kfree(table); |
| 898 | err_alloc: |
| 899 | return -ENOMEM; |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 900 | } |
| 901 | |
| 902 | static __net_exit void ipv4_sysctl_exit_net(struct net *net) |
| 903 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 904 | struct ctl_table *table; |
| 905 | |
| 906 | table = net->ipv4.ipv4_hdr->ctl_table_arg; |
| 907 | unregister_net_sysctl_table(net->ipv4.ipv4_hdr); |
| 908 | kfree(table); |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 909 | } |
| 910 | |
| 911 | static __net_initdata struct pernet_operations ipv4_sysctl_ops = { |
| 912 | .init = ipv4_sysctl_init_net, |
| 913 | .exit = ipv4_sysctl_exit_net, |
| 914 | }; |
| 915 | |
Pavel Emelyanov | 3e37c3f | 2007-12-05 01:41:26 -0800 | [diff] [blame] | 916 | static __init int sysctl_ipv4_init(void) |
| 917 | { |
| 918 | struct ctl_table_header *hdr; |
Amerigo Wang | e3826f1 | 2010-05-05 00:27:06 +0000 | [diff] [blame] | 919 | struct ctl_table *i; |
| 920 | |
| 921 | for (i = ipv4_table; i->procname; i++) { |
| 922 | if (strcmp(i->procname, "ip_local_reserved_ports") == 0) { |
| 923 | i->data = sysctl_local_reserved_ports; |
| 924 | break; |
| 925 | } |
| 926 | } |
| 927 | if (!i->procname) |
| 928 | return -EINVAL; |
Pavel Emelyanov | 3e37c3f | 2007-12-05 01:41:26 -0800 | [diff] [blame] | 929 | |
Eric W. Biederman | ec8f23c | 2012-04-19 13:44:49 +0000 | [diff] [blame] | 930 | hdr = register_net_sysctl(&init_net, "net/ipv4", ipv4_table); |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 931 | if (hdr == NULL) |
| 932 | return -ENOMEM; |
| 933 | |
| 934 | if (register_pernet_subsys(&ipv4_sysctl_ops)) { |
Eric W. Biederman | 5dd3df1 | 2012-04-19 13:24:33 +0000 | [diff] [blame] | 935 | unregister_net_sysctl_table(hdr); |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 936 | return -ENOMEM; |
| 937 | } |
| 938 | |
| 939 | return 0; |
Pavel Emelyanov | 3e37c3f | 2007-12-05 01:41:26 -0800 | [diff] [blame] | 940 | } |
| 941 | |
| 942 | __initcall(sysctl_ipv4_init); |