1 /* SPDX-License-Identifier: GPL-2.0 */
3 * ipv4 in net namespaces
6 #ifndef __NETNS_IPV4_H__
7 #define __NETNS_IPV4_H__
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>
15 struct ctl_table_header
;
22 u32 range
; /* high << 16 | low */
26 struct ping_group_range
{
33 struct inet_timewait_death_row
{
34 refcount_t tw_refcount
;
36 /* Padding to avoid false sharing, tw_refcount can be often written */
37 struct inet_hashinfo
*hashinfo ____cacheline_aligned_in_smp
;
38 int sysctl_max_tw_buckets
;
41 struct tcp_fastopen_context
;
43 #ifdef CONFIG_IP_ROUTE_MULTIPATH
44 struct sysctl_fib_multipath_hash_seed
{
51 /* Cacheline organization can be found documented in
52 * Documentation/networking/net_cachelines/netns_ipv4_sysctl.rst.
53 * Please update the document when adding new fields.
56 /* TX readonly hotpath cache lines */
57 __cacheline_group_begin(netns_ipv4_read_tx
);
58 u8 sysctl_tcp_early_retrans
;
59 u8 sysctl_tcp_tso_win_divisor
;
60 u8 sysctl_tcp_tso_rtt_log
;
61 u8 sysctl_tcp_autocorking
;
62 int sysctl_tcp_min_snd_mss
;
63 unsigned int sysctl_tcp_notsent_lowat
;
64 int sysctl_tcp_limit_output_bytes
;
65 int sysctl_tcp_min_rtt_wlen
;
66 int sysctl_tcp_wmem
[3];
67 u8 sysctl_ip_fwd_use_pmtu
;
68 __cacheline_group_end(netns_ipv4_read_tx
);
70 /* TXRX readonly hotpath cache lines */
71 __cacheline_group_begin(netns_ipv4_read_txrx
);
72 u8 sysctl_tcp_moderate_rcvbuf
;
73 __cacheline_group_end(netns_ipv4_read_txrx
);
75 /* RX readonly hotpath cache line */
76 __cacheline_group_begin(netns_ipv4_read_rx
);
77 u8 sysctl_ip_early_demux
;
78 u8 sysctl_tcp_early_demux
;
79 u8 sysctl_tcp_l3mdev_accept
;
80 /* 3 bytes hole, try to pack */
81 int sysctl_tcp_reordering
;
82 int sysctl_tcp_rmem
[3];
83 __cacheline_group_end(netns_ipv4_read_rx
);
85 struct inet_timewait_death_row tcp_death_row
;
86 struct udp_table
*udp_table
;
89 struct ctl_table_header
*forw_hdr
;
90 struct ctl_table_header
*frags_hdr
;
91 struct ctl_table_header
*ipv4_hdr
;
92 struct ctl_table_header
*route_hdr
;
93 struct ctl_table_header
*xfrm4_hdr
;
95 struct ipv4_devconf
*devconf_all
;
96 struct ipv4_devconf
*devconf_dflt
;
97 struct ip_ra_chain __rcu
*ra_chain
;
98 struct mutex ra_mutex
;
99 #ifdef CONFIG_IP_MULTIPLE_TABLES
100 struct fib_rules_ops
*rules_ops
;
101 struct fib_table __rcu
*fib_main
;
102 struct fib_table __rcu
*fib_default
;
103 unsigned int fib_rules_require_fldissect
;
104 bool fib_has_custom_rules
;
106 bool fib_has_custom_local_routes
;
107 bool fib_offload_disabled
;
108 u8 sysctl_tcp_shrink_window
;
109 #ifdef CONFIG_IP_ROUTE_CLASSID
110 atomic_t fib_num_tclassid_users
;
112 struct hlist_head
*fib_table_hash
;
115 struct sock
*mc_autojoin_sk
;
117 struct inet_peer_base
*peers
;
120 u8 sysctl_icmp_echo_ignore_all
;
121 u8 sysctl_icmp_echo_enable_probe
;
122 u8 sysctl_icmp_echo_ignore_broadcasts
;
123 u8 sysctl_icmp_ignore_bogus_error_responses
;
124 u8 sysctl_icmp_errors_use_inbound_ifaddr
;
125 int sysctl_icmp_ratelimit
;
126 int sysctl_icmp_ratemask
;
127 int sysctl_icmp_msgs_per_sec
;
128 int sysctl_icmp_msgs_burst
;
129 atomic_t icmp_global_credit
;
130 u32 icmp_global_stamp
;
132 int ip_rt_mtu_expires
;
133 int ip_rt_min_advmss
;
135 struct local_ports ip_local_ports
;
138 u8 sysctl_tcp_ecn_fallback
;
140 u8 sysctl_ip_default_ttl
;
141 u8 sysctl_ip_no_pmtu_disc
;
142 u8 sysctl_ip_fwd_update_priority
;
143 u8 sysctl_ip_nonlocal_bind
;
144 u8 sysctl_ip_autobind_reuse
;
145 /* Shall we try to damage output packets if routing dev changes? */
146 u8 sysctl_ip_dynaddr
;
147 #ifdef CONFIG_NET_L3_MASTER_DEV
148 u8 sysctl_raw_l3mdev_accept
;
150 u8 sysctl_udp_early_demux
;
152 u8 sysctl_nexthop_compat_mode
;
154 u8 sysctl_fwmark_reflect
;
155 u8 sysctl_tcp_fwmark_accept
;
156 u8 sysctl_tcp_mtu_probing
;
157 int sysctl_tcp_mtu_probe_floor
;
158 int sysctl_tcp_base_mss
;
159 int sysctl_tcp_probe_threshold
;
160 u32 sysctl_tcp_probe_interval
;
162 int sysctl_tcp_keepalive_time
;
163 int sysctl_tcp_keepalive_intvl
;
164 u8 sysctl_tcp_keepalive_probes
;
166 u8 sysctl_tcp_syn_retries
;
167 u8 sysctl_tcp_synack_retries
;
168 u8 sysctl_tcp_syncookies
;
169 u8 sysctl_tcp_migrate_req
;
170 u8 sysctl_tcp_comp_sack_nr
;
171 u8 sysctl_tcp_backlog_ack_defer
;
172 u8 sysctl_tcp_pingpong_thresh
;
174 u8 sysctl_tcp_retries1
;
175 u8 sysctl_tcp_retries2
;
176 u8 sysctl_tcp_orphan_retries
;
177 u8 sysctl_tcp_tw_reuse
;
178 int sysctl_tcp_fin_timeout
;
180 u8 sysctl_tcp_window_scaling
;
181 u8 sysctl_tcp_timestamps
;
182 int sysctl_tcp_rto_min_us
;
183 u8 sysctl_tcp_recovery
;
184 u8 sysctl_tcp_thin_linear_timeouts
;
185 u8 sysctl_tcp_slow_start_after_idle
;
186 u8 sysctl_tcp_retrans_collapse
;
187 u8 sysctl_tcp_stdurg
;
188 u8 sysctl_tcp_rfc1337
;
189 u8 sysctl_tcp_abort_on_overflow
;
190 u8 sysctl_tcp_fack
; /* obsolete */
191 int sysctl_tcp_max_reordering
;
192 int sysctl_tcp_adv_win_scale
; /* obsolete */
194 u8 sysctl_tcp_app_win
;
196 u8 sysctl_tcp_nometrics_save
;
197 u8 sysctl_tcp_no_ssthresh_metrics_save
;
198 u8 sysctl_tcp_workaround_signed_windows
;
199 int sysctl_tcp_challenge_ack_limit
;
200 u8 sysctl_tcp_min_tso_segs
;
201 u8 sysctl_tcp_reflect_tos
;
202 int sysctl_tcp_invalid_ratelimit
;
203 int sysctl_tcp_pacing_ss_ratio
;
204 int sysctl_tcp_pacing_ca_ratio
;
205 unsigned int sysctl_tcp_child_ehash_entries
;
206 unsigned long sysctl_tcp_comp_sack_delay_ns
;
207 unsigned long sysctl_tcp_comp_sack_slack_ns
;
208 int sysctl_max_syn_backlog
;
209 int sysctl_tcp_fastopen
;
210 const struct tcp_congestion_ops __rcu
*tcp_congestion_control
;
211 struct tcp_fastopen_context __rcu
*tcp_fastopen_ctx
;
212 unsigned int sysctl_tcp_fastopen_blackhole_timeout
;
213 atomic_t tfo_active_disable_times
;
214 unsigned long tfo_active_disable_stamp
;
215 u32 tcp_challenge_timestamp
;
216 u32 tcp_challenge_count
;
217 u8 sysctl_tcp_plb_enabled
;
218 u8 sysctl_tcp_plb_idle_rehash_rounds
;
219 u8 sysctl_tcp_plb_rehash_rounds
;
220 u8 sysctl_tcp_plb_suspend_rto_sec
;
221 int sysctl_tcp_plb_cong_thresh
;
223 int sysctl_udp_wmem_min
;
224 int sysctl_udp_rmem_min
;
226 u8 sysctl_fib_notify_on_flag_change
;
227 u8 sysctl_tcp_syn_linear_timeouts
;
229 #ifdef CONFIG_NET_L3_MASTER_DEV
230 u8 sysctl_udp_l3mdev_accept
;
233 u8 sysctl_igmp_llm_reports
;
234 int sysctl_igmp_max_memberships
;
235 int sysctl_igmp_max_msf
;
238 struct ping_group_range ping_group_range
;
240 atomic_t dev_addr_genid
;
242 unsigned int sysctl_udp_child_hash_entries
;
245 unsigned long *sysctl_local_reserved_ports
;
246 int sysctl_ip_prot_sock
;
249 #ifdef CONFIG_IP_MROUTE
250 #ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES
251 struct mr_table
*mrt
;
253 struct list_head mr_tables
;
254 struct fib_rules_ops
*mr_rules_ops
;
257 #ifdef CONFIG_IP_ROUTE_MULTIPATH
258 struct sysctl_fib_multipath_hash_seed sysctl_fib_multipath_hash_seed
;
259 u32 sysctl_fib_multipath_hash_fields
;
260 u8 sysctl_fib_multipath_use_neigh
;
261 u8 sysctl_fib_multipath_hash_policy
;
264 struct fib_notifier_ops
*notifier_ops
;
265 unsigned int fib_seq
; /* writes protected by rtnl_mutex */
267 struct fib_notifier_ops
*ipmr_notifier_ops
;
268 unsigned int ipmr_seq
; /* protected by rtnl_mutex */
271 siphash_key_t ip_id_key
;
272 struct hlist_head
*inet_addr_lst
;
273 struct delayed_work addr_chk_work
;