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