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