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