blob: 44668c29701a72a5116781d4b76267c0068f1143 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Pavel Emelyanov8afd3512007-12-16 13:29:36 -08002/*
3 * ipv4 in net namespaces
4 */
5
6#ifndef __NETNS_IPV4_H__
7#define __NETNS_IPV4_H__
Denis V. Luneve4e49712008-01-10 03:27:51 -08008
Eric W. Biederman7064d162012-05-24 10:34:21 -06009#include <linux/uidgid.h>
Pavel Emelyanovac18e752008-01-22 06:02:14 -080010#include <net/inet_frag.h>
Alexander Duycka7e53532015-03-04 15:02:44 -080011#include <linux/rcupdate.h>
Pavel Emelyanovac18e752008-01-22 06:02:14 -080012
David S. Miller51c5d0c2012-07-10 00:49:14 -070013struct tcpm_hash_bucket;
Pavel Emelyanov752d14d2007-12-16 13:31:47 -080014struct ctl_table_header;
15struct ipv4_devconf;
Denis V. Luneve4e49712008-01-10 03:27:51 -080016struct fib_rules_ops;
Denis V. Luneve4aef8a2008-01-10 03:28:24 -080017struct hlist_head;
David S. Millerf4530fa2012-07-05 22:13:13 -070018struct fib_table;
Denis V. Lunev6bd48fc2008-01-10 03:28:55 -080019struct sock;
Eric W. Biederman0bbf87d2013-09-28 14:10:59 -070020struct local_ports {
21 seqlock_t lock;
22 int range[2];
Eric Dumazeted2dfd92015-05-27 11:34:37 -070023 bool warned;
Eric W. Biederman0bbf87d2013-09-28 14:10:59 -070024};
Pavel Emelyanov752d14d2007-12-16 13:31:47 -080025
Cong Wangba6b9182014-05-06 11:02:50 -070026struct ping_group_range {
27 seqlock_t lock;
28 kgid_t range[2];
29};
30
Haishuang Yan1946e672016-12-28 17:52:32 +080031struct inet_hashinfo;
32
33struct inet_timewait_death_row {
34 atomic_t tw_count;
35
36 struct inet_hashinfo *hashinfo ____cacheline_aligned_in_smp;
Haishuang Yan1946e672016-12-28 17:52:32 +080037 int sysctl_max_tw_buckets;
38};
39
Haishuang Yan43713842017-09-27 11:35:42 +080040struct tcp_fastopen_context;
41
Pavel Emelyanov8afd3512007-12-16 13:29:36 -080042struct netns_ipv4 {
Eric Dumazet2a75de02008-01-05 23:08:49 -080043#ifdef CONFIG_SYSCTL
Pavel Emelyanov752d14d2007-12-16 13:31:47 -080044 struct ctl_table_header *forw_hdr;
Pavel Emelyanove4a2d5c2008-01-22 06:08:36 -080045 struct ctl_table_header *frags_hdr;
Pavel Emelyanov68528f02008-03-26 01:56:24 -070046 struct ctl_table_header *ipv4_hdr;
Denis V. Lunev39a23e72008-07-05 19:02:33 -070047 struct ctl_table_header *route_hdr;
Michal Kubecek8d068872013-02-06 10:46:33 +010048 struct ctl_table_header *xfrm4_hdr;
Eric Dumazet2a75de02008-01-05 23:08:49 -080049#endif
Pavel Emelyanov752d14d2007-12-16 13:31:47 -080050 struct ipv4_devconf *devconf_all;
51 struct ipv4_devconf *devconf_dflt;
Denis V. Luneve4e49712008-01-10 03:27:51 -080052#ifdef CONFIG_IP_MULTIPLE_TABLES
53 struct fib_rules_ops *rules_ops;
David S. Millerf4530fa2012-07-05 22:13:13 -070054 bool fib_has_custom_rules;
Alexander Duycka7e53532015-03-04 15:02:44 -080055 struct fib_table __rcu *fib_main;
56 struct fib_table __rcu *fib_default;
David S. Millerf4530fa2012-07-05 22:13:13 -070057#endif
David S. Millera1f33162017-09-21 18:18:23 -070058 bool fib_has_custom_local_routes;
David S. Millerf4530fa2012-07-05 22:13:13 -070059#ifdef CONFIG_IP_ROUTE_CLASSID
60 int fib_num_tclassid_users;
Denis V. Luneve4e49712008-01-10 03:27:51 -080061#endif
Denis V. Luneve4aef8a2008-01-10 03:28:24 -080062 struct hlist_head *fib_table_hash;
Scott Feldman448b1282015-03-05 21:21:18 -080063 bool fib_offload_disabled;
Denis V. Lunev6bd48fc2008-01-10 03:28:55 -080064 struct sock *fibnl;
Pavel Emelyanovac18e752008-01-22 06:02:14 -080065
Eric Dumazet349c9e32015-01-29 15:58:09 -080066 struct sock * __percpu *icmp_sk;
Madhu Challa93a714d2015-02-25 09:58:35 -080067 struct sock *mc_autojoin_sk;
Eric Dumazet349c9e32015-01-29 15:58:09 -080068
Gao fengc8a627e2012-06-08 01:20:41 +000069 struct inet_peer_base *peers;
Eric Dumazetbdbbb852015-01-29 21:35:05 -080070 struct sock * __percpu *tcp_sk;
Pavel Emelyanovac18e752008-01-22 06:02:14 -080071 struct netns_frags frags;
Alexey Dobriyan9335f042008-01-31 04:03:23 -080072#ifdef CONFIG_NETFILTER
73 struct xt_table *iptable_filter;
74 struct xt_table *iptable_mangle;
75 struct xt_table *iptable_raw;
Alexey Dobriyan9ea0cb22008-01-31 04:05:09 -080076 struct xt_table *arptable_filter;
Alexey Dobriyane9d38972010-01-18 08:08:37 +010077#ifdef CONFIG_SECURITY
James Morris560ee652008-06-09 15:57:24 -070078 struct xt_table *iptable_security;
Alexey Dobriyane9d38972010-01-18 08:08:37 +010079#endif
Alexey Dobriyane099a172008-10-08 11:35:10 +020080 struct xt_table *nat_table;
Alexey Dobriyan9335f042008-01-31 04:03:23 -080081#endif
Pavel Emelyanova24022e2008-03-26 01:55:37 -070082
83 int sysctl_icmp_echo_ignore_all;
84 int sysctl_icmp_echo_ignore_broadcasts;
85 int sysctl_icmp_ignore_bogus_error_responses;
86 int sysctl_icmp_ratelimit;
87 int sysctl_icmp_ratemask;
88 int sysctl_icmp_errors_use_inbound_ifaddr;
Denis V. Lunev9f5e97e2008-07-05 19:02:59 -070089
Cong Wangc9d8f1a2014-05-06 11:02:49 -070090 struct local_ports ip_local_ports;
Eric W. Biederman0bbf87d2013-09-28 14:10:59 -070091
Hannes Frederic Sowa5d134f12013-01-05 16:10:48 +000092 int sysctl_tcp_ecn;
Daniel Borkmann49213552015-05-19 21:04:22 +020093 int sysctl_tcp_ecn_fallback;
94
Nikolay Borisovfa50d972016-02-15 12:11:27 +020095 int sysctl_ip_default_ttl;
Hannes Frederic Sowa974eda12013-12-14 05:13:38 +010096 int sysctl_ip_no_pmtu_disc;
Hannes Frederic Sowaf87c10a2014-01-09 10:01:15 +010097 int sysctl_ip_fwd_use_pmtu;
Vincent Bernat49a60152014-09-05 15:09:03 +020098 int sysctl_ip_nonlocal_bind;
Nikolay Borisov287b7f32016-02-15 12:11:29 +020099 /* Shall we try to damage output packets if routing dev changes? */
100 int sysctl_ip_dynaddr;
Nikolay Borisove21145a2016-02-15 12:11:30 +0200101 int sysctl_ip_early_demux;
subashab@codeaurora.orgdddb64b2017-03-23 13:34:16 -0600102 int sysctl_tcp_early_demux;
103 int sysctl_udp_early_demux;
Hannes Frederic Sowa5d134f12013-01-05 16:10:48 +0000104
Lorenzo Colittie1108612014-05-13 10:17:33 -0700105 int sysctl_fwmark_reflect;
Lorenzo Colitti84f39b02014-05-13 10:17:35 -0700106 int sysctl_tcp_fwmark_accept;
David Ahern6dd9a142015-12-16 13:20:44 -0800107#ifdef CONFIG_NET_L3_MASTER_DEV
108 int sysctl_tcp_l3mdev_accept;
109#endif
Fan Dub0f9ca52015-02-10 09:53:16 +0800110 int sysctl_tcp_mtu_probing;
111 int sysctl_tcp_base_mss;
Fan Du6b58e0a2015-03-06 11:18:23 +0800112 int sysctl_tcp_probe_threshold;
Fan Du05cbc0d2015-03-06 11:18:24 +0800113 u32 sysctl_tcp_probe_interval;
Lorenzo Colittie1108612014-05-13 10:17:33 -0700114
Nikolay Borisov13b287e2016-01-07 16:38:43 +0200115 int sysctl_tcp_keepalive_time;
Nikolay Borisov9bd68612016-01-07 16:38:44 +0200116 int sysctl_tcp_keepalive_probes;
Nikolay Borisovb840d152016-01-07 16:38:45 +0200117 int sysctl_tcp_keepalive_intvl;
Nikolay Borisov13b287e2016-01-07 16:38:43 +0200118
Nikolay Borisov6fa25162016-02-03 09:46:49 +0200119 int sysctl_tcp_syn_retries;
Nikolay Borisov7c083ec2016-02-03 09:46:50 +0200120 int sysctl_tcp_synack_retries;
Nikolay Borisov12ed8242016-02-03 09:46:51 +0200121 int sysctl_tcp_syncookies;
Nikolay Borisov1043e252016-02-03 09:46:52 +0200122 int sysctl_tcp_reordering;
Nikolay Borisovae5c3f42016-02-03 09:46:53 +0200123 int sysctl_tcp_retries1;
Nikolay Borisovc6214a92016-02-03 09:46:54 +0200124 int sysctl_tcp_retries2;
Nikolay Borisovc402d9b2016-02-03 09:46:55 +0200125 int sysctl_tcp_orphan_retries;
Nikolay Borisov1e579ca2016-02-03 09:46:56 +0200126 int sysctl_tcp_fin_timeout;
Nikolay Borisov4979f2d2016-02-03 09:46:57 +0200127 unsigned int sysctl_tcp_notsent_lowat;
Haishuang Yan56ab6b92016-12-25 14:33:16 +0800128 int sysctl_tcp_tw_reuse;
Eric Dumazetf9301032017-06-07 10:34:37 -0700129 int sysctl_tcp_sack;
Eric Dumazet9bb37ef2017-06-07 10:34:38 -0700130 int sysctl_tcp_window_scaling;
Eric Dumazet5d2ed052017-06-07 10:34:39 -0700131 int sysctl_tcp_timestamps;
Eric Dumazet2ae21cf2017-10-26 21:54:56 -0700132 int sysctl_tcp_early_retrans;
Eric Dumazete20223f2017-10-26 21:54:57 -0700133 int sysctl_tcp_recovery;
Eric Dumazet2c04ac82017-10-26 21:54:58 -0700134 int sysctl_tcp_thin_linear_timeouts;
Eric Dumazetb510f0d2017-10-26 21:54:59 -0700135 int sysctl_tcp_slow_start_after_idle;
Eric Dumazete0a1e5b2017-10-26 21:55:00 -0700136 int sysctl_tcp_retrans_collapse;
Eric Dumazet3f4c7c62017-10-26 21:55:01 -0700137 int sysctl_tcp_stdurg;
Eric Dumazet625357a2017-10-26 21:55:02 -0700138 int sysctl_tcp_rfc1337;
Eric Dumazet65c94102017-10-26 21:55:03 -0700139 int sysctl_tcp_abort_on_overflow;
Eric Dumazet0bc65a22017-10-26 21:55:04 -0700140 int sysctl_tcp_fack;
Eric Dumazetc6e21802017-10-26 21:55:06 -0700141 int sysctl_tcp_max_reordering;
Eric Dumazet6496f6b2017-10-26 21:55:07 -0700142 int sysctl_tcp_dsack;
Eric Dumazet0c126542017-10-26 21:55:08 -0700143 int sysctl_tcp_app_win;
Eric Dumazet94f08932017-10-26 21:55:09 -0700144 int sysctl_tcp_adv_win_scale;
Eric Dumazetaf9b69a2017-10-26 21:55:10 -0700145 int sysctl_tcp_frto;
Eric Dumazetec36e412017-10-27 07:47:21 -0700146 int sysctl_tcp_nometrics_save;
Eric Dumazet4540c0c2017-10-27 07:47:22 -0700147 int sysctl_tcp_moderate_rcvbuf;
Eric Dumazetd06a9902017-10-27 07:47:23 -0700148 int sysctl_tcp_tso_win_divisor;
Eric Dumazetceef9ab2017-10-27 07:47:24 -0700149 int sysctl_tcp_workaround_signed_windows;
Eric Dumazet9184d8b2017-10-27 07:47:25 -0700150 int sysctl_tcp_limit_output_bytes;
Eric Dumazetb530b682017-10-27 07:47:26 -0700151 int sysctl_tcp_challenge_ack_limit;
Eric Dumazet26e95962017-10-27 07:47:27 -0700152 int sysctl_tcp_min_tso_segs;
Eric Dumazetbd239702017-10-27 07:47:28 -0700153 int sysctl_tcp_min_rtt_wlen;
Eric Dumazet790f00e2017-10-27 07:47:29 -0700154 int sysctl_tcp_autocorking;
Eric Dumazet4170ba62017-10-27 07:47:30 -0700155 int sysctl_tcp_invalid_ratelimit;
Eric Dumazet23a7102a2017-10-27 07:47:31 -0700156 int sysctl_tcp_pacing_ss_ratio;
Eric Dumazetc26e91f2017-10-27 07:47:32 -0700157 int sysctl_tcp_pacing_ca_ratio;
Eric Dumazet356d1832017-11-07 00:29:28 -0800158 int sysctl_tcp_wmem[3];
159 int sysctl_tcp_rmem[3];
Haishuang Yan1946e672016-12-28 17:52:32 +0800160 struct inet_timewait_death_row tcp_death_row;
Haishuang Yanfee83d02016-12-28 17:52:33 +0800161 int sysctl_max_syn_backlog;
Haishuang Yane1cfcbe2017-09-27 11:35:40 +0800162 int sysctl_tcp_fastopen;
Stephen Hemminger6670e152017-11-14 08:25:49 -0800163 const struct tcp_congestion_ops __rcu *tcp_congestion_control;
Haishuang Yan43713842017-09-27 11:35:42 +0800164 struct tcp_fastopen_context __rcu *tcp_fastopen_ctx;
165 spinlock_t tcp_fastopen_ctx_lock;
Haishuang Yan3733be12017-09-27 11:35:43 +0800166 unsigned int sysctl_tcp_fastopen_blackhole_timeout;
167 atomic_t tfo_active_disable_times;
168 unsigned long tfo_active_disable_stamp;
Nikolay Borisov12ed8242016-02-03 09:46:51 +0200169
Robert Shearman63a6fff2017-01-26 18:02:24 +0000170#ifdef CONFIG_NET_L3_MASTER_DEV
171 int sysctl_udp_l3mdev_accept;
172#endif
173
Nikolay Borisov815c5272016-02-08 23:29:21 +0200174 int sysctl_igmp_max_memberships;
Nikolay Borisov166b6b22016-02-08 23:29:22 +0200175 int sysctl_igmp_max_msf;
Nikolay Borisov87a8a2a2016-02-09 00:13:50 +0200176 int sysctl_igmp_llm_reports;
Nikolay Borisov165094a2016-02-08 23:29:24 +0200177 int sysctl_igmp_qrv;
Nikolay Borisov815c5272016-02-08 23:29:21 +0200178
Cong Wangba6b9182014-05-06 11:02:50 -0700179 struct ping_group_range ping_group_range;
Vasiliy Kulikovc319b4d2011-05-13 10:01:00 +0000180
David S. Miller436c3b62011-03-24 17:42:21 -0700181 atomic_t dev_addr_genid;
Benjamin Thery70a269e2009-01-22 04:56:15 +0000182
WANG Cong122ff242014-05-12 16:04:53 -0700183#ifdef CONFIG_SYSCTL
184 unsigned long *sysctl_local_reserved_ports;
Krister Johansen4548b682017-01-20 17:49:11 -0800185 int sysctl_ip_prot_sock;
WANG Cong122ff242014-05-12 16:04:53 -0700186#endif
187
Benjamin Thery70a269e2009-01-22 04:56:15 +0000188#ifdef CONFIG_IP_MROUTE
Patrick McHardyf0ad0862010-04-13 05:03:23 +0000189#ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES
Patrick McHardy0c122952010-04-13 05:03:22 +0000190 struct mr_table *mrt;
Patrick McHardyf0ad0862010-04-13 05:03:23 +0000191#else
192 struct list_head mr_tables;
193 struct fib_rules_ops *mr_rules_ops;
194#endif
Benjamin Thery70a269e2009-01-22 04:56:15 +0000195#endif
David Aherna6db4492016-04-07 07:21:00 -0700196#ifdef CONFIG_IP_ROUTE_MULTIPATH
197 int sysctl_fib_multipath_use_neigh;
Nikolay Aleksandrovbf4e0a32017-03-16 15:28:00 +0200198 int sysctl_fib_multipath_hash_policy;
David Aherna6db4492016-04-07 07:21:00 -0700199#endif
Ido Schimmelcacaad12016-12-03 16:45:06 +0100200
Ido Schimmel04b1d4e2017-08-03 13:28:11 +0200201 struct fib_notifier_ops *notifier_ops;
Ido Schimmelcacaad12016-12-03 16:45:06 +0100202 unsigned int fib_seq; /* protected by rtnl_mutex */
203
Yotam Gigi4d65b942017-09-27 08:23:13 +0200204 struct fib_notifier_ops *ipmr_notifier_ops;
205 unsigned int ipmr_seq; /* protected by rtnl_mutex */
206
fan.duca4c3fc2013-07-30 08:33:53 +0800207 atomic_t rt_genid;
Pavel Emelyanov8afd3512007-12-16 13:29:36 -0800208};
209#endif