blob: 1844af8755ccff30b5d970a526e1e85a91e64c6b [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001/* 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#include <linux/android_kabi.h>
14
15struct tcpm_hash_bucket;
16struct ctl_table_header;
17struct ipv4_devconf;
18struct fib_rules_ops;
19struct hlist_head;
20struct fib_table;
21struct sock;
22struct local_ports {
23 seqlock_t lock;
24 int range[2];
25 bool warned;
26};
27
28struct ping_group_range {
29 seqlock_t lock;
30 kgid_t range[2];
31};
32
33struct inet_hashinfo;
34
35struct inet_timewait_death_row {
36 atomic_t tw_count;
37
38 struct inet_hashinfo *hashinfo ____cacheline_aligned_in_smp;
39 int sysctl_max_tw_buckets;
40};
41
42struct tcp_fastopen_context;
43
44struct netns_ipv4 {
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 bool fib_has_custom_rules;
59 unsigned int fib_rules_require_fldissect;
60 struct fib_table __rcu *fib_main;
61 struct fib_table __rcu *fib_default;
62#endif
63 bool fib_has_custom_local_routes;
64#ifdef CONFIG_IP_ROUTE_CLASSID
65 atomic_t fib_num_tclassid_users;
66#endif
67 struct hlist_head *fib_table_hash;
68 bool fib_offload_disabled;
69 struct sock *fibnl;
70
71 struct sock * __percpu *icmp_sk;
72 struct sock *mc_autojoin_sk;
73
74 struct inet_peer_base *peers;
75 struct sock * __percpu *tcp_sk;
76 struct fqdir *fqdir;
77#ifdef CONFIG_NETFILTER
78 struct xt_table *iptable_filter;
79 struct xt_table *iptable_mangle;
80 struct xt_table *iptable_raw;
81 struct xt_table *arptable_filter;
82#ifdef CONFIG_SECURITY
83 struct xt_table *iptable_security;
84#endif
85 struct xt_table *nat_table;
86#endif
87
88 int sysctl_icmp_echo_ignore_all;
89 int sysctl_icmp_echo_ignore_broadcasts;
90 int sysctl_icmp_ignore_bogus_error_responses;
91 int sysctl_icmp_ratelimit;
92 int sysctl_icmp_ratemask;
93 int sysctl_icmp_errors_use_inbound_ifaddr;
94
95 struct local_ports ip_local_ports;
96
97 int sysctl_tcp_ecn;
98 int sysctl_tcp_ecn_fallback;
99
100 int sysctl_ip_default_ttl;
101 int sysctl_ip_no_pmtu_disc;
102 int sysctl_ip_fwd_use_pmtu;
103 int sysctl_ip_fwd_update_priority;
104 int sysctl_ip_nonlocal_bind;
105 /* Shall we try to damage output packets if routing dev changes? */
106 int sysctl_ip_dynaddr;
107 int sysctl_ip_early_demux;
108#ifdef CONFIG_NET_L3_MASTER_DEV
109 int sysctl_raw_l3mdev_accept;
110#endif
111 int sysctl_tcp_early_demux;
112 int sysctl_udp_early_demux;
113
114 int sysctl_fwmark_reflect;
115 int sysctl_tcp_fwmark_accept;
116#ifdef CONFIG_NET_L3_MASTER_DEV
117 int sysctl_tcp_l3mdev_accept;
118#endif
119 int 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_probes;
128 int sysctl_tcp_keepalive_intvl;
129
130 int sysctl_tcp_syn_retries;
131 int sysctl_tcp_synack_retries;
132 int sysctl_tcp_syncookies;
133 int sysctl_tcp_reordering;
134 int sysctl_tcp_retries1;
135 int sysctl_tcp_retries2;
136 int sysctl_tcp_orphan_retries;
137 int sysctl_tcp_fin_timeout;
138 unsigned int sysctl_tcp_notsent_lowat;
139 int sysctl_tcp_tw_reuse;
140 int sysctl_tcp_sack;
141 int sysctl_tcp_window_scaling;
142 int sysctl_tcp_timestamps;
143 int sysctl_tcp_early_retrans;
144 int sysctl_tcp_recovery;
145 int sysctl_tcp_thin_linear_timeouts;
146 int sysctl_tcp_slow_start_after_idle;
147 int sysctl_tcp_retrans_collapse;
148 int sysctl_tcp_stdurg;
149 int sysctl_tcp_rfc1337;
150 int sysctl_tcp_abort_on_overflow;
151 int sysctl_tcp_fack;
152 int sysctl_tcp_max_reordering;
153 int sysctl_tcp_dsack;
154 int sysctl_tcp_app_win;
155 int sysctl_tcp_adv_win_scale;
156 int sysctl_tcp_frto;
157 int sysctl_tcp_nometrics_save;
158 int sysctl_tcp_moderate_rcvbuf;
159 int sysctl_tcp_tso_win_divisor;
160 int sysctl_tcp_workaround_signed_windows;
161 int sysctl_tcp_limit_output_bytes;
162 int sysctl_tcp_challenge_ack_limit;
163 int sysctl_tcp_min_tso_segs;
164 int sysctl_tcp_min_rtt_wlen;
165 int sysctl_tcp_autocorking;
166 int sysctl_tcp_invalid_ratelimit;
167 int sysctl_tcp_pacing_ss_ratio;
168 int sysctl_tcp_pacing_ca_ratio;
169 int sysctl_tcp_wmem[3];
170 int sysctl_tcp_rmem[3];
171 int sysctl_tcp_comp_sack_nr;
172 unsigned long sysctl_tcp_comp_sack_delay_ns;
173 struct inet_timewait_death_row tcp_death_row;
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 spinlock_t tcp_fastopen_ctx_lock;
179 unsigned int sysctl_tcp_fastopen_blackhole_timeout;
180 atomic_t tfo_active_disable_times;
181 unsigned long tfo_active_disable_stamp;
182
183 int sysctl_udp_wmem_min;
184 int sysctl_udp_rmem_min;
185
186#ifdef CONFIG_NET_L3_MASTER_DEV
187 int sysctl_udp_l3mdev_accept;
188#endif
189
190 int sysctl_igmp_max_memberships;
191 int sysctl_igmp_max_msf;
192 int sysctl_igmp_llm_reports;
193 int sysctl_igmp_qrv;
194
195 struct ping_group_range ping_group_range;
196
197 atomic_t dev_addr_genid;
198
199#ifdef CONFIG_SYSCTL
200 unsigned long *sysctl_local_reserved_ports;
201 unsigned long *sysctl_local_unbindable_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 int sysctl_fib_multipath_use_neigh;
215 int sysctl_fib_multipath_hash_policy;
216#endif
217
218 struct fib_notifier_ops *notifier_ops;
219 unsigned int fib_seq; /* protected by rtnl_mutex */
220
221 struct fib_notifier_ops *ipmr_notifier_ops;
222 unsigned int ipmr_seq; /* protected by rtnl_mutex */
223
224 atomic_t rt_genid;
225 siphash_key_t ip_id_key;
226
227 ANDROID_KABI_RESERVE(1);
228};
229#endif