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 ; |
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 | /* Padding to avoid false sharing, tw_refcount can be often written */ |
38 | struct inet_hashinfo *hashinfo ____cacheline_aligned_in_smp; |
39 | int sysctl_max_tw_buckets; |
40 | }; |
41 | |
42 | struct tcp_fastopen_context; |
43 | |
44 | struct netns_ipv4 { |
45 | struct inet_timewait_death_row tcp_death_row; |
46 | struct udp_table *udp_table; |
47 | |
48 | #ifdef CONFIG_SYSCTL |
49 | struct ctl_table_header *forw_hdr; |
50 | struct ctl_table_header *frags_hdr; |
51 | struct ctl_table_header *ipv4_hdr; |
52 | struct ctl_table_header *route_hdr; |
53 | struct ctl_table_header *xfrm4_hdr; |
54 | #endif |
55 | struct ipv4_devconf *devconf_all; |
56 | struct ipv4_devconf *devconf_dflt; |
57 | struct ip_ra_chain __rcu *ra_chain; |
58 | struct mutex ra_mutex; |
59 | #ifdef CONFIG_IP_MULTIPLE_TABLES |
60 | struct fib_rules_ops *rules_ops; |
61 | struct fib_table __rcu *fib_main; |
62 | struct fib_table __rcu *fib_default; |
63 | unsigned int fib_rules_require_fldissect; |
64 | bool fib_has_custom_rules; |
65 | #endif |
66 | bool fib_has_custom_local_routes; |
67 | bool fib_offload_disabled; |
68 | u8 sysctl_tcp_shrink_window; |
69 | #ifdef CONFIG_IP_ROUTE_CLASSID |
70 | atomic_t fib_num_tclassid_users; |
71 | #endif |
72 | struct hlist_head *fib_table_hash; |
73 | struct sock *fibnl; |
74 | |
75 | struct sock *mc_autojoin_sk; |
76 | |
77 | struct inet_peer_base *peers; |
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 | int ip_rt_min_advmss; |
91 | |
92 | struct local_ports ip_local_ports; |
93 | |
94 | u8 sysctl_tcp_ecn; |
95 | u8 sysctl_tcp_ecn_fallback; |
96 | |
97 | u8 sysctl_ip_default_ttl; |
98 | u8 sysctl_ip_no_pmtu_disc; |
99 | u8 sysctl_ip_fwd_use_pmtu; |
100 | u8 sysctl_ip_fwd_update_priority; |
101 | u8 sysctl_ip_nonlocal_bind; |
102 | u8 sysctl_ip_autobind_reuse; |
103 | /* Shall we try to damage output packets if routing dev changes? */ |
104 | u8 sysctl_ip_dynaddr; |
105 | u8 sysctl_ip_early_demux; |
106 | #ifdef CONFIG_NET_L3_MASTER_DEV |
107 | u8 sysctl_raw_l3mdev_accept; |
108 | #endif |
109 | u8 sysctl_tcp_early_demux; |
110 | u8 sysctl_udp_early_demux; |
111 | |
112 | u8 sysctl_nexthop_compat_mode; |
113 | |
114 | u8 sysctl_fwmark_reflect; |
115 | u8 sysctl_tcp_fwmark_accept; |
116 | #ifdef CONFIG_NET_L3_MASTER_DEV |
117 | u8 sysctl_tcp_l3mdev_accept; |
118 | #endif |
119 | u8 sysctl_tcp_mtu_probing; |
120 | int sysctl_tcp_mtu_probe_floor; |
121 | int sysctl_tcp_base_mss; |
122 | int sysctl_tcp_min_snd_mss; |
123 | int sysctl_tcp_probe_threshold; |
124 | u32 sysctl_tcp_probe_interval; |
125 | |
126 | int sysctl_tcp_keepalive_time; |
127 | int sysctl_tcp_keepalive_intvl; |
128 | u8 sysctl_tcp_keepalive_probes; |
129 | |
130 | u8 sysctl_tcp_syn_retries; |
131 | u8 sysctl_tcp_synack_retries; |
132 | u8 sysctl_tcp_syncookies; |
133 | u8 sysctl_tcp_migrate_req; |
134 | u8 sysctl_tcp_comp_sack_nr; |
135 | u8 sysctl_tcp_backlog_ack_defer; |
136 | u8 sysctl_tcp_pingpong_thresh; |
137 | |
138 | int sysctl_tcp_reordering; |
139 | u8 sysctl_tcp_retries1; |
140 | u8 sysctl_tcp_retries2; |
141 | u8 sysctl_tcp_orphan_retries; |
142 | u8 sysctl_tcp_tw_reuse; |
143 | int sysctl_tcp_fin_timeout; |
144 | unsigned int sysctl_tcp_notsent_lowat; |
145 | u8 sysctl_tcp_sack; |
146 | u8 sysctl_tcp_window_scaling; |
147 | u8 sysctl_tcp_timestamps; |
148 | u8 sysctl_tcp_early_retrans; |
149 | u8 sysctl_tcp_recovery; |
150 | u8 sysctl_tcp_thin_linear_timeouts; |
151 | u8 sysctl_tcp_slow_start_after_idle; |
152 | u8 sysctl_tcp_retrans_collapse; |
153 | u8 sysctl_tcp_stdurg; |
154 | u8 sysctl_tcp_rfc1337; |
155 | u8 sysctl_tcp_abort_on_overflow; |
156 | u8 sysctl_tcp_fack; /* obsolete */ |
157 | int sysctl_tcp_max_reordering; |
158 | int sysctl_tcp_adv_win_scale; /* obsolete */ |
159 | u8 sysctl_tcp_dsack; |
160 | u8 sysctl_tcp_app_win; |
161 | u8 sysctl_tcp_frto; |
162 | u8 sysctl_tcp_nometrics_save; |
163 | u8 sysctl_tcp_no_ssthresh_metrics_save; |
164 | u8 sysctl_tcp_moderate_rcvbuf; |
165 | u8 sysctl_tcp_tso_win_divisor; |
166 | u8 sysctl_tcp_workaround_signed_windows; |
167 | int sysctl_tcp_limit_output_bytes; |
168 | int sysctl_tcp_challenge_ack_limit; |
169 | int sysctl_tcp_min_rtt_wlen; |
170 | u8 sysctl_tcp_min_tso_segs; |
171 | u8 sysctl_tcp_tso_rtt_log; |
172 | u8 sysctl_tcp_autocorking; |
173 | u8 sysctl_tcp_reflect_tos; |
174 | int sysctl_tcp_invalid_ratelimit; |
175 | int sysctl_tcp_pacing_ss_ratio; |
176 | int sysctl_tcp_pacing_ca_ratio; |
177 | int sysctl_tcp_wmem[3]; |
178 | int sysctl_tcp_rmem[3]; |
179 | unsigned int sysctl_tcp_child_ehash_entries; |
180 | unsigned long sysctl_tcp_comp_sack_delay_ns; |
181 | unsigned long sysctl_tcp_comp_sack_slack_ns; |
182 | int sysctl_max_syn_backlog; |
183 | int sysctl_tcp_fastopen; |
184 | const struct tcp_congestion_ops __rcu *tcp_congestion_control; |
185 | struct tcp_fastopen_context __rcu *tcp_fastopen_ctx; |
186 | unsigned int sysctl_tcp_fastopen_blackhole_timeout; |
187 | atomic_t tfo_active_disable_times; |
188 | unsigned long tfo_active_disable_stamp; |
189 | u32 tcp_challenge_timestamp; |
190 | u32 tcp_challenge_count; |
191 | u8 sysctl_tcp_plb_enabled; |
192 | u8 sysctl_tcp_plb_idle_rehash_rounds; |
193 | u8 sysctl_tcp_plb_rehash_rounds; |
194 | u8 sysctl_tcp_plb_suspend_rto_sec; |
195 | int sysctl_tcp_plb_cong_thresh; |
196 | |
197 | int sysctl_udp_wmem_min; |
198 | int sysctl_udp_rmem_min; |
199 | |
200 | u8 sysctl_fib_notify_on_flag_change; |
201 | u8 sysctl_tcp_syn_linear_timeouts; |
202 | |
203 | #ifdef CONFIG_NET_L3_MASTER_DEV |
204 | u8 sysctl_udp_l3mdev_accept; |
205 | #endif |
206 | |
207 | u8 sysctl_igmp_llm_reports; |
208 | int sysctl_igmp_max_memberships; |
209 | int sysctl_igmp_max_msf; |
210 | int sysctl_igmp_qrv; |
211 | |
212 | struct ping_group_range ping_group_range; |
213 | |
214 | atomic_t dev_addr_genid; |
215 | |
216 | unsigned int sysctl_udp_child_hash_entries; |
217 | |
218 | #ifdef CONFIG_SYSCTL |
219 | unsigned long *sysctl_local_reserved_ports; |
220 | int sysctl_ip_prot_sock; |
221 | #endif |
222 | |
223 | #ifdef CONFIG_IP_MROUTE |
224 | #ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES |
225 | struct mr_table *mrt; |
226 | #else |
227 | struct list_head mr_tables; |
228 | struct fib_rules_ops *mr_rules_ops; |
229 | #endif |
230 | #endif |
231 | #ifdef CONFIG_IP_ROUTE_MULTIPATH |
232 | u32 sysctl_fib_multipath_hash_fields; |
233 | u8 sysctl_fib_multipath_use_neigh; |
234 | u8 sysctl_fib_multipath_hash_policy; |
235 | #endif |
236 | |
237 | struct fib_notifier_ops *notifier_ops; |
238 | unsigned int fib_seq; /* protected by rtnl_mutex */ |
239 | |
240 | struct fib_notifier_ops *ipmr_notifier_ops; |
241 | unsigned int ipmr_seq; /* protected by rtnl_mutex */ |
242 | |
243 | atomic_t rt_genid; |
244 | siphash_key_t ip_id_key; |
245 | }; |
246 | #endif |
247 | |