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