xref: /linux/include/net/netns/ipv4.h (revision 722ecdbce68a87de2d9296f91308f44ea900a039)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * ipv4 in net namespaces
4  */
5 
6 #ifndef __NETNS_IPV4_H__
7 #define __NETNS_IPV4_H__
8 
9 #include <linux/uidgid.h>
10 #include <net/inet_frag.h>
11 #include <linux/rcupdate.h>
12 #include <linux/siphash.h>
13 
14 struct ctl_table_header;
15 struct ipv4_devconf;
16 struct fib_rules_ops;
17 struct hlist_head;
18 struct fib_table;
19 struct sock;
20 struct local_ports {
21 	seqlock_t	lock;
22 	int		range[2];
23 	bool		warned;
24 };
25 
26 struct ping_group_range {
27 	seqlock_t	lock;
28 	kgid_t		range[2];
29 };
30 
31 struct inet_hashinfo;
32 
33 struct inet_timewait_death_row {
34 	refcount_t		tw_refcount;
35 
36 	struct inet_hashinfo 	*hashinfo ____cacheline_aligned_in_smp;
37 	int			sysctl_max_tw_buckets;
38 };
39 
40 struct tcp_fastopen_context;
41 
42 struct netns_ipv4 {
43 	struct inet_timewait_death_row *tcp_death_row;
44 
45 #ifdef CONFIG_SYSCTL
46 	struct ctl_table_header	*forw_hdr;
47 	struct ctl_table_header	*frags_hdr;
48 	struct ctl_table_header	*ipv4_hdr;
49 	struct ctl_table_header *route_hdr;
50 	struct ctl_table_header *xfrm4_hdr;
51 #endif
52 	struct ipv4_devconf	*devconf_all;
53 	struct ipv4_devconf	*devconf_dflt;
54 	struct ip_ra_chain __rcu *ra_chain;
55 	struct mutex		ra_mutex;
56 #ifdef CONFIG_IP_MULTIPLE_TABLES
57 	struct fib_rules_ops	*rules_ops;
58 	struct fib_table __rcu	*fib_main;
59 	struct fib_table __rcu	*fib_default;
60 	unsigned int		fib_rules_require_fldissect;
61 	bool			fib_has_custom_rules;
62 #endif
63 	bool			fib_has_custom_local_routes;
64 	bool			fib_offload_disabled;
65 #ifdef CONFIG_IP_ROUTE_CLASSID
66 	atomic_t		fib_num_tclassid_users;
67 #endif
68 	struct hlist_head	*fib_table_hash;
69 	struct sock		*fibnl;
70 
71 	struct sock		*mc_autojoin_sk;
72 
73 	struct inet_peer_base	*peers;
74 	struct fqdir		*fqdir;
75 
76 	u8 sysctl_icmp_echo_ignore_all;
77 	u8 sysctl_icmp_echo_enable_probe;
78 	u8 sysctl_icmp_echo_ignore_broadcasts;
79 	u8 sysctl_icmp_ignore_bogus_error_responses;
80 	u8 sysctl_icmp_errors_use_inbound_ifaddr;
81 	int sysctl_icmp_ratelimit;
82 	int sysctl_icmp_ratemask;
83 
84 	u32 ip_rt_min_pmtu;
85 	int ip_rt_mtu_expires;
86 	int ip_rt_min_advmss;
87 
88 	struct local_ports ip_local_ports;
89 
90 	u8 sysctl_tcp_ecn;
91 	u8 sysctl_tcp_ecn_fallback;
92 
93 	u8 sysctl_ip_default_ttl;
94 	u8 sysctl_ip_no_pmtu_disc;
95 	u8 sysctl_ip_fwd_use_pmtu;
96 	u8 sysctl_ip_fwd_update_priority;
97 	u8 sysctl_ip_nonlocal_bind;
98 	u8 sysctl_ip_autobind_reuse;
99 	/* Shall we try to damage output packets if routing dev changes? */
100 	u8 sysctl_ip_dynaddr;
101 	u8 sysctl_ip_early_demux;
102 #ifdef CONFIG_NET_L3_MASTER_DEV
103 	u8 sysctl_raw_l3mdev_accept;
104 #endif
105 	u8 sysctl_tcp_early_demux;
106 	u8 sysctl_udp_early_demux;
107 
108 	u8 sysctl_nexthop_compat_mode;
109 
110 	u8 sysctl_fwmark_reflect;
111 	u8 sysctl_tcp_fwmark_accept;
112 #ifdef CONFIG_NET_L3_MASTER_DEV
113 	u8 sysctl_tcp_l3mdev_accept;
114 #endif
115 	u8 sysctl_tcp_mtu_probing;
116 	int sysctl_tcp_mtu_probe_floor;
117 	int sysctl_tcp_base_mss;
118 	int sysctl_tcp_min_snd_mss;
119 	int sysctl_tcp_probe_threshold;
120 	u32 sysctl_tcp_probe_interval;
121 
122 	int sysctl_tcp_keepalive_time;
123 	int sysctl_tcp_keepalive_intvl;
124 	u8 sysctl_tcp_keepalive_probes;
125 
126 	u8 sysctl_tcp_syn_retries;
127 	u8 sysctl_tcp_synack_retries;
128 	u8 sysctl_tcp_syncookies;
129 	u8 sysctl_tcp_migrate_req;
130 	u8 sysctl_tcp_comp_sack_nr;
131 	int sysctl_tcp_reordering;
132 	u8 sysctl_tcp_retries1;
133 	u8 sysctl_tcp_retries2;
134 	u8 sysctl_tcp_orphan_retries;
135 	u8 sysctl_tcp_tw_reuse;
136 	int sysctl_tcp_fin_timeout;
137 	unsigned int sysctl_tcp_notsent_lowat;
138 	u8 sysctl_tcp_sack;
139 	u8 sysctl_tcp_window_scaling;
140 	u8 sysctl_tcp_timestamps;
141 	u8 sysctl_tcp_early_retrans;
142 	u8 sysctl_tcp_recovery;
143 	u8 sysctl_tcp_thin_linear_timeouts;
144 	u8 sysctl_tcp_slow_start_after_idle;
145 	u8 sysctl_tcp_retrans_collapse;
146 	u8 sysctl_tcp_stdurg;
147 	u8 sysctl_tcp_rfc1337;
148 	u8 sysctl_tcp_abort_on_overflow;
149 	u8 sysctl_tcp_fack; /* obsolete */
150 	int sysctl_tcp_max_reordering;
151 	int sysctl_tcp_adv_win_scale;
152 	u8 sysctl_tcp_dsack;
153 	u8 sysctl_tcp_app_win;
154 	u8 sysctl_tcp_frto;
155 	u8 sysctl_tcp_nometrics_save;
156 	u8 sysctl_tcp_no_ssthresh_metrics_save;
157 	u8 sysctl_tcp_moderate_rcvbuf;
158 	u8 sysctl_tcp_tso_win_divisor;
159 	u8 sysctl_tcp_workaround_signed_windows;
160 	int sysctl_tcp_limit_output_bytes;
161 	int sysctl_tcp_challenge_ack_limit;
162 	int sysctl_tcp_min_rtt_wlen;
163 	u8 sysctl_tcp_min_tso_segs;
164 	u8 sysctl_tcp_tso_rtt_log;
165 	u8 sysctl_tcp_autocorking;
166 	u8 sysctl_tcp_reflect_tos;
167 	int sysctl_tcp_invalid_ratelimit;
168 	int sysctl_tcp_pacing_ss_ratio;
169 	int sysctl_tcp_pacing_ca_ratio;
170 	int sysctl_tcp_wmem[3];
171 	int sysctl_tcp_rmem[3];
172 	unsigned long sysctl_tcp_comp_sack_delay_ns;
173 	unsigned long sysctl_tcp_comp_sack_slack_ns;
174 	int sysctl_max_syn_backlog;
175 	int sysctl_tcp_fastopen;
176 	const struct tcp_congestion_ops __rcu  *tcp_congestion_control;
177 	struct tcp_fastopen_context __rcu *tcp_fastopen_ctx;
178 	unsigned int sysctl_tcp_fastopen_blackhole_timeout;
179 	atomic_t tfo_active_disable_times;
180 	unsigned long tfo_active_disable_stamp;
181 
182 	int sysctl_udp_wmem_min;
183 	int sysctl_udp_rmem_min;
184 
185 	u8 sysctl_fib_notify_on_flag_change;
186 
187 #ifdef CONFIG_NET_L3_MASTER_DEV
188 	u8 sysctl_udp_l3mdev_accept;
189 #endif
190 
191 	u8 sysctl_igmp_llm_reports;
192 	int sysctl_igmp_max_memberships;
193 	int sysctl_igmp_max_msf;
194 	int sysctl_igmp_qrv;
195 
196 	struct ping_group_range ping_group_range;
197 
198 	atomic_t dev_addr_genid;
199 
200 #ifdef CONFIG_SYSCTL
201 	unsigned long *sysctl_local_reserved_ports;
202 	int sysctl_ip_prot_sock;
203 #endif
204 
205 #ifdef CONFIG_IP_MROUTE
206 #ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES
207 	struct mr_table		*mrt;
208 #else
209 	struct list_head	mr_tables;
210 	struct fib_rules_ops	*mr_rules_ops;
211 #endif
212 #endif
213 #ifdef CONFIG_IP_ROUTE_MULTIPATH
214 	u32 sysctl_fib_multipath_hash_fields;
215 	u8 sysctl_fib_multipath_use_neigh;
216 	u8 sysctl_fib_multipath_hash_policy;
217 #endif
218 
219 	struct fib_notifier_ops	*notifier_ops;
220 	unsigned int	fib_seq;	/* protected by rtnl_mutex */
221 
222 	struct fib_notifier_ops	*ipmr_notifier_ops;
223 	unsigned int	ipmr_seq;	/* protected by rtnl_mutex */
224 
225 	atomic_t	rt_genid;
226 	siphash_key_t	ip_id_key;
227 };
228 #endif
229