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 | |
Jerry Chu | 1046716 | 2012-08-31 12:29:11 +0000 | [diff] [blame^] | 235 | int proc_tcp_fastopen_key(ctl_table *ctl, int write, void __user *buffer, |
| 236 | size_t *lenp, loff_t *ppos) |
| 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); |
| 251 | rcu_read_unlock(); |
| 252 | |
| 253 | snprintf(tbl.data, tbl.maxlen, "%08x-%08x-%08x-%08x", |
| 254 | user_key[0], user_key[1], user_key[2], user_key[3]); |
| 255 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
| 256 | |
| 257 | if (write && ret == 0) { |
| 258 | if (sscanf(tbl.data, "%x-%x-%x-%x", user_key, user_key + 1, |
| 259 | user_key + 2, user_key + 3) != 4) { |
| 260 | ret = -EINVAL; |
| 261 | goto bad_key; |
| 262 | } |
| 263 | tcp_fastopen_reset_cipher(user_key, TCP_FASTOPEN_KEY_LENGTH); |
| 264 | } |
| 265 | |
| 266 | bad_key: |
| 267 | pr_debug("proc FO key set 0x%x-%x-%x-%x <- 0x%s: %u\n", |
| 268 | user_key[0], user_key[1], user_key[2], user_key[3], |
| 269 | (char *)tbl.data, ret); |
| 270 | kfree(tbl.data); |
| 271 | return ret; |
| 272 | } |
| 273 | |
Pavel Emelyanov | 3e37c3f | 2007-12-05 01:41:26 -0800 | [diff] [blame] | 274 | static struct ctl_table ipv4_table[] = { |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 275 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | .procname = "tcp_timestamps", |
| 277 | .data = &sysctl_tcp_timestamps, |
| 278 | .maxlen = sizeof(int), |
| 279 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 280 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 282 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | .procname = "tcp_window_scaling", |
| 284 | .data = &sysctl_tcp_window_scaling, |
| 285 | .maxlen = sizeof(int), |
| 286 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 287 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 288 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 289 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | .procname = "tcp_sack", |
| 291 | .data = &sysctl_tcp_sack, |
| 292 | .maxlen = sizeof(int), |
| 293 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 294 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 295 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 296 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | .procname = "tcp_retrans_collapse", |
| 298 | .data = &sysctl_tcp_retrans_collapse, |
| 299 | .maxlen = sizeof(int), |
| 300 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 301 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 303 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 304 | .procname = "ip_default_ttl", |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 305 | .data = &sysctl_ip_default_ttl, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | .maxlen = sizeof(int), |
| 307 | .mode = 0644, |
Eric Dumazet | 249fab7 | 2010-12-13 12:16:14 -0800 | [diff] [blame] | 308 | .proc_handler = proc_dointvec_minmax, |
| 309 | .extra1 = &ip_ttl_min, |
| 310 | .extra2 = &ip_ttl_max, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 312 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | .procname = "ip_no_pmtu_disc", |
| 314 | .data = &ipv4_config.no_pmtu_disc, |
| 315 | .maxlen = sizeof(int), |
| 316 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 317 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | }, |
| 319 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | .procname = "ip_nonlocal_bind", |
| 321 | .data = &sysctl_ip_nonlocal_bind, |
| 322 | .maxlen = sizeof(int), |
| 323 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 324 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 325 | }, |
| 326 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 327 | .procname = "tcp_syn_retries", |
| 328 | .data = &sysctl_tcp_syn_retries, |
| 329 | .maxlen = sizeof(int), |
| 330 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 331 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 332 | }, |
| 333 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | .procname = "tcp_synack_retries", |
| 335 | .data = &sysctl_tcp_synack_retries, |
| 336 | .maxlen = sizeof(int), |
| 337 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 338 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | }, |
| 340 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | .procname = "tcp_max_orphans", |
| 342 | .data = &sysctl_tcp_max_orphans, |
| 343 | .maxlen = sizeof(int), |
| 344 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 345 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 346 | }, |
| 347 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 348 | .procname = "tcp_max_tw_buckets", |
Arnaldo Carvalho de Melo | 295ff7e | 2005-08-09 20:44:40 -0700 | [diff] [blame] | 349 | .data = &tcp_death_row.sysctl_max_tw_buckets, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 350 | .maxlen = sizeof(int), |
| 351 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 352 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | }, |
| 354 | { |
Alexander Duyck | 6648bd7 | 2012-06-21 13:58:31 +0000 | [diff] [blame] | 355 | .procname = "ip_early_demux", |
| 356 | .data = &sysctl_ip_early_demux, |
| 357 | .maxlen = sizeof(int), |
| 358 | .mode = 0644, |
| 359 | .proc_handler = proc_dointvec |
| 360 | }, |
| 361 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 362 | .procname = "ip_dynaddr", |
| 363 | .data = &sysctl_ip_dynaddr, |
| 364 | .maxlen = sizeof(int), |
| 365 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 366 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 367 | }, |
| 368 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 369 | .procname = "tcp_keepalive_time", |
| 370 | .data = &sysctl_tcp_keepalive_time, |
| 371 | .maxlen = sizeof(int), |
| 372 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 373 | .proc_handler = proc_dointvec_jiffies, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 374 | }, |
| 375 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 376 | .procname = "tcp_keepalive_probes", |
| 377 | .data = &sysctl_tcp_keepalive_probes, |
| 378 | .maxlen = sizeof(int), |
| 379 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 380 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 381 | }, |
| 382 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 | .procname = "tcp_keepalive_intvl", |
| 384 | .data = &sysctl_tcp_keepalive_intvl, |
| 385 | .maxlen = sizeof(int), |
| 386 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 387 | .proc_handler = proc_dointvec_jiffies, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 388 | }, |
| 389 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 390 | .procname = "tcp_retries1", |
| 391 | .data = &sysctl_tcp_retries1, |
| 392 | .maxlen = sizeof(int), |
| 393 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 394 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 395 | .extra2 = &tcp_retr1_max |
| 396 | }, |
| 397 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 398 | .procname = "tcp_retries2", |
| 399 | .data = &sysctl_tcp_retries2, |
| 400 | .maxlen = sizeof(int), |
| 401 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 402 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 403 | }, |
| 404 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 405 | .procname = "tcp_fin_timeout", |
| 406 | .data = &sysctl_tcp_fin_timeout, |
| 407 | .maxlen = sizeof(int), |
| 408 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 409 | .proc_handler = proc_dointvec_jiffies, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 410 | }, |
| 411 | #ifdef CONFIG_SYN_COOKIES |
| 412 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 413 | .procname = "tcp_syncookies", |
| 414 | .data = &sysctl_tcp_syncookies, |
| 415 | .maxlen = sizeof(int), |
| 416 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 417 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 418 | }, |
| 419 | #endif |
| 420 | { |
Yuchung Cheng | 2100c8d | 2012-07-19 06:43:05 +0000 | [diff] [blame] | 421 | .procname = "tcp_fastopen", |
| 422 | .data = &sysctl_tcp_fastopen, |
| 423 | .maxlen = sizeof(int), |
| 424 | .mode = 0644, |
| 425 | .proc_handler = proc_dointvec, |
| 426 | }, |
| 427 | { |
Jerry Chu | 1046716 | 2012-08-31 12:29:11 +0000 | [diff] [blame^] | 428 | .procname = "tcp_fastopen_key", |
| 429 | .mode = 0600, |
| 430 | .maxlen = ((TCP_FASTOPEN_KEY_LENGTH * 2) + 10), |
| 431 | .proc_handler = proc_tcp_fastopen_key, |
| 432 | }, |
| 433 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 434 | .procname = "tcp_tw_recycle", |
Arnaldo Carvalho de Melo | 295ff7e | 2005-08-09 20:44:40 -0700 | [diff] [blame] | 435 | .data = &tcp_death_row.sysctl_tw_recycle, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 436 | .maxlen = sizeof(int), |
| 437 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 438 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 439 | }, |
| 440 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 441 | .procname = "tcp_abort_on_overflow", |
| 442 | .data = &sysctl_tcp_abort_on_overflow, |
| 443 | .maxlen = sizeof(int), |
| 444 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 445 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 446 | }, |
| 447 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 448 | .procname = "tcp_stdurg", |
| 449 | .data = &sysctl_tcp_stdurg, |
| 450 | .maxlen = sizeof(int), |
| 451 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 452 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 453 | }, |
| 454 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 455 | .procname = "tcp_rfc1337", |
| 456 | .data = &sysctl_tcp_rfc1337, |
| 457 | .maxlen = sizeof(int), |
| 458 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 459 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 460 | }, |
| 461 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 462 | .procname = "tcp_max_syn_backlog", |
| 463 | .data = &sysctl_max_syn_backlog, |
| 464 | .maxlen = sizeof(int), |
| 465 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 466 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 467 | }, |
| 468 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 469 | .procname = "ip_local_port_range", |
Eric Dumazet | 3c689b7 | 2008-10-08 14:18:04 -0700 | [diff] [blame] | 470 | .data = &sysctl_local_ports.range, |
| 471 | .maxlen = sizeof(sysctl_local_ports.range), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 472 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 473 | .proc_handler = ipv4_local_port_range, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 474 | }, |
Amerigo Wang | e3826f1 | 2010-05-05 00:27:06 +0000 | [diff] [blame] | 475 | { |
| 476 | .procname = "ip_local_reserved_ports", |
| 477 | .data = NULL, /* initialized in sysctl_ipv4_init */ |
| 478 | .maxlen = 65536, |
| 479 | .mode = 0644, |
| 480 | .proc_handler = proc_do_large_bitmap, |
| 481 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 483 | .procname = "igmp_max_memberships", |
| 484 | .data = &sysctl_igmp_max_memberships, |
| 485 | .maxlen = sizeof(int), |
| 486 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 487 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 488 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 489 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 490 | .procname = "igmp_max_msf", |
| 491 | .data = &sysctl_igmp_max_msf, |
| 492 | .maxlen = sizeof(int), |
| 493 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 494 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 495 | }, |
| 496 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 497 | .procname = "inet_peer_threshold", |
| 498 | .data = &inet_peer_threshold, |
| 499 | .maxlen = sizeof(int), |
| 500 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 501 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 502 | }, |
| 503 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 504 | .procname = "inet_peer_minttl", |
| 505 | .data = &inet_peer_minttl, |
| 506 | .maxlen = sizeof(int), |
| 507 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 508 | .proc_handler = proc_dointvec_jiffies, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 509 | }, |
| 510 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 511 | .procname = "inet_peer_maxttl", |
| 512 | .data = &inet_peer_maxttl, |
| 513 | .maxlen = sizeof(int), |
| 514 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 515 | .proc_handler = proc_dointvec_jiffies, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 516 | }, |
| 517 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 518 | .procname = "tcp_orphan_retries", |
| 519 | .data = &sysctl_tcp_orphan_retries, |
| 520 | .maxlen = sizeof(int), |
| 521 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 522 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 523 | }, |
| 524 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 525 | .procname = "tcp_fack", |
| 526 | .data = &sysctl_tcp_fack, |
| 527 | .maxlen = sizeof(int), |
| 528 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 529 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 530 | }, |
| 531 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 532 | .procname = "tcp_reordering", |
| 533 | .data = &sysctl_tcp_reordering, |
| 534 | .maxlen = sizeof(int), |
| 535 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 536 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 537 | }, |
| 538 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 539 | .procname = "tcp_ecn", |
| 540 | .data = &sysctl_tcp_ecn, |
| 541 | .maxlen = sizeof(int), |
| 542 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 543 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 544 | }, |
| 545 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 546 | .procname = "tcp_dsack", |
| 547 | .data = &sysctl_tcp_dsack, |
| 548 | .maxlen = sizeof(int), |
| 549 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 550 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 551 | }, |
| 552 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 553 | .procname = "tcp_wmem", |
| 554 | .data = &sysctl_tcp_wmem, |
| 555 | .maxlen = sizeof(sysctl_tcp_wmem), |
| 556 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 557 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 558 | }, |
| 559 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 560 | .procname = "tcp_rmem", |
| 561 | .data = &sysctl_tcp_rmem, |
| 562 | .maxlen = sizeof(sysctl_tcp_rmem), |
| 563 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 564 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 565 | }, |
| 566 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 567 | .procname = "tcp_app_win", |
| 568 | .data = &sysctl_tcp_app_win, |
| 569 | .maxlen = sizeof(int), |
| 570 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 571 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 572 | }, |
| 573 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 574 | .procname = "tcp_adv_win_scale", |
| 575 | .data = &sysctl_tcp_adv_win_scale, |
| 576 | .maxlen = sizeof(int), |
| 577 | .mode = 0644, |
Alexey Dobriyan | 0147fc0 | 2010-11-22 12:54:21 +0000 | [diff] [blame] | 578 | .proc_handler = proc_dointvec_minmax, |
| 579 | .extra1 = &tcp_adv_win_scale_min, |
| 580 | .extra2 = &tcp_adv_win_scale_max, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 581 | }, |
| 582 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 583 | .procname = "tcp_tw_reuse", |
| 584 | .data = &sysctl_tcp_tw_reuse, |
| 585 | .maxlen = sizeof(int), |
| 586 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 587 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 588 | }, |
| 589 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 590 | .procname = "tcp_frto", |
| 591 | .data = &sysctl_tcp_frto, |
| 592 | .maxlen = sizeof(int), |
| 593 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 594 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 595 | }, |
| 596 | { |
Ilpo Järvinen | 3cfe3ba | 2007-02-27 10:09:49 -0800 | [diff] [blame] | 597 | .procname = "tcp_frto_response", |
| 598 | .data = &sysctl_tcp_frto_response, |
| 599 | .maxlen = sizeof(int), |
| 600 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 601 | .proc_handler = proc_dointvec |
Ilpo Järvinen | 3cfe3ba | 2007-02-27 10:09:49 -0800 | [diff] [blame] | 602 | }, |
| 603 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 604 | .procname = "tcp_low_latency", |
| 605 | .data = &sysctl_tcp_low_latency, |
| 606 | .maxlen = sizeof(int), |
| 607 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 608 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 609 | }, |
| 610 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 611 | .procname = "tcp_no_metrics_save", |
| 612 | .data = &sysctl_tcp_nometrics_save, |
| 613 | .maxlen = sizeof(int), |
| 614 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 615 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 616 | }, |
| 617 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 618 | .procname = "tcp_moderate_rcvbuf", |
| 619 | .data = &sysctl_tcp_moderate_rcvbuf, |
| 620 | .maxlen = sizeof(int), |
| 621 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 622 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 623 | }, |
| 624 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 625 | .procname = "tcp_tso_win_divisor", |
| 626 | .data = &sysctl_tcp_tso_win_divisor, |
| 627 | .maxlen = sizeof(int), |
| 628 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 629 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 630 | }, |
| 631 | { |
Stephen Hemminger | 317a76f | 2005-06-23 12:19:55 -0700 | [diff] [blame] | 632 | .procname = "tcp_congestion_control", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 633 | .mode = 0644, |
Stephen Hemminger | 317a76f | 2005-06-23 12:19:55 -0700 | [diff] [blame] | 634 | .maxlen = TCP_CA_NAME_MAX, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 635 | .proc_handler = proc_tcp_congestion_control, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 636 | }, |
Stephen Hemminger | 9772efb | 2005-11-10 17:09:53 -0800 | [diff] [blame] | 637 | { |
Stephen Hemminger | 9772efb | 2005-11-10 17:09:53 -0800 | [diff] [blame] | 638 | .procname = "tcp_abc", |
| 639 | .data = &sysctl_tcp_abc, |
| 640 | .maxlen = sizeof(int), |
| 641 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 642 | .proc_handler = proc_dointvec, |
Stephen Hemminger | 9772efb | 2005-11-10 17:09:53 -0800 | [diff] [blame] | 643 | }, |
John Heffner | 5d424d5 | 2006-03-20 17:53:41 -0800 | [diff] [blame] | 644 | { |
John Heffner | 5d424d5 | 2006-03-20 17:53:41 -0800 | [diff] [blame] | 645 | .procname = "tcp_mtu_probing", |
| 646 | .data = &sysctl_tcp_mtu_probing, |
| 647 | .maxlen = sizeof(int), |
| 648 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 649 | .proc_handler = proc_dointvec, |
John Heffner | 5d424d5 | 2006-03-20 17:53:41 -0800 | [diff] [blame] | 650 | }, |
| 651 | { |
John Heffner | 5d424d5 | 2006-03-20 17:53:41 -0800 | [diff] [blame] | 652 | .procname = "tcp_base_mss", |
| 653 | .data = &sysctl_tcp_base_mss, |
| 654 | .maxlen = sizeof(int), |
| 655 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 656 | .proc_handler = proc_dointvec, |
John Heffner | 5d424d5 | 2006-03-20 17:53:41 -0800 | [diff] [blame] | 657 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 658 | { |
Rick Jones | 15d99e0 | 2006-03-20 22:40:29 -0800 | [diff] [blame] | 659 | .procname = "tcp_workaround_signed_windows", |
| 660 | .data = &sysctl_tcp_workaround_signed_windows, |
| 661 | .maxlen = sizeof(int), |
| 662 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 663 | .proc_handler = proc_dointvec |
Rick Jones | 15d99e0 | 2006-03-20 22:40:29 -0800 | [diff] [blame] | 664 | }, |
Eric Dumazet | 46d3cea | 2012-07-11 05:50:31 +0000 | [diff] [blame] | 665 | { |
| 666 | .procname = "tcp_limit_output_bytes", |
| 667 | .data = &sysctl_tcp_limit_output_bytes, |
| 668 | .maxlen = sizeof(int), |
| 669 | .mode = 0644, |
| 670 | .proc_handler = proc_dointvec |
| 671 | }, |
Eric Dumazet | 282f23c | 2012-07-17 10:13:05 +0200 | [diff] [blame] | 672 | { |
| 673 | .procname = "tcp_challenge_ack_limit", |
| 674 | .data = &sysctl_tcp_challenge_ack_limit, |
| 675 | .maxlen = sizeof(int), |
| 676 | .mode = 0644, |
| 677 | .proc_handler = proc_dointvec |
| 678 | }, |
Chris Leech | 9593782 | 2006-05-23 18:02:55 -0700 | [diff] [blame] | 679 | #ifdef CONFIG_NET_DMA |
| 680 | { |
Chris Leech | 9593782 | 2006-05-23 18:02:55 -0700 | [diff] [blame] | 681 | .procname = "tcp_dma_copybreak", |
| 682 | .data = &sysctl_tcp_dma_copybreak, |
| 683 | .maxlen = sizeof(int), |
| 684 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 685 | .proc_handler = proc_dointvec |
Chris Leech | 9593782 | 2006-05-23 18:02:55 -0700 | [diff] [blame] | 686 | }, |
| 687 | #endif |
David S. Miller | 35089bb | 2006-06-13 22:33:04 -0700 | [diff] [blame] | 688 | { |
David S. Miller | 35089bb | 2006-06-13 22:33:04 -0700 | [diff] [blame] | 689 | .procname = "tcp_slow_start_after_idle", |
| 690 | .data = &sysctl_tcp_slow_start_after_idle, |
| 691 | .maxlen = sizeof(int), |
| 692 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 693 | .proc_handler = proc_dointvec |
David S. Miller | 35089bb | 2006-06-13 22:33:04 -0700 | [diff] [blame] | 694 | }, |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 695 | #ifdef CONFIG_NETLABEL |
| 696 | { |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 697 | .procname = "cipso_cache_enable", |
| 698 | .data = &cipso_v4_cache_enabled, |
| 699 | .maxlen = sizeof(int), |
| 700 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 701 | .proc_handler = proc_dointvec, |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 702 | }, |
| 703 | { |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 704 | .procname = "cipso_cache_bucket_size", |
| 705 | .data = &cipso_v4_cache_bucketsize, |
| 706 | .maxlen = sizeof(int), |
| 707 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 708 | .proc_handler = proc_dointvec, |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 709 | }, |
| 710 | { |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 711 | .procname = "cipso_rbm_optfmt", |
| 712 | .data = &cipso_v4_rbm_optfmt, |
| 713 | .maxlen = sizeof(int), |
| 714 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 715 | .proc_handler = proc_dointvec, |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 716 | }, |
| 717 | { |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 718 | .procname = "cipso_rbm_strictvalid", |
| 719 | .data = &cipso_v4_rbm_strictvalid, |
| 720 | .maxlen = sizeof(int), |
| 721 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 722 | .proc_handler = proc_dointvec, |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 723 | }, |
| 724 | #endif /* CONFIG_NETLABEL */ |
Stephen Hemminger | 3ff825b | 2006-11-09 16:32:06 -0800 | [diff] [blame] | 725 | { |
Stephen Hemminger | 3ff825b | 2006-11-09 16:32:06 -0800 | [diff] [blame] | 726 | .procname = "tcp_available_congestion_control", |
| 727 | .maxlen = TCP_CA_BUF_MAX, |
| 728 | .mode = 0444, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 729 | .proc_handler = proc_tcp_available_congestion_control, |
Stephen Hemminger | 3ff825b | 2006-11-09 16:32:06 -0800 | [diff] [blame] | 730 | }, |
Stephen Hemminger | ce7bc3b | 2006-11-09 16:35:15 -0800 | [diff] [blame] | 731 | { |
Stephen Hemminger | ce7bc3b | 2006-11-09 16:35:15 -0800 | [diff] [blame] | 732 | .procname = "tcp_allowed_congestion_control", |
| 733 | .maxlen = TCP_CA_BUF_MAX, |
| 734 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 735 | .proc_handler = proc_allowed_congestion_control, |
Stephen Hemminger | ce7bc3b | 2006-11-09 16:35:15 -0800 | [diff] [blame] | 736 | }, |
John Heffner | 886236c | 2007-03-25 19:21:45 -0700 | [diff] [blame] | 737 | { |
John Heffner | 886236c | 2007-03-25 19:21:45 -0700 | [diff] [blame] | 738 | .procname = "tcp_max_ssthresh", |
| 739 | .data = &sysctl_tcp_max_ssthresh, |
| 740 | .maxlen = sizeof(int), |
| 741 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 742 | .proc_handler = proc_dointvec, |
John Heffner | 886236c | 2007-03-25 19:21:45 -0700 | [diff] [blame] | 743 | }, |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 744 | { |
William Allen Simpson | 519855c | 2009-12-02 18:14:19 +0000 | [diff] [blame] | 745 | .procname = "tcp_cookie_size", |
| 746 | .data = &sysctl_tcp_cookie_size, |
| 747 | .maxlen = sizeof(int), |
| 748 | .mode = 0644, |
| 749 | .proc_handler = proc_dointvec |
| 750 | }, |
| 751 | { |
Andreas Petlund | 36e31b0a | 2010-02-18 02:47:01 +0000 | [diff] [blame] | 752 | .procname = "tcp_thin_linear_timeouts", |
| 753 | .data = &sysctl_tcp_thin_linear_timeouts, |
| 754 | .maxlen = sizeof(int), |
| 755 | .mode = 0644, |
| 756 | .proc_handler = proc_dointvec |
| 757 | }, |
Andreas Petlund | 7e38017 | 2010-02-18 04:48:19 +0000 | [diff] [blame] | 758 | { |
| 759 | .procname = "tcp_thin_dupack", |
| 760 | .data = &sysctl_tcp_thin_dupack, |
| 761 | .maxlen = sizeof(int), |
| 762 | .mode = 0644, |
| 763 | .proc_handler = proc_dointvec |
| 764 | }, |
Andreas Petlund | 36e31b0a | 2010-02-18 02:47:01 +0000 | [diff] [blame] | 765 | { |
Yuchung Cheng | eed530b | 2012-05-02 13:30:03 +0000 | [diff] [blame] | 766 | .procname = "tcp_early_retrans", |
| 767 | .data = &sysctl_tcp_early_retrans, |
| 768 | .maxlen = sizeof(int), |
| 769 | .mode = 0644, |
| 770 | .proc_handler = proc_dointvec_minmax, |
| 771 | .extra1 = &zero, |
| 772 | .extra2 = &two, |
| 773 | }, |
| 774 | { |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 775 | .procname = "udp_mem", |
| 776 | .data = &sysctl_udp_mem, |
| 777 | .maxlen = sizeof(sysctl_udp_mem), |
| 778 | .mode = 0644, |
Eric Dumazet | 8d987e5 | 2010-11-09 23:24:26 +0000 | [diff] [blame] | 779 | .proc_handler = proc_doulongvec_minmax, |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 780 | }, |
| 781 | { |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 782 | .procname = "udp_rmem_min", |
| 783 | .data = &sysctl_udp_rmem_min, |
| 784 | .maxlen = sizeof(sysctl_udp_rmem_min), |
| 785 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 786 | .proc_handler = proc_dointvec_minmax, |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 787 | .extra1 = &zero |
| 788 | }, |
| 789 | { |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 790 | .procname = "udp_wmem_min", |
| 791 | .data = &sysctl_udp_wmem_min, |
| 792 | .maxlen = sizeof(sysctl_udp_wmem_min), |
| 793 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 794 | .proc_handler = proc_dointvec_minmax, |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 795 | .extra1 = &zero |
| 796 | }, |
Eric W. Biederman | f8572d8 | 2009-11-05 13:32:03 -0800 | [diff] [blame] | 797 | { } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 798 | }; |
Pavel Emelyanov | 3e37c3f | 2007-12-05 01:41:26 -0800 | [diff] [blame] | 799 | |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 800 | static struct ctl_table ipv4_net_table[] = { |
| 801 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 802 | .procname = "icmp_echo_ignore_all", |
| 803 | .data = &init_net.ipv4.sysctl_icmp_echo_ignore_all, |
| 804 | .maxlen = sizeof(int), |
| 805 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 806 | .proc_handler = proc_dointvec |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 807 | }, |
| 808 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 809 | .procname = "icmp_echo_ignore_broadcasts", |
| 810 | .data = &init_net.ipv4.sysctl_icmp_echo_ignore_broadcasts, |
| 811 | .maxlen = sizeof(int), |
| 812 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 813 | .proc_handler = proc_dointvec |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 814 | }, |
| 815 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 816 | .procname = "icmp_ignore_bogus_error_responses", |
| 817 | .data = &init_net.ipv4.sysctl_icmp_ignore_bogus_error_responses, |
| 818 | .maxlen = sizeof(int), |
| 819 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 820 | .proc_handler = proc_dointvec |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 821 | }, |
| 822 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 823 | .procname = "icmp_errors_use_inbound_ifaddr", |
| 824 | .data = &init_net.ipv4.sysctl_icmp_errors_use_inbound_ifaddr, |
| 825 | .maxlen = sizeof(int), |
| 826 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 827 | .proc_handler = proc_dointvec |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 828 | }, |
| 829 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 830 | .procname = "icmp_ratelimit", |
| 831 | .data = &init_net.ipv4.sysctl_icmp_ratelimit, |
| 832 | .maxlen = sizeof(int), |
| 833 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 834 | .proc_handler = proc_dointvec_ms_jiffies, |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 835 | }, |
| 836 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 837 | .procname = "icmp_ratemask", |
| 838 | .data = &init_net.ipv4.sysctl_icmp_ratemask, |
| 839 | .maxlen = sizeof(int), |
| 840 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 841 | .proc_handler = proc_dointvec |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 842 | }, |
Neil Horman | 1080d70 | 2008-10-27 12:28:25 -0700 | [diff] [blame] | 843 | { |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 844 | .procname = "ping_group_range", |
| 845 | .data = &init_net.ipv4.sysctl_ping_group_range, |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 846 | .maxlen = sizeof(gid_t)*2, |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 847 | .mode = 0644, |
| 848 | .proc_handler = ipv4_ping_group_range, |
| 849 | }, |
Glauber Costa | 3dc43e3 | 2011-12-11 21:47:05 +0000 | [diff] [blame] | 850 | { |
| 851 | .procname = "tcp_mem", |
| 852 | .maxlen = sizeof(init_net.ipv4.sysctl_tcp_mem), |
| 853 | .mode = 0644, |
| 854 | .proc_handler = ipv4_tcp_mem, |
| 855 | }, |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 856 | { } |
| 857 | }; |
| 858 | |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 859 | static __net_init int ipv4_sysctl_init_net(struct net *net) |
| 860 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 861 | struct ctl_table *table; |
| 862 | |
| 863 | table = ipv4_net_table; |
Octavian Purdila | 09ad9bc | 2009-11-25 15:14:13 -0800 | [diff] [blame] | 864 | if (!net_eq(net, &init_net)) { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 865 | table = kmemdup(table, sizeof(ipv4_net_table), GFP_KERNEL); |
| 866 | if (table == NULL) |
| 867 | goto err_alloc; |
| 868 | |
| 869 | table[0].data = |
| 870 | &net->ipv4.sysctl_icmp_echo_ignore_all; |
| 871 | table[1].data = |
| 872 | &net->ipv4.sysctl_icmp_echo_ignore_broadcasts; |
| 873 | table[2].data = |
| 874 | &net->ipv4.sysctl_icmp_ignore_bogus_error_responses; |
| 875 | table[3].data = |
| 876 | &net->ipv4.sysctl_icmp_errors_use_inbound_ifaddr; |
| 877 | table[4].data = |
| 878 | &net->ipv4.sysctl_icmp_ratelimit; |
| 879 | table[5].data = |
| 880 | &net->ipv4.sysctl_icmp_ratemask; |
Neil Horman | 1080d70 | 2008-10-27 12:28:25 -0700 | [diff] [blame] | 881 | table[6].data = |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 882 | &net->ipv4.sysctl_ping_group_range; |
| 883 | |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 884 | } |
| 885 | |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 886 | /* |
| 887 | * Sane defaults - nobody may create ping sockets. |
| 888 | * Boot scripts should set this to distro-specific group. |
| 889 | */ |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 890 | net->ipv4.sysctl_ping_group_range[0] = make_kgid(&init_user_ns, 1); |
| 891 | 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] | 892 | |
Glauber Costa | 4acb419 | 2012-01-30 01:20:17 +0000 | [diff] [blame] | 893 | tcp_init_mem(net); |
Glauber Costa | 3dc43e3 | 2011-12-11 21:47:05 +0000 | [diff] [blame] | 894 | |
Eric W. Biederman | ec8f23c | 2012-04-19 13:44:49 +0000 | [diff] [blame] | 895 | net->ipv4.ipv4_hdr = register_net_sysctl(net, "net/ipv4", table); |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 896 | if (net->ipv4.ipv4_hdr == NULL) |
| 897 | goto err_reg; |
| 898 | |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 899 | return 0; |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 900 | |
| 901 | err_reg: |
Octavian Purdila | 09ad9bc | 2009-11-25 15:14:13 -0800 | [diff] [blame] | 902 | if (!net_eq(net, &init_net)) |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 903 | kfree(table); |
| 904 | err_alloc: |
| 905 | return -ENOMEM; |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 906 | } |
| 907 | |
| 908 | static __net_exit void ipv4_sysctl_exit_net(struct net *net) |
| 909 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 910 | struct ctl_table *table; |
| 911 | |
| 912 | table = net->ipv4.ipv4_hdr->ctl_table_arg; |
| 913 | unregister_net_sysctl_table(net->ipv4.ipv4_hdr); |
| 914 | kfree(table); |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 915 | } |
| 916 | |
| 917 | static __net_initdata struct pernet_operations ipv4_sysctl_ops = { |
| 918 | .init = ipv4_sysctl_init_net, |
| 919 | .exit = ipv4_sysctl_exit_net, |
| 920 | }; |
| 921 | |
Pavel Emelyanov | 3e37c3f | 2007-12-05 01:41:26 -0800 | [diff] [blame] | 922 | static __init int sysctl_ipv4_init(void) |
| 923 | { |
| 924 | struct ctl_table_header *hdr; |
Amerigo Wang | e3826f1 | 2010-05-05 00:27:06 +0000 | [diff] [blame] | 925 | struct ctl_table *i; |
| 926 | |
| 927 | for (i = ipv4_table; i->procname; i++) { |
| 928 | if (strcmp(i->procname, "ip_local_reserved_ports") == 0) { |
| 929 | i->data = sysctl_local_reserved_ports; |
| 930 | break; |
| 931 | } |
| 932 | } |
| 933 | if (!i->procname) |
| 934 | return -EINVAL; |
Pavel Emelyanov | 3e37c3f | 2007-12-05 01:41:26 -0800 | [diff] [blame] | 935 | |
Eric W. Biederman | ec8f23c | 2012-04-19 13:44:49 +0000 | [diff] [blame] | 936 | hdr = register_net_sysctl(&init_net, "net/ipv4", ipv4_table); |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 937 | if (hdr == NULL) |
| 938 | return -ENOMEM; |
| 939 | |
| 940 | if (register_pernet_subsys(&ipv4_sysctl_ops)) { |
Eric W. Biederman | 5dd3df1 | 2012-04-19 13:24:33 +0000 | [diff] [blame] | 941 | unregister_net_sysctl_table(hdr); |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 942 | return -ENOMEM; |
| 943 | } |
| 944 | |
| 945 | return 0; |
Pavel Emelyanov | 3e37c3f | 2007-12-05 01:41:26 -0800 | [diff] [blame] | 946 | } |
| 947 | |
| 948 | __initcall(sysctl_ipv4_init); |