Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * sysctl_net_ipv4.c: sysctl interface to net IPV4 subsystem. |
| 3 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * Begun April 1, 1996, Mike Shaver. |
| 5 | * Added /proc/sys/net/ipv4 directory entry (empty =) ). [MS] |
| 6 | */ |
| 7 | |
| 8 | #include <linux/mm.h> |
| 9 | #include <linux/module.h> |
| 10 | #include <linux/sysctl.h> |
Arnaldo Carvalho de Melo | 2038073 | 2005-08-16 02:18:02 -0300 | [diff] [blame] | 11 | #include <linux/igmp.h> |
Arnaldo Carvalho de Melo | 14c8502 | 2005-12-27 02:43:12 -0200 | [diff] [blame] | 12 | #include <linux/inetdevice.h> |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 13 | #include <linux/seqlock.h> |
Pavel Emelyanov | 3e37c3f | 2007-12-05 01:41:26 -0800 | [diff] [blame] | 14 | #include <linux/init.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 15 | #include <linux/slab.h> |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 16 | #include <linux/nsproxy.h> |
Glauber Costa | 3dc43e3 | 2011-12-11 21:47:05 +0000 | [diff] [blame] | 17 | #include <linux/swap.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | #include <net/snmp.h> |
Arnaldo Carvalho de Melo | 2038073 | 2005-08-16 02:18:02 -0300 | [diff] [blame] | 19 | #include <net/icmp.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | #include <net/ip.h> |
| 21 | #include <net/route.h> |
| 22 | #include <net/tcp.h> |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 23 | #include <net/udp.h> |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 24 | #include <net/cipso_ipv4.h> |
Pavel Emelyanov | 04128f2 | 2007-10-15 02:33:45 -0700 | [diff] [blame] | 25 | #include <net/inet_frag.h> |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 26 | #include <net/ping.h> |
Glauber Costa | 3aaabe2 | 2011-12-11 21:47:06 +0000 | [diff] [blame] | 27 | #include <net/tcp_memcontrol.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | |
Herbert Xu | 89cee8b | 2005-12-13 23:14:27 -0800 | [diff] [blame] | 29 | static int zero; |
bingtian.ly@taobao.com | cdda889 | 2013-01-23 20:35:28 +0000 | [diff] [blame] | 30 | static int one = 1; |
Nandita Dukkipati | 6ba8a3b | 2013-03-11 10:00:43 +0000 | [diff] [blame] | 31 | static int four = 4; |
Eric Dumazet | 95bd09e | 2013-08-27 05:46:32 -0700 | [diff] [blame] | 32 | static int gso_max_segs = GSO_MAX_SEGS; |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 33 | static int tcp_retr1_max = 255; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | static int ip_local_port_range_min[] = { 1, 1 }; |
| 35 | static int ip_local_port_range_max[] = { 65535, 65535 }; |
Alexey Dobriyan | 0147fc0 | 2010-11-22 12:54:21 +0000 | [diff] [blame] | 36 | static int tcp_adv_win_scale_min = -31; |
| 37 | static int tcp_adv_win_scale_max = 31; |
Eric Dumazet | 249fab7 | 2010-12-13 12:16:14 -0800 | [diff] [blame] | 38 | static int ip_ttl_min = 1; |
| 39 | static int ip_ttl_max = 255; |
Michal Tesar | 651e927 | 2013-07-19 14:09:01 +0200 | [diff] [blame] | 40 | static int tcp_syn_retries_min = 1; |
| 41 | static int tcp_syn_retries_max = MAX_TCP_SYNCNT; |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 42 | static int ip_ping_group_range_min[] = { 0, 0 }; |
| 43 | static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 45 | /* Update system visible IP port range */ |
Eric W. Biederman | 0bbf87d | 2013-09-28 14:10:59 -0700 | [diff] [blame] | 46 | static void set_local_port_range(struct net *net, int range[2]) |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 47 | { |
Eric W. Biederman | 0bbf87d | 2013-09-28 14:10:59 -0700 | [diff] [blame] | 48 | write_seqlock(&net->ipv4.sysctl_local_ports.lock); |
| 49 | net->ipv4.sysctl_local_ports.range[0] = range[0]; |
| 50 | net->ipv4.sysctl_local_ports.range[1] = range[1]; |
| 51 | write_sequnlock(&net->ipv4.sysctl_local_ports.lock); |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | /* Validate changes from /proc interface. */ |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 55 | static int ipv4_local_port_range(struct ctl_table *table, int write, |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 56 | void __user *buffer, |
| 57 | size_t *lenp, loff_t *ppos) |
| 58 | { |
Eric W. Biederman | 0bbf87d | 2013-09-28 14:10:59 -0700 | [diff] [blame] | 59 | struct net *net = |
| 60 | container_of(table->data, struct net, ipv4.sysctl_local_ports.range); |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 61 | int ret; |
Eric Dumazet | 3c689b7 | 2008-10-08 14:18:04 -0700 | [diff] [blame] | 62 | int range[2]; |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 63 | struct ctl_table tmp = { |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 64 | .data = &range, |
| 65 | .maxlen = sizeof(range), |
| 66 | .mode = table->mode, |
| 67 | .extra1 = &ip_local_port_range_min, |
| 68 | .extra2 = &ip_local_port_range_max, |
| 69 | }; |
| 70 | |
Eric W. Biederman | 0bbf87d | 2013-09-28 14:10:59 -0700 | [diff] [blame] | 71 | inet_get_local_port_range(net, &range[0], &range[1]); |
| 72 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 73 | ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos); |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 74 | |
| 75 | if (write && ret == 0) { |
Anton Arapov | a25de53 | 2007-10-18 22:00:17 -0700 | [diff] [blame] | 76 | if (range[1] < range[0]) |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 77 | ret = -EINVAL; |
| 78 | else |
Eric W. Biederman | 0bbf87d | 2013-09-28 14:10:59 -0700 | [diff] [blame] | 79 | set_local_port_range(net, range); |
Stephen Hemminger | 227b60f | 2007-10-10 17:30:46 -0700 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | return ret; |
| 83 | } |
| 84 | |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 85 | |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 86 | static void inet_get_ping_group_range_table(struct ctl_table *table, kgid_t *low, kgid_t *high) |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 87 | { |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 88 | kgid_t *data = table->data; |
Eric W. Biederman | 0bbf87d | 2013-09-28 14:10:59 -0700 | [diff] [blame] | 89 | struct net *net = |
| 90 | container_of(table->data, struct net, ipv4.sysctl_ping_group_range); |
Eric Dumazet | 95c9617 | 2012-04-15 05:58:06 +0000 | [diff] [blame] | 91 | unsigned int seq; |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 92 | do { |
Eric W. Biederman | 0bbf87d | 2013-09-28 14:10:59 -0700 | [diff] [blame] | 93 | seq = read_seqbegin(&net->ipv4.sysctl_local_ports.lock); |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 94 | |
| 95 | *low = data[0]; |
| 96 | *high = data[1]; |
Eric W. Biederman | 0bbf87d | 2013-09-28 14:10:59 -0700 | [diff] [blame] | 97 | } while (read_seqretry(&net->ipv4.sysctl_local_ports.lock, seq)); |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 98 | } |
| 99 | |
| 100 | /* Update system visible IP port range */ |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 101 | static void set_ping_group_range(struct ctl_table *table, kgid_t low, kgid_t high) |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 102 | { |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 103 | kgid_t *data = table->data; |
Eric W. Biederman | 0bbf87d | 2013-09-28 14:10:59 -0700 | [diff] [blame] | 104 | struct net *net = |
| 105 | container_of(table->data, struct net, ipv4.sysctl_ping_group_range); |
| 106 | write_seqlock(&net->ipv4.sysctl_local_ports.lock); |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 107 | data[0] = low; |
| 108 | data[1] = high; |
Eric W. Biederman | 0bbf87d | 2013-09-28 14:10:59 -0700 | [diff] [blame] | 109 | write_sequnlock(&net->ipv4.sysctl_local_ports.lock); |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 110 | } |
| 111 | |
| 112 | /* Validate changes from /proc interface. */ |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 113 | static int ipv4_ping_group_range(struct ctl_table *table, int write, |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 114 | void __user *buffer, |
| 115 | size_t *lenp, loff_t *ppos) |
| 116 | { |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 117 | struct user_namespace *user_ns = current_user_ns(); |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 118 | int ret; |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 119 | gid_t urange[2]; |
| 120 | kgid_t low, high; |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 121 | struct ctl_table tmp = { |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 122 | .data = &urange, |
| 123 | .maxlen = sizeof(urange), |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 124 | .mode = table->mode, |
| 125 | .extra1 = &ip_ping_group_range_min, |
| 126 | .extra2 = &ip_ping_group_range_max, |
| 127 | }; |
| 128 | |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 129 | inet_get_ping_group_range_table(table, &low, &high); |
| 130 | urange[0] = from_kgid_munged(user_ns, low); |
| 131 | urange[1] = from_kgid_munged(user_ns, high); |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 132 | ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos); |
| 133 | |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 134 | if (write && ret == 0) { |
| 135 | low = make_kgid(user_ns, urange[0]); |
| 136 | high = make_kgid(user_ns, urange[1]); |
| 137 | if (!gid_valid(low) || !gid_valid(high) || |
| 138 | (urange[1] < urange[0]) || gid_lt(high, low)) { |
| 139 | low = make_kgid(&init_user_ns, 1); |
| 140 | high = make_kgid(&init_user_ns, 0); |
| 141 | } |
| 142 | set_ping_group_range(table, low, high); |
| 143 | } |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 144 | |
| 145 | return ret; |
| 146 | } |
| 147 | |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 148 | static int proc_tcp_congestion_control(struct ctl_table *ctl, int write, |
Stephen Hemminger | 317a76f | 2005-06-23 12:19:55 -0700 | [diff] [blame] | 149 | void __user *buffer, size_t *lenp, loff_t *ppos) |
| 150 | { |
| 151 | char val[TCP_CA_NAME_MAX]; |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 152 | struct ctl_table tbl = { |
Stephen Hemminger | 317a76f | 2005-06-23 12:19:55 -0700 | [diff] [blame] | 153 | .data = val, |
| 154 | .maxlen = TCP_CA_NAME_MAX, |
| 155 | }; |
| 156 | int ret; |
| 157 | |
| 158 | tcp_get_default_congestion_control(val); |
| 159 | |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 160 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
Stephen Hemminger | 317a76f | 2005-06-23 12:19:55 -0700 | [diff] [blame] | 161 | if (write && ret == 0) |
| 162 | ret = tcp_set_default_congestion_control(val); |
| 163 | return ret; |
| 164 | } |
| 165 | |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 166 | static int proc_tcp_available_congestion_control(struct ctl_table *ctl, |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 167 | int write, |
Stephen Hemminger | 3ff825b | 2006-11-09 16:32:06 -0800 | [diff] [blame] | 168 | void __user *buffer, size_t *lenp, |
| 169 | loff_t *ppos) |
| 170 | { |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 171 | struct ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX, }; |
Stephen Hemminger | 3ff825b | 2006-11-09 16:32:06 -0800 | [diff] [blame] | 172 | int ret; |
| 173 | |
| 174 | tbl.data = kmalloc(tbl.maxlen, GFP_USER); |
| 175 | if (!tbl.data) |
| 176 | return -ENOMEM; |
| 177 | tcp_get_available_congestion_control(tbl.data, TCP_CA_BUF_MAX); |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 178 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
Stephen Hemminger | 3ff825b | 2006-11-09 16:32:06 -0800 | [diff] [blame] | 179 | kfree(tbl.data); |
| 180 | return ret; |
| 181 | } |
| 182 | |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 183 | static int proc_allowed_congestion_control(struct ctl_table *ctl, |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 184 | int write, |
Stephen Hemminger | ce7bc3b | 2006-11-09 16:35:15 -0800 | [diff] [blame] | 185 | void __user *buffer, size_t *lenp, |
| 186 | loff_t *ppos) |
| 187 | { |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 188 | struct ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX }; |
Stephen Hemminger | ce7bc3b | 2006-11-09 16:35:15 -0800 | [diff] [blame] | 189 | int ret; |
| 190 | |
| 191 | tbl.data = kmalloc(tbl.maxlen, GFP_USER); |
| 192 | if (!tbl.data) |
| 193 | return -ENOMEM; |
| 194 | |
| 195 | tcp_get_allowed_congestion_control(tbl.data, tbl.maxlen); |
Alexey Dobriyan | 8d65af7 | 2009-09-23 15:57:19 -0700 | [diff] [blame] | 196 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
Stephen Hemminger | ce7bc3b | 2006-11-09 16:35:15 -0800 | [diff] [blame] | 197 | if (write && ret == 0) |
| 198 | ret = tcp_set_allowed_congestion_control(tbl.data); |
| 199 | kfree(tbl.data); |
| 200 | return ret; |
| 201 | } |
| 202 | |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 203 | static int proc_tcp_fastopen_key(struct ctl_table *ctl, int write, |
| 204 | void __user *buffer, size_t *lenp, |
| 205 | loff_t *ppos) |
Jerry Chu | 1046716 | 2012-08-31 12:29:11 +0000 | [diff] [blame] | 206 | { |
Joe Perches | fe2c633 | 2013-06-11 23:04:25 -0700 | [diff] [blame] | 207 | struct ctl_table tbl = { .maxlen = (TCP_FASTOPEN_KEY_LENGTH * 2 + 10) }; |
Jerry Chu | 1046716 | 2012-08-31 12:29:11 +0000 | [diff] [blame] | 208 | struct tcp_fastopen_context *ctxt; |
| 209 | int ret; |
| 210 | u32 user_key[4]; /* 16 bytes, matching TCP_FASTOPEN_KEY_LENGTH */ |
| 211 | |
| 212 | tbl.data = kmalloc(tbl.maxlen, GFP_KERNEL); |
| 213 | if (!tbl.data) |
| 214 | return -ENOMEM; |
| 215 | |
| 216 | rcu_read_lock(); |
| 217 | ctxt = rcu_dereference(tcp_fastopen_ctx); |
| 218 | if (ctxt) |
| 219 | memcpy(user_key, ctxt->key, TCP_FASTOPEN_KEY_LENGTH); |
Alan Cox | 0e24c4f | 2012-10-11 06:24:14 +0000 | [diff] [blame] | 220 | else |
| 221 | memset(user_key, 0, sizeof(user_key)); |
Jerry Chu | 1046716 | 2012-08-31 12:29:11 +0000 | [diff] [blame] | 222 | rcu_read_unlock(); |
| 223 | |
| 224 | snprintf(tbl.data, tbl.maxlen, "%08x-%08x-%08x-%08x", |
| 225 | user_key[0], user_key[1], user_key[2], user_key[3]); |
| 226 | ret = proc_dostring(&tbl, write, buffer, lenp, ppos); |
| 227 | |
| 228 | if (write && ret == 0) { |
| 229 | if (sscanf(tbl.data, "%x-%x-%x-%x", user_key, user_key + 1, |
| 230 | user_key + 2, user_key + 3) != 4) { |
| 231 | ret = -EINVAL; |
| 232 | goto bad_key; |
| 233 | } |
Hannes Frederic Sowa | 222e83d | 2013-10-19 21:48:58 +0200 | [diff] [blame] | 234 | /* Generate a dummy secret but don't publish it. This |
| 235 | * is needed so we don't regenerate a new key on the |
| 236 | * first invocation of tcp_fastopen_cookie_gen |
| 237 | */ |
| 238 | tcp_fastopen_init_key_once(false); |
Jerry Chu | 1046716 | 2012-08-31 12:29:11 +0000 | [diff] [blame] | 239 | tcp_fastopen_reset_cipher(user_key, TCP_FASTOPEN_KEY_LENGTH); |
| 240 | } |
| 241 | |
| 242 | bad_key: |
| 243 | pr_debug("proc FO key set 0x%x-%x-%x-%x <- 0x%s: %u\n", |
| 244 | user_key[0], user_key[1], user_key[2], user_key[3], |
| 245 | (char *)tbl.data, ret); |
| 246 | kfree(tbl.data); |
| 247 | return ret; |
| 248 | } |
| 249 | |
Pavel Emelyanov | 3e37c3f | 2007-12-05 01:41:26 -0800 | [diff] [blame] | 250 | static struct ctl_table ipv4_table[] = { |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 251 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | .procname = "tcp_timestamps", |
| 253 | .data = &sysctl_tcp_timestamps, |
| 254 | .maxlen = sizeof(int), |
| 255 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 256 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 258 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | .procname = "tcp_window_scaling", |
| 260 | .data = &sysctl_tcp_window_scaling, |
| 261 | .maxlen = sizeof(int), |
| 262 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 263 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 265 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | .procname = "tcp_sack", |
| 267 | .data = &sysctl_tcp_sack, |
| 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 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 272 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 273 | .procname = "tcp_retrans_collapse", |
| 274 | .data = &sysctl_tcp_retrans_collapse, |
| 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 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 279 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 280 | .procname = "ip_default_ttl", |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 281 | .data = &sysctl_ip_default_ttl, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 282 | .maxlen = sizeof(int), |
| 283 | .mode = 0644, |
Eric Dumazet | 249fab7 | 2010-12-13 12:16:14 -0800 | [diff] [blame] | 284 | .proc_handler = proc_dointvec_minmax, |
| 285 | .extra1 = &ip_ttl_min, |
| 286 | .extra2 = &ip_ttl_max, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 288 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 289 | .procname = "ip_nonlocal_bind", |
| 290 | .data = &sysctl_ip_nonlocal_bind, |
| 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 = "tcp_syn_retries", |
| 297 | .data = &sysctl_tcp_syn_retries, |
| 298 | .maxlen = sizeof(int), |
| 299 | .mode = 0644, |
Michal Tesar | 651e927 | 2013-07-19 14:09:01 +0200 | [diff] [blame] | 300 | .proc_handler = proc_dointvec_minmax, |
| 301 | .extra1 = &tcp_syn_retries_min, |
| 302 | .extra2 = &tcp_syn_retries_max |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | }, |
| 304 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | .procname = "tcp_synack_retries", |
| 306 | .data = &sysctl_tcp_synack_retries, |
| 307 | .maxlen = sizeof(int), |
| 308 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 309 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | }, |
| 311 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 | .procname = "tcp_max_orphans", |
| 313 | .data = &sysctl_tcp_max_orphans, |
| 314 | .maxlen = sizeof(int), |
| 315 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 316 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | }, |
| 318 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 319 | .procname = "tcp_max_tw_buckets", |
Arnaldo Carvalho de Melo | 295ff7e | 2005-08-09 20:44:40 -0700 | [diff] [blame] | 320 | .data = &tcp_death_row.sysctl_max_tw_buckets, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 321 | .maxlen = sizeof(int), |
| 322 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 323 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 324 | }, |
| 325 | { |
Alexander Duyck | 6648bd7 | 2012-06-21 13:58:31 +0000 | [diff] [blame] | 326 | .procname = "ip_early_demux", |
| 327 | .data = &sysctl_ip_early_demux, |
| 328 | .maxlen = sizeof(int), |
| 329 | .mode = 0644, |
| 330 | .proc_handler = proc_dointvec |
| 331 | }, |
| 332 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 333 | .procname = "ip_dynaddr", |
| 334 | .data = &sysctl_ip_dynaddr, |
| 335 | .maxlen = sizeof(int), |
| 336 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 337 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | }, |
| 339 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 340 | .procname = "tcp_keepalive_time", |
| 341 | .data = &sysctl_tcp_keepalive_time, |
| 342 | .maxlen = sizeof(int), |
| 343 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 344 | .proc_handler = proc_dointvec_jiffies, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | }, |
| 346 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 347 | .procname = "tcp_keepalive_probes", |
| 348 | .data = &sysctl_tcp_keepalive_probes, |
| 349 | .maxlen = sizeof(int), |
| 350 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 351 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | }, |
| 353 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 354 | .procname = "tcp_keepalive_intvl", |
| 355 | .data = &sysctl_tcp_keepalive_intvl, |
| 356 | .maxlen = sizeof(int), |
| 357 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 358 | .proc_handler = proc_dointvec_jiffies, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 359 | }, |
| 360 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | .procname = "tcp_retries1", |
| 362 | .data = &sysctl_tcp_retries1, |
| 363 | .maxlen = sizeof(int), |
| 364 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 365 | .proc_handler = proc_dointvec_minmax, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 366 | .extra2 = &tcp_retr1_max |
| 367 | }, |
| 368 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 369 | .procname = "tcp_retries2", |
| 370 | .data = &sysctl_tcp_retries2, |
| 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_fin_timeout", |
| 377 | .data = &sysctl_tcp_fin_timeout, |
| 378 | .maxlen = sizeof(int), |
| 379 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 380 | .proc_handler = proc_dointvec_jiffies, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 381 | }, |
| 382 | #ifdef CONFIG_SYN_COOKIES |
| 383 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 384 | .procname = "tcp_syncookies", |
| 385 | .data = &sysctl_tcp_syncookies, |
| 386 | .maxlen = sizeof(int), |
| 387 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 388 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 389 | }, |
| 390 | #endif |
| 391 | { |
Yuchung Cheng | 2100c8d | 2012-07-19 06:43:05 +0000 | [diff] [blame] | 392 | .procname = "tcp_fastopen", |
| 393 | .data = &sysctl_tcp_fastopen, |
| 394 | .maxlen = sizeof(int), |
| 395 | .mode = 0644, |
| 396 | .proc_handler = proc_dointvec, |
| 397 | }, |
| 398 | { |
Jerry Chu | 1046716 | 2012-08-31 12:29:11 +0000 | [diff] [blame] | 399 | .procname = "tcp_fastopen_key", |
| 400 | .mode = 0600, |
| 401 | .maxlen = ((TCP_FASTOPEN_KEY_LENGTH * 2) + 10), |
| 402 | .proc_handler = proc_tcp_fastopen_key, |
| 403 | }, |
| 404 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 405 | .procname = "tcp_tw_recycle", |
Arnaldo Carvalho de Melo | 295ff7e | 2005-08-09 20:44:40 -0700 | [diff] [blame] | 406 | .data = &tcp_death_row.sysctl_tw_recycle, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 407 | .maxlen = sizeof(int), |
| 408 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 409 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 410 | }, |
| 411 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 412 | .procname = "tcp_abort_on_overflow", |
| 413 | .data = &sysctl_tcp_abort_on_overflow, |
| 414 | .maxlen = sizeof(int), |
| 415 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 416 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 417 | }, |
| 418 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 419 | .procname = "tcp_stdurg", |
| 420 | .data = &sysctl_tcp_stdurg, |
| 421 | .maxlen = sizeof(int), |
| 422 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 423 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 424 | }, |
| 425 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 426 | .procname = "tcp_rfc1337", |
| 427 | .data = &sysctl_tcp_rfc1337, |
| 428 | .maxlen = sizeof(int), |
| 429 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 430 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 431 | }, |
| 432 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 433 | .procname = "tcp_max_syn_backlog", |
| 434 | .data = &sysctl_max_syn_backlog, |
| 435 | .maxlen = sizeof(int), |
| 436 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 437 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 438 | }, |
| 439 | { |
Amerigo Wang | e3826f1 | 2010-05-05 00:27:06 +0000 | [diff] [blame] | 440 | .procname = "ip_local_reserved_ports", |
| 441 | .data = NULL, /* initialized in sysctl_ipv4_init */ |
| 442 | .maxlen = 65536, |
| 443 | .mode = 0644, |
| 444 | .proc_handler = proc_do_large_bitmap, |
| 445 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 446 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 447 | .procname = "igmp_max_memberships", |
| 448 | .data = &sysctl_igmp_max_memberships, |
| 449 | .maxlen = sizeof(int), |
| 450 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 451 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 452 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 453 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 454 | .procname = "igmp_max_msf", |
| 455 | .data = &sysctl_igmp_max_msf, |
| 456 | .maxlen = sizeof(int), |
| 457 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 458 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 459 | }, |
| 460 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 461 | .procname = "inet_peer_threshold", |
| 462 | .data = &inet_peer_threshold, |
| 463 | .maxlen = sizeof(int), |
| 464 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 465 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 466 | }, |
| 467 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 468 | .procname = "inet_peer_minttl", |
| 469 | .data = &inet_peer_minttl, |
| 470 | .maxlen = sizeof(int), |
| 471 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 472 | .proc_handler = proc_dointvec_jiffies, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 473 | }, |
| 474 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 475 | .procname = "inet_peer_maxttl", |
| 476 | .data = &inet_peer_maxttl, |
| 477 | .maxlen = sizeof(int), |
| 478 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 479 | .proc_handler = proc_dointvec_jiffies, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 480 | }, |
| 481 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | .procname = "tcp_orphan_retries", |
| 483 | .data = &sysctl_tcp_orphan_retries, |
| 484 | .maxlen = sizeof(int), |
| 485 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 486 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 487 | }, |
| 488 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 489 | .procname = "tcp_fack", |
| 490 | .data = &sysctl_tcp_fack, |
| 491 | .maxlen = sizeof(int), |
| 492 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 493 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 494 | }, |
| 495 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 496 | .procname = "tcp_reordering", |
| 497 | .data = &sysctl_tcp_reordering, |
| 498 | .maxlen = sizeof(int), |
| 499 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 500 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 501 | }, |
| 502 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 503 | .procname = "tcp_dsack", |
| 504 | .data = &sysctl_tcp_dsack, |
| 505 | .maxlen = sizeof(int), |
| 506 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 507 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 508 | }, |
| 509 | { |
Eric W. Biederman | a4fe34b | 2013-10-19 16:25:36 -0700 | [diff] [blame] | 510 | .procname = "tcp_mem", |
| 511 | .maxlen = sizeof(sysctl_tcp_mem), |
| 512 | .data = &sysctl_tcp_mem, |
| 513 | .mode = 0644, |
| 514 | .proc_handler = proc_doulongvec_minmax, |
| 515 | }, |
| 516 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 517 | .procname = "tcp_wmem", |
| 518 | .data = &sysctl_tcp_wmem, |
| 519 | .maxlen = sizeof(sysctl_tcp_wmem), |
| 520 | .mode = 0644, |
bingtian.ly@taobao.com | cdda889 | 2013-01-23 20:35:28 +0000 | [diff] [blame] | 521 | .proc_handler = proc_dointvec_minmax, |
| 522 | .extra1 = &one, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 523 | }, |
| 524 | { |
Eric Dumazet | c9bee3b7 | 2013-07-22 20:27:07 -0700 | [diff] [blame] | 525 | .procname = "tcp_notsent_lowat", |
| 526 | .data = &sysctl_tcp_notsent_lowat, |
| 527 | .maxlen = sizeof(sysctl_tcp_notsent_lowat), |
| 528 | .mode = 0644, |
| 529 | .proc_handler = proc_dointvec, |
| 530 | }, |
| 531 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 532 | .procname = "tcp_rmem", |
| 533 | .data = &sysctl_tcp_rmem, |
| 534 | .maxlen = sizeof(sysctl_tcp_rmem), |
| 535 | .mode = 0644, |
bingtian.ly@taobao.com | cdda889 | 2013-01-23 20:35:28 +0000 | [diff] [blame] | 536 | .proc_handler = proc_dointvec_minmax, |
| 537 | .extra1 = &one, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 538 | }, |
| 539 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 540 | .procname = "tcp_app_win", |
| 541 | .data = &sysctl_tcp_app_win, |
| 542 | .maxlen = sizeof(int), |
| 543 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 544 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 545 | }, |
| 546 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 547 | .procname = "tcp_adv_win_scale", |
| 548 | .data = &sysctl_tcp_adv_win_scale, |
| 549 | .maxlen = sizeof(int), |
| 550 | .mode = 0644, |
Alexey Dobriyan | 0147fc0 | 2010-11-22 12:54:21 +0000 | [diff] [blame] | 551 | .proc_handler = proc_dointvec_minmax, |
| 552 | .extra1 = &tcp_adv_win_scale_min, |
| 553 | .extra2 = &tcp_adv_win_scale_max, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 554 | }, |
| 555 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 556 | .procname = "tcp_tw_reuse", |
| 557 | .data = &sysctl_tcp_tw_reuse, |
| 558 | .maxlen = sizeof(int), |
| 559 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 560 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 561 | }, |
| 562 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 563 | .procname = "tcp_frto", |
| 564 | .data = &sysctl_tcp_frto, |
| 565 | .maxlen = sizeof(int), |
| 566 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 567 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 568 | }, |
| 569 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 570 | .procname = "tcp_low_latency", |
| 571 | .data = &sysctl_tcp_low_latency, |
| 572 | .maxlen = sizeof(int), |
| 573 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 574 | .proc_handler = proc_dointvec |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 575 | }, |
| 576 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 577 | .procname = "tcp_no_metrics_save", |
| 578 | .data = &sysctl_tcp_nometrics_save, |
| 579 | .maxlen = sizeof(int), |
| 580 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 581 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 582 | }, |
| 583 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 584 | .procname = "tcp_moderate_rcvbuf", |
| 585 | .data = &sysctl_tcp_moderate_rcvbuf, |
| 586 | .maxlen = sizeof(int), |
| 587 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 588 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 589 | }, |
| 590 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 591 | .procname = "tcp_tso_win_divisor", |
| 592 | .data = &sysctl_tcp_tso_win_divisor, |
| 593 | .maxlen = sizeof(int), |
| 594 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 595 | .proc_handler = proc_dointvec, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 596 | }, |
| 597 | { |
Stephen Hemminger | 317a76f | 2005-06-23 12:19:55 -0700 | [diff] [blame] | 598 | .procname = "tcp_congestion_control", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 599 | .mode = 0644, |
Stephen Hemminger | 317a76f | 2005-06-23 12:19:55 -0700 | [diff] [blame] | 600 | .maxlen = TCP_CA_NAME_MAX, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 601 | .proc_handler = proc_tcp_congestion_control, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 602 | }, |
Stephen Hemminger | 9772efb | 2005-11-10 17:09:53 -0800 | [diff] [blame] | 603 | { |
John Heffner | 5d424d5 | 2006-03-20 17:53:41 -0800 | [diff] [blame] | 604 | .procname = "tcp_mtu_probing", |
| 605 | .data = &sysctl_tcp_mtu_probing, |
| 606 | .maxlen = sizeof(int), |
| 607 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 608 | .proc_handler = proc_dointvec, |
John Heffner | 5d424d5 | 2006-03-20 17:53:41 -0800 | [diff] [blame] | 609 | }, |
| 610 | { |
John Heffner | 5d424d5 | 2006-03-20 17:53:41 -0800 | [diff] [blame] | 611 | .procname = "tcp_base_mss", |
| 612 | .data = &sysctl_tcp_base_mss, |
| 613 | .maxlen = sizeof(int), |
| 614 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 615 | .proc_handler = proc_dointvec, |
John Heffner | 5d424d5 | 2006-03-20 17:53:41 -0800 | [diff] [blame] | 616 | }, |
YOSHIFUJI Hideaki | e905a9e | 2007-02-09 23:24:47 +0900 | [diff] [blame] | 617 | { |
Rick Jones | 15d99e0 | 2006-03-20 22:40:29 -0800 | [diff] [blame] | 618 | .procname = "tcp_workaround_signed_windows", |
| 619 | .data = &sysctl_tcp_workaround_signed_windows, |
| 620 | .maxlen = sizeof(int), |
| 621 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 622 | .proc_handler = proc_dointvec |
Rick Jones | 15d99e0 | 2006-03-20 22:40:29 -0800 | [diff] [blame] | 623 | }, |
Eric Dumazet | 46d3cea | 2012-07-11 05:50:31 +0000 | [diff] [blame] | 624 | { |
| 625 | .procname = "tcp_limit_output_bytes", |
| 626 | .data = &sysctl_tcp_limit_output_bytes, |
| 627 | .maxlen = sizeof(int), |
| 628 | .mode = 0644, |
| 629 | .proc_handler = proc_dointvec |
| 630 | }, |
Eric Dumazet | 282f23c | 2012-07-17 10:13:05 +0200 | [diff] [blame] | 631 | { |
| 632 | .procname = "tcp_challenge_ack_limit", |
| 633 | .data = &sysctl_tcp_challenge_ack_limit, |
| 634 | .maxlen = sizeof(int), |
| 635 | .mode = 0644, |
| 636 | .proc_handler = proc_dointvec |
| 637 | }, |
Chris Leech | 9593782 | 2006-05-23 18:02:55 -0700 | [diff] [blame] | 638 | #ifdef CONFIG_NET_DMA |
| 639 | { |
Chris Leech | 9593782 | 2006-05-23 18:02:55 -0700 | [diff] [blame] | 640 | .procname = "tcp_dma_copybreak", |
| 641 | .data = &sysctl_tcp_dma_copybreak, |
| 642 | .maxlen = sizeof(int), |
| 643 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 644 | .proc_handler = proc_dointvec |
Chris Leech | 9593782 | 2006-05-23 18:02:55 -0700 | [diff] [blame] | 645 | }, |
| 646 | #endif |
David S. Miller | 35089bb | 2006-06-13 22:33:04 -0700 | [diff] [blame] | 647 | { |
David S. Miller | 35089bb | 2006-06-13 22:33:04 -0700 | [diff] [blame] | 648 | .procname = "tcp_slow_start_after_idle", |
| 649 | .data = &sysctl_tcp_slow_start_after_idle, |
| 650 | .maxlen = sizeof(int), |
| 651 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 652 | .proc_handler = proc_dointvec |
David S. Miller | 35089bb | 2006-06-13 22:33:04 -0700 | [diff] [blame] | 653 | }, |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 654 | #ifdef CONFIG_NETLABEL |
| 655 | { |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 656 | .procname = "cipso_cache_enable", |
| 657 | .data = &cipso_v4_cache_enabled, |
| 658 | .maxlen = sizeof(int), |
| 659 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 660 | .proc_handler = proc_dointvec, |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 661 | }, |
| 662 | { |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 663 | .procname = "cipso_cache_bucket_size", |
| 664 | .data = &cipso_v4_cache_bucketsize, |
| 665 | .maxlen = sizeof(int), |
| 666 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 667 | .proc_handler = proc_dointvec, |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 668 | }, |
| 669 | { |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 670 | .procname = "cipso_rbm_optfmt", |
| 671 | .data = &cipso_v4_rbm_optfmt, |
| 672 | .maxlen = sizeof(int), |
| 673 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 674 | .proc_handler = proc_dointvec, |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 675 | }, |
| 676 | { |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 677 | .procname = "cipso_rbm_strictvalid", |
| 678 | .data = &cipso_v4_rbm_strictvalid, |
| 679 | .maxlen = sizeof(int), |
| 680 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 681 | .proc_handler = proc_dointvec, |
Paul Moore | 446fda4 | 2006-08-03 16:48:06 -0700 | [diff] [blame] | 682 | }, |
| 683 | #endif /* CONFIG_NETLABEL */ |
Stephen Hemminger | 3ff825b | 2006-11-09 16:32:06 -0800 | [diff] [blame] | 684 | { |
Stephen Hemminger | 3ff825b | 2006-11-09 16:32:06 -0800 | [diff] [blame] | 685 | .procname = "tcp_available_congestion_control", |
| 686 | .maxlen = TCP_CA_BUF_MAX, |
| 687 | .mode = 0444, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 688 | .proc_handler = proc_tcp_available_congestion_control, |
Stephen Hemminger | 3ff825b | 2006-11-09 16:32:06 -0800 | [diff] [blame] | 689 | }, |
Stephen Hemminger | ce7bc3b | 2006-11-09 16:35:15 -0800 | [diff] [blame] | 690 | { |
Stephen Hemminger | ce7bc3b | 2006-11-09 16:35:15 -0800 | [diff] [blame] | 691 | .procname = "tcp_allowed_congestion_control", |
| 692 | .maxlen = TCP_CA_BUF_MAX, |
| 693 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 694 | .proc_handler = proc_allowed_congestion_control, |
Stephen Hemminger | ce7bc3b | 2006-11-09 16:35:15 -0800 | [diff] [blame] | 695 | }, |
John Heffner | 886236c | 2007-03-25 19:21:45 -0700 | [diff] [blame] | 696 | { |
Andreas Petlund | 36e31b0a | 2010-02-18 02:47:01 +0000 | [diff] [blame] | 697 | .procname = "tcp_thin_linear_timeouts", |
| 698 | .data = &sysctl_tcp_thin_linear_timeouts, |
| 699 | .maxlen = sizeof(int), |
| 700 | .mode = 0644, |
| 701 | .proc_handler = proc_dointvec |
| 702 | }, |
Weilong Chen | 5797deb | 2013-12-23 14:37:31 +0800 | [diff] [blame] | 703 | { |
Andreas Petlund | 7e38017 | 2010-02-18 04:48:19 +0000 | [diff] [blame] | 704 | .procname = "tcp_thin_dupack", |
| 705 | .data = &sysctl_tcp_thin_dupack, |
| 706 | .maxlen = sizeof(int), |
| 707 | .mode = 0644, |
| 708 | .proc_handler = proc_dointvec |
| 709 | }, |
Andreas Petlund | 36e31b0a | 2010-02-18 02:47:01 +0000 | [diff] [blame] | 710 | { |
Yuchung Cheng | eed530b | 2012-05-02 13:30:03 +0000 | [diff] [blame] | 711 | .procname = "tcp_early_retrans", |
| 712 | .data = &sysctl_tcp_early_retrans, |
| 713 | .maxlen = sizeof(int), |
| 714 | .mode = 0644, |
| 715 | .proc_handler = proc_dointvec_minmax, |
| 716 | .extra1 = &zero, |
Nandita Dukkipati | 6ba8a3b | 2013-03-11 10:00:43 +0000 | [diff] [blame] | 717 | .extra2 = &four, |
Yuchung Cheng | eed530b | 2012-05-02 13:30:03 +0000 | [diff] [blame] | 718 | }, |
| 719 | { |
Eric Dumazet | 95bd09e | 2013-08-27 05:46:32 -0700 | [diff] [blame] | 720 | .procname = "tcp_min_tso_segs", |
| 721 | .data = &sysctl_tcp_min_tso_segs, |
| 722 | .maxlen = sizeof(int), |
| 723 | .mode = 0644, |
| 724 | .proc_handler = proc_dointvec_minmax, |
| 725 | .extra1 = &zero, |
| 726 | .extra2 = &gso_max_segs, |
| 727 | }, |
| 728 | { |
Eric Dumazet | f54b311 | 2013-12-05 22:36:05 -0800 | [diff] [blame] | 729 | .procname = "tcp_autocorking", |
| 730 | .data = &sysctl_tcp_autocorking, |
| 731 | .maxlen = sizeof(int), |
| 732 | .mode = 0644, |
| 733 | .proc_handler = proc_dointvec_minmax, |
| 734 | .extra1 = &zero, |
| 735 | .extra2 = &one, |
| 736 | }, |
| 737 | { |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 738 | .procname = "udp_mem", |
| 739 | .data = &sysctl_udp_mem, |
| 740 | .maxlen = sizeof(sysctl_udp_mem), |
| 741 | .mode = 0644, |
Eric Dumazet | 8d987e5 | 2010-11-09 23:24:26 +0000 | [diff] [blame] | 742 | .proc_handler = proc_doulongvec_minmax, |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 743 | }, |
| 744 | { |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 745 | .procname = "udp_rmem_min", |
| 746 | .data = &sysctl_udp_rmem_min, |
| 747 | .maxlen = sizeof(sysctl_udp_rmem_min), |
| 748 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 749 | .proc_handler = proc_dointvec_minmax, |
bingtian.ly@taobao.com | cdda889 | 2013-01-23 20:35:28 +0000 | [diff] [blame] | 750 | .extra1 = &one |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 751 | }, |
| 752 | { |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 753 | .procname = "udp_wmem_min", |
| 754 | .data = &sysctl_udp_wmem_min, |
| 755 | .maxlen = sizeof(sysctl_udp_wmem_min), |
| 756 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 757 | .proc_handler = proc_dointvec_minmax, |
bingtian.ly@taobao.com | cdda889 | 2013-01-23 20:35:28 +0000 | [diff] [blame] | 758 | .extra1 = &one |
Hideo Aoki | 95766ff | 2007-12-31 00:29:24 -0800 | [diff] [blame] | 759 | }, |
Eric W. Biederman | f8572d8 | 2009-11-05 13:32:03 -0800 | [diff] [blame] | 760 | { } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 761 | }; |
Pavel Emelyanov | 3e37c3f | 2007-12-05 01:41:26 -0800 | [diff] [blame] | 762 | |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 763 | static struct ctl_table ipv4_net_table[] = { |
| 764 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 765 | .procname = "icmp_echo_ignore_all", |
| 766 | .data = &init_net.ipv4.sysctl_icmp_echo_ignore_all, |
| 767 | .maxlen = sizeof(int), |
| 768 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 769 | .proc_handler = proc_dointvec |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 770 | }, |
| 771 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 772 | .procname = "icmp_echo_ignore_broadcasts", |
| 773 | .data = &init_net.ipv4.sysctl_icmp_echo_ignore_broadcasts, |
| 774 | .maxlen = sizeof(int), |
| 775 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 776 | .proc_handler = proc_dointvec |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 777 | }, |
| 778 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 779 | .procname = "icmp_ignore_bogus_error_responses", |
| 780 | .data = &init_net.ipv4.sysctl_icmp_ignore_bogus_error_responses, |
| 781 | .maxlen = sizeof(int), |
| 782 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 783 | .proc_handler = proc_dointvec |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 784 | }, |
| 785 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 786 | .procname = "icmp_errors_use_inbound_ifaddr", |
| 787 | .data = &init_net.ipv4.sysctl_icmp_errors_use_inbound_ifaddr, |
| 788 | .maxlen = sizeof(int), |
| 789 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 790 | .proc_handler = proc_dointvec |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 791 | }, |
| 792 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 793 | .procname = "icmp_ratelimit", |
| 794 | .data = &init_net.ipv4.sysctl_icmp_ratelimit, |
| 795 | .maxlen = sizeof(int), |
| 796 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 797 | .proc_handler = proc_dointvec_ms_jiffies, |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 798 | }, |
| 799 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 800 | .procname = "icmp_ratemask", |
| 801 | .data = &init_net.ipv4.sysctl_icmp_ratemask, |
| 802 | .maxlen = sizeof(int), |
| 803 | .mode = 0644, |
Alexey Dobriyan | 6d9f239 | 2008-11-03 18:21:05 -0800 | [diff] [blame] | 804 | .proc_handler = proc_dointvec |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 805 | }, |
Neil Horman | 1080d70 | 2008-10-27 12:28:25 -0700 | [diff] [blame] | 806 | { |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 807 | .procname = "ping_group_range", |
| 808 | .data = &init_net.ipv4.sysctl_ping_group_range, |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 809 | .maxlen = sizeof(gid_t)*2, |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 810 | .mode = 0644, |
| 811 | .proc_handler = ipv4_ping_group_range, |
| 812 | }, |
Glauber Costa | 3dc43e3 | 2011-12-11 21:47:05 +0000 | [diff] [blame] | 813 | { |
Hannes Frederic Sowa | 5d134f1 | 2013-01-05 16:10:48 +0000 | [diff] [blame] | 814 | .procname = "tcp_ecn", |
| 815 | .data = &init_net.ipv4.sysctl_tcp_ecn, |
| 816 | .maxlen = sizeof(int), |
| 817 | .mode = 0644, |
| 818 | .proc_handler = proc_dointvec |
| 819 | }, |
| 820 | { |
Eric W. Biederman | 0bbf87d | 2013-09-28 14:10:59 -0700 | [diff] [blame] | 821 | .procname = "ip_local_port_range", |
| 822 | .maxlen = sizeof(init_net.ipv4.sysctl_local_ports.range), |
| 823 | .data = &init_net.ipv4.sysctl_local_ports.range, |
| 824 | .mode = 0644, |
| 825 | .proc_handler = ipv4_local_port_range, |
| 826 | }, |
Hannes Frederic Sowa | 974eda1 | 2013-12-14 05:13:38 +0100 | [diff] [blame] | 827 | { |
| 828 | .procname = "ip_no_pmtu_disc", |
| 829 | .data = &init_net.ipv4.sysctl_ip_no_pmtu_disc, |
| 830 | .maxlen = sizeof(int), |
| 831 | .mode = 0644, |
| 832 | .proc_handler = proc_dointvec |
| 833 | }, |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 834 | { } |
| 835 | }; |
| 836 | |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 837 | static __net_init int ipv4_sysctl_init_net(struct net *net) |
| 838 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 839 | struct ctl_table *table; |
| 840 | |
| 841 | table = ipv4_net_table; |
Octavian Purdila | 09ad9bc | 2009-11-25 15:14:13 -0800 | [diff] [blame] | 842 | if (!net_eq(net, &init_net)) { |
Eric W. Biederman | 0a6fa23 | 2013-10-19 16:27:03 -0700 | [diff] [blame] | 843 | int i; |
| 844 | |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 845 | table = kmemdup(table, sizeof(ipv4_net_table), GFP_KERNEL); |
| 846 | if (table == NULL) |
| 847 | goto err_alloc; |
| 848 | |
Eric W. Biederman | 0a6fa23 | 2013-10-19 16:27:03 -0700 | [diff] [blame] | 849 | /* Update the variables to point into the current struct net */ |
| 850 | for (i = 0; i < ARRAY_SIZE(ipv4_net_table) - 1; i++) |
| 851 | table[i].data += (void *)net - (void *)&init_net; |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 852 | } |
| 853 | |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 854 | /* |
| 855 | * Sane defaults - nobody may create ping sockets. |
| 856 | * Boot scripts should set this to distro-specific group. |
| 857 | */ |
Eric W. Biederman | 7064d16 | 2012-05-24 10:34:21 -0600 | [diff] [blame] | 858 | net->ipv4.sysctl_ping_group_range[0] = make_kgid(&init_user_ns, 1); |
| 859 | net->ipv4.sysctl_ping_group_range[1] = make_kgid(&init_user_ns, 0); |
Vasiliy Kulikov | c319b4d | 2011-05-13 10:01:00 +0000 | [diff] [blame] | 860 | |
Eric W. Biederman | 0bbf87d | 2013-09-28 14:10:59 -0700 | [diff] [blame] | 861 | /* |
| 862 | * Set defaults for local port range |
| 863 | */ |
| 864 | seqlock_init(&net->ipv4.sysctl_local_ports.lock); |
| 865 | net->ipv4.sysctl_local_ports.range[0] = 32768; |
| 866 | net->ipv4.sysctl_local_ports.range[1] = 61000; |
| 867 | |
Eric W. Biederman | ec8f23c | 2012-04-19 13:44:49 +0000 | [diff] [blame] | 868 | net->ipv4.ipv4_hdr = register_net_sysctl(net, "net/ipv4", table); |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 869 | if (net->ipv4.ipv4_hdr == NULL) |
| 870 | goto err_reg; |
| 871 | |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 872 | return 0; |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 873 | |
| 874 | err_reg: |
Octavian Purdila | 09ad9bc | 2009-11-25 15:14:13 -0800 | [diff] [blame] | 875 | if (!net_eq(net, &init_net)) |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 876 | kfree(table); |
| 877 | err_alloc: |
| 878 | return -ENOMEM; |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 879 | } |
| 880 | |
| 881 | static __net_exit void ipv4_sysctl_exit_net(struct net *net) |
| 882 | { |
Pavel Emelyanov | 68528f0 | 2008-03-26 01:56:24 -0700 | [diff] [blame] | 883 | struct ctl_table *table; |
| 884 | |
| 885 | table = net->ipv4.ipv4_hdr->ctl_table_arg; |
| 886 | unregister_net_sysctl_table(net->ipv4.ipv4_hdr); |
| 887 | kfree(table); |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 888 | } |
| 889 | |
| 890 | static __net_initdata struct pernet_operations ipv4_sysctl_ops = { |
| 891 | .init = ipv4_sysctl_init_net, |
| 892 | .exit = ipv4_sysctl_exit_net, |
| 893 | }; |
| 894 | |
Pavel Emelyanov | 3e37c3f | 2007-12-05 01:41:26 -0800 | [diff] [blame] | 895 | static __init int sysctl_ipv4_init(void) |
| 896 | { |
| 897 | struct ctl_table_header *hdr; |
Amerigo Wang | e3826f1 | 2010-05-05 00:27:06 +0000 | [diff] [blame] | 898 | struct ctl_table *i; |
| 899 | |
| 900 | for (i = ipv4_table; i->procname; i++) { |
| 901 | if (strcmp(i->procname, "ip_local_reserved_ports") == 0) { |
| 902 | i->data = sysctl_local_reserved_ports; |
| 903 | break; |
| 904 | } |
| 905 | } |
| 906 | if (!i->procname) |
| 907 | return -EINVAL; |
Pavel Emelyanov | 3e37c3f | 2007-12-05 01:41:26 -0800 | [diff] [blame] | 908 | |
Eric W. Biederman | ec8f23c | 2012-04-19 13:44:49 +0000 | [diff] [blame] | 909 | hdr = register_net_sysctl(&init_net, "net/ipv4", ipv4_table); |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 910 | if (hdr == NULL) |
| 911 | return -ENOMEM; |
| 912 | |
| 913 | if (register_pernet_subsys(&ipv4_sysctl_ops)) { |
Eric W. Biederman | 5dd3df1 | 2012-04-19 13:24:33 +0000 | [diff] [blame] | 914 | unregister_net_sysctl_table(hdr); |
Pavel Emelyanov | 1577519 | 2008-03-26 01:54:18 -0700 | [diff] [blame] | 915 | return -ENOMEM; |
| 916 | } |
| 917 | |
| 918 | return 0; |
Pavel Emelyanov | 3e37c3f | 2007-12-05 01:41:26 -0800 | [diff] [blame] | 919 | } |
| 920 | |
| 921 | __initcall(sysctl_ipv4_init); |