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