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