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