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