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