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