blob: e98f473bab13cd9b8ff5cc3a62a75134dd84371a [file] [log] [blame]
Pavel Emelyanov8afd3512007-12-16 13:29:36 -08001/*
2 * ipv4 in net namespaces
3 */
4
5#ifndef __NETNS_IPV4_H__
6#define __NETNS_IPV4_H__
Denis V. Luneve4e49712008-01-10 03:27:51 -08007
Eric W. Biederman7064d162012-05-24 10:34:21 -06008#include <linux/uidgid.h>
Pavel Emelyanovac18e752008-01-22 06:02:14 -08009#include <net/inet_frag.h>
Alexander Duycka7e53532015-03-04 15:02:44 -080010#include <linux/rcupdate.h>
Pavel Emelyanovac18e752008-01-22 06:02:14 -080011
David S. Miller51c5d0c2012-07-10 00:49:14 -070012struct tcpm_hash_bucket;
Pavel Emelyanov752d14d2007-12-16 13:31:47 -080013struct ctl_table_header;
14struct ipv4_devconf;
Denis V. Luneve4e49712008-01-10 03:27:51 -080015struct fib_rules_ops;
Denis V. Luneve4aef8a2008-01-10 03:28:24 -080016struct hlist_head;
David S. Millerf4530fa2012-07-05 22:13:13 -070017struct fib_table;
Denis V. Lunev6bd48fc2008-01-10 03:28:55 -080018struct sock;
Eric W. Biederman0bbf87d2013-09-28 14:10:59 -070019struct local_ports {
20 seqlock_t lock;
21 int range[2];
Eric Dumazeted2dfd92015-05-27 11:34:37 -070022 bool warned;
Eric W. Biederman0bbf87d2013-09-28 14:10:59 -070023};
Pavel Emelyanov752d14d2007-12-16 13:31:47 -080024
Cong Wangba6b9182014-05-06 11:02:50 -070025struct ping_group_range {
26 seqlock_t lock;
27 kgid_t range[2];
28};
29
Haishuang Yan1946e672016-12-28 17:52:32 +080030struct inet_hashinfo;
31
32struct inet_timewait_death_row {
33 atomic_t tw_count;
34
35 struct inet_hashinfo *hashinfo ____cacheline_aligned_in_smp;
Haishuang Yan1946e672016-12-28 17:52:32 +080036 int sysctl_max_tw_buckets;
37};
38
Haishuang Yan43713842017-09-27 11:35:42 +080039struct tcp_fastopen_context;
40
Pavel Emelyanov8afd3512007-12-16 13:29:36 -080041struct netns_ipv4 {
Eric Dumazet2a75de02008-01-05 23:08:49 -080042#ifdef CONFIG_SYSCTL
Pavel Emelyanov752d14d2007-12-16 13:31:47 -080043 struct ctl_table_header *forw_hdr;
Pavel Emelyanove4a2d5c2008-01-22 06:08:36 -080044 struct ctl_table_header *frags_hdr;
Pavel Emelyanov68528f02008-03-26 01:56:24 -070045 struct ctl_table_header *ipv4_hdr;
Denis V. Lunev39a23e72008-07-05 19:02:33 -070046 struct ctl_table_header *route_hdr;
Michal Kubecek8d068872013-02-06 10:46:33 +010047 struct ctl_table_header *xfrm4_hdr;
Eric Dumazet2a75de02008-01-05 23:08:49 -080048#endif
Pavel Emelyanov752d14d2007-12-16 13:31:47 -080049 struct ipv4_devconf *devconf_all;
50 struct ipv4_devconf *devconf_dflt;
Denis V. Luneve4e49712008-01-10 03:27:51 -080051#ifdef CONFIG_IP_MULTIPLE_TABLES
52 struct fib_rules_ops *rules_ops;
David S. Millerf4530fa2012-07-05 22:13:13 -070053 bool fib_has_custom_rules;
Alexander Duycka7e53532015-03-04 15:02:44 -080054 struct fib_table __rcu *fib_main;
55 struct fib_table __rcu *fib_default;
David S. Millerf4530fa2012-07-05 22:13:13 -070056#endif
David S. Millera1f33162017-09-21 18:18:23 -070057 bool fib_has_custom_local_routes;
David S. Millerf4530fa2012-07-05 22:13:13 -070058#ifdef CONFIG_IP_ROUTE_CLASSID
59 int fib_num_tclassid_users;
Denis V. Luneve4e49712008-01-10 03:27:51 -080060#endif
Denis V. Luneve4aef8a2008-01-10 03:28:24 -080061 struct hlist_head *fib_table_hash;
Scott Feldman448b1282015-03-05 21:21:18 -080062 bool fib_offload_disabled;
Denis V. Lunev6bd48fc2008-01-10 03:28:55 -080063 struct sock *fibnl;
Pavel Emelyanovac18e752008-01-22 06:02:14 -080064
Eric Dumazet349c9e32015-01-29 15:58:09 -080065 struct sock * __percpu *icmp_sk;
Madhu Challa93a714d2015-02-25 09:58:35 -080066 struct sock *mc_autojoin_sk;
Eric Dumazet349c9e32015-01-29 15:58:09 -080067
Gao fengc8a627e2012-06-08 01:20:41 +000068 struct inet_peer_base *peers;
Eric Dumazetbdbbb852015-01-29 21:35:05 -080069 struct sock * __percpu *tcp_sk;
Pavel Emelyanovac18e752008-01-22 06:02:14 -080070 struct netns_frags frags;
Alexey Dobriyan9335f042008-01-31 04:03:23 -080071#ifdef CONFIG_NETFILTER
72 struct xt_table *iptable_filter;
73 struct xt_table *iptable_mangle;
74 struct xt_table *iptable_raw;
Alexey Dobriyan9ea0cb22008-01-31 04:05:09 -080075 struct xt_table *arptable_filter;
Alexey Dobriyane9d38972010-01-18 08:08:37 +010076#ifdef CONFIG_SECURITY
James Morris560ee652008-06-09 15:57:24 -070077 struct xt_table *iptable_security;
Alexey Dobriyane9d38972010-01-18 08:08:37 +010078#endif
Alexey Dobriyane099a172008-10-08 11:35:10 +020079 struct xt_table *nat_table;
Alexey Dobriyan9335f042008-01-31 04:03:23 -080080#endif
Pavel Emelyanova24022e2008-03-26 01:55:37 -070081
82 int sysctl_icmp_echo_ignore_all;
83 int sysctl_icmp_echo_ignore_broadcasts;
84 int sysctl_icmp_ignore_bogus_error_responses;
85 int sysctl_icmp_ratelimit;
86 int sysctl_icmp_ratemask;
87 int sysctl_icmp_errors_use_inbound_ifaddr;
Denis V. Lunev9f5e97e2008-07-05 19:02:59 -070088
Cong Wangc9d8f1a2014-05-06 11:02:49 -070089 struct local_ports ip_local_ports;
Eric W. Biederman0bbf87d2013-09-28 14:10:59 -070090
Hannes Frederic Sowa5d134f12013-01-05 16:10:48 +000091 int sysctl_tcp_ecn;
Daniel Borkmann49213552015-05-19 21:04:22 +020092 int sysctl_tcp_ecn_fallback;
93
Nikolay Borisovfa50d972016-02-15 12:11:27 +020094 int sysctl_ip_default_ttl;
Hannes Frederic Sowa974eda12013-12-14 05:13:38 +010095 int sysctl_ip_no_pmtu_disc;
Hannes Frederic Sowaf87c10a2014-01-09 10:01:15 +010096 int sysctl_ip_fwd_use_pmtu;
Vincent Bernat49a60152014-09-05 15:09:03 +020097 int sysctl_ip_nonlocal_bind;
Nikolay Borisov287b7f32016-02-15 12:11:29 +020098 /* Shall we try to damage output packets if routing dev changes? */
99 int sysctl_ip_dynaddr;
Nikolay Borisove21145a2016-02-15 12:11:30 +0200100 int sysctl_ip_early_demux;
subashab@codeaurora.orgdddb64b2017-03-23 13:34:16 -0600101 int sysctl_tcp_early_demux;
102 int sysctl_udp_early_demux;
Hannes Frederic Sowa5d134f12013-01-05 16:10:48 +0000103
Lorenzo Colittie1108612014-05-13 10:17:33 -0700104 int sysctl_fwmark_reflect;
Lorenzo Colitti84f39b02014-05-13 10:17:35 -0700105 int sysctl_tcp_fwmark_accept;
David Ahern6dd9a142015-12-16 13:20:44 -0800106#ifdef CONFIG_NET_L3_MASTER_DEV
107 int sysctl_tcp_l3mdev_accept;
108#endif
Fan Dub0f9ca52015-02-10 09:53:16 +0800109 int sysctl_tcp_mtu_probing;
110 int sysctl_tcp_base_mss;
Fan Du6b58e0a2015-03-06 11:18:23 +0800111 int sysctl_tcp_probe_threshold;
Fan Du05cbc0d2015-03-06 11:18:24 +0800112 u32 sysctl_tcp_probe_interval;
Lorenzo Colittie1108612014-05-13 10:17:33 -0700113
Nikolay Borisov13b287e2016-01-07 16:38:43 +0200114 int sysctl_tcp_keepalive_time;
Nikolay Borisov9bd68612016-01-07 16:38:44 +0200115 int sysctl_tcp_keepalive_probes;
Nikolay Borisovb840d152016-01-07 16:38:45 +0200116 int sysctl_tcp_keepalive_intvl;
Nikolay Borisov13b287e2016-01-07 16:38:43 +0200117
Nikolay Borisov6fa25162016-02-03 09:46:49 +0200118 int sysctl_tcp_syn_retries;
Nikolay Borisov7c083ec2016-02-03 09:46:50 +0200119 int sysctl_tcp_synack_retries;
Nikolay Borisov12ed8242016-02-03 09:46:51 +0200120 int sysctl_tcp_syncookies;
Nikolay Borisov1043e252016-02-03 09:46:52 +0200121 int sysctl_tcp_reordering;
Nikolay Borisovae5c3f42016-02-03 09:46:53 +0200122 int sysctl_tcp_retries1;
Nikolay Borisovc6214a92016-02-03 09:46:54 +0200123 int sysctl_tcp_retries2;
Nikolay Borisovc402d9b2016-02-03 09:46:55 +0200124 int sysctl_tcp_orphan_retries;
Nikolay Borisov1e579ca2016-02-03 09:46:56 +0200125 int sysctl_tcp_fin_timeout;
Nikolay Borisov4979f2d2016-02-03 09:46:57 +0200126 unsigned int sysctl_tcp_notsent_lowat;
Haishuang Yan56ab6b92016-12-25 14:33:16 +0800127 int sysctl_tcp_tw_reuse;
Eric Dumazetf9301032017-06-07 10:34:37 -0700128 int sysctl_tcp_sack;
Eric Dumazet9bb37ef2017-06-07 10:34:38 -0700129 int sysctl_tcp_window_scaling;
Eric Dumazet5d2ed052017-06-07 10:34:39 -0700130 int sysctl_tcp_timestamps;
Eric Dumazet2ae21cf2017-10-26 21:54:56 -0700131 int sysctl_tcp_early_retrans;
Eric Dumazete20223f2017-10-26 21:54:57 -0700132 int sysctl_tcp_recovery;
Eric Dumazet2c04ac82017-10-26 21:54:58 -0700133 int sysctl_tcp_thin_linear_timeouts;
Eric Dumazetb510f0d2017-10-26 21:54:59 -0700134 int sysctl_tcp_slow_start_after_idle;
Eric Dumazete0a1e5b2017-10-26 21:55:00 -0700135 int sysctl_tcp_retrans_collapse;
Eric Dumazet3f4c7c62017-10-26 21:55:01 -0700136 int sysctl_tcp_stdurg;
Eric Dumazet625357a2017-10-26 21:55:02 -0700137 int sysctl_tcp_rfc1337;
Eric Dumazet65c94102017-10-26 21:55:03 -0700138 int sysctl_tcp_abort_on_overflow;
Eric Dumazet0bc65a22017-10-26 21:55:04 -0700139 int sysctl_tcp_fack;
Eric Dumazetc6e21802017-10-26 21:55:06 -0700140 int sysctl_tcp_max_reordering;
Eric Dumazet6496f6b2017-10-26 21:55:07 -0700141 int sysctl_tcp_dsack;
Eric Dumazet0c126542017-10-26 21:55:08 -0700142 int sysctl_tcp_app_win;
Eric Dumazet94f08932017-10-26 21:55:09 -0700143 int sysctl_tcp_adv_win_scale;
Eric Dumazetaf9b69a2017-10-26 21:55:10 -0700144 int sysctl_tcp_frto;
Eric Dumazetec36e412017-10-27 07:47:21 -0700145 int sysctl_tcp_nometrics_save;
Eric Dumazet4540c0c2017-10-27 07:47:22 -0700146 int sysctl_tcp_moderate_rcvbuf;
Eric Dumazetd06a9902017-10-27 07:47:23 -0700147 int sysctl_tcp_tso_win_divisor;
Eric Dumazetceef9ab2017-10-27 07:47:24 -0700148 int sysctl_tcp_workaround_signed_windows;
Eric Dumazet9184d8b2017-10-27 07:47:25 -0700149 int sysctl_tcp_limit_output_bytes;
Haishuang Yan1946e672016-12-28 17:52:32 +0800150 struct inet_timewait_death_row tcp_death_row;
Haishuang Yanfee83d02016-12-28 17:52:33 +0800151 int sysctl_max_syn_backlog;
Haishuang Yane1cfcbe2017-09-27 11:35:40 +0800152 int sysctl_tcp_fastopen;
Haishuang Yan43713842017-09-27 11:35:42 +0800153 struct tcp_fastopen_context __rcu *tcp_fastopen_ctx;
154 spinlock_t tcp_fastopen_ctx_lock;
Haishuang Yan3733be12017-09-27 11:35:43 +0800155 unsigned int sysctl_tcp_fastopen_blackhole_timeout;
156 atomic_t tfo_active_disable_times;
157 unsigned long tfo_active_disable_stamp;
Nikolay Borisov12ed8242016-02-03 09:46:51 +0200158
Robert Shearman63a6fff2017-01-26 18:02:24 +0000159#ifdef CONFIG_NET_L3_MASTER_DEV
160 int sysctl_udp_l3mdev_accept;
161#endif
162
Nikolay Borisov815c5272016-02-08 23:29:21 +0200163 int sysctl_igmp_max_memberships;
Nikolay Borisov166b6b22016-02-08 23:29:22 +0200164 int sysctl_igmp_max_msf;
Nikolay Borisov87a8a2a2016-02-09 00:13:50 +0200165 int sysctl_igmp_llm_reports;
Nikolay Borisov165094a2016-02-08 23:29:24 +0200166 int sysctl_igmp_qrv;
Nikolay Borisov815c5272016-02-08 23:29:21 +0200167
Cong Wangba6b9182014-05-06 11:02:50 -0700168 struct ping_group_range ping_group_range;
Vasiliy Kulikovc319b4d2011-05-13 10:01:00 +0000169
David S. Miller436c3b62011-03-24 17:42:21 -0700170 atomic_t dev_addr_genid;
Benjamin Thery70a269e2009-01-22 04:56:15 +0000171
WANG Cong122ff242014-05-12 16:04:53 -0700172#ifdef CONFIG_SYSCTL
173 unsigned long *sysctl_local_reserved_ports;
Krister Johansen4548b682017-01-20 17:49:11 -0800174 int sysctl_ip_prot_sock;
WANG Cong122ff242014-05-12 16:04:53 -0700175#endif
176
Benjamin Thery70a269e2009-01-22 04:56:15 +0000177#ifdef CONFIG_IP_MROUTE
Patrick McHardyf0ad0862010-04-13 05:03:23 +0000178#ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES
Patrick McHardy0c122952010-04-13 05:03:22 +0000179 struct mr_table *mrt;
Patrick McHardyf0ad0862010-04-13 05:03:23 +0000180#else
181 struct list_head mr_tables;
182 struct fib_rules_ops *mr_rules_ops;
183#endif
Benjamin Thery70a269e2009-01-22 04:56:15 +0000184#endif
David Aherna6db4492016-04-07 07:21:00 -0700185#ifdef CONFIG_IP_ROUTE_MULTIPATH
186 int sysctl_fib_multipath_use_neigh;
Nikolay Aleksandrovbf4e0a32017-03-16 15:28:00 +0200187 int sysctl_fib_multipath_hash_policy;
David Aherna6db4492016-04-07 07:21:00 -0700188#endif
Ido Schimmelcacaad12016-12-03 16:45:06 +0100189
Ido Schimmel04b1d4e2017-08-03 13:28:11 +0200190 struct fib_notifier_ops *notifier_ops;
Ido Schimmelcacaad12016-12-03 16:45:06 +0100191 unsigned int fib_seq; /* protected by rtnl_mutex */
192
Yotam Gigi4d65b942017-09-27 08:23:13 +0200193 struct fib_notifier_ops *ipmr_notifier_ops;
194 unsigned int ipmr_seq; /* protected by rtnl_mutex */
195
fan.duca4c3fc2013-07-30 08:33:53 +0800196 atomic_t rt_genid;
Pavel Emelyanov8afd3512007-12-16 13:29:36 -0800197};
198#endif