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