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