xref: /openbmc/linux/include/net/netns/ipv4.h (revision b24413180f5600bcb3bb70fbed5cf186b60864bd)
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 
13 struct tcpm_hash_bucket;
14 struct ctl_table_header;
15 struct ipv4_devconf;
16 struct fib_rules_ops;
17 struct hlist_head;
18 struct fib_table;
19 struct sock;
20 struct local_ports {
21 	seqlock_t	lock;
22 	int		range[2];
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 	atomic_t		tw_count;
35 
36 	struct inet_hashinfo 	*hashinfo ____cacheline_aligned_in_smp;
37 	int			sysctl_max_tw_buckets;
38 };
39 
40 struct netns_ipv4 {
41 #ifdef CONFIG_SYSCTL
42 	struct ctl_table_header	*forw_hdr;
43 	struct ctl_table_header	*frags_hdr;
44 	struct ctl_table_header	*ipv4_hdr;
45 	struct ctl_table_header *route_hdr;
46 	struct ctl_table_header *xfrm4_hdr;
47 #endif
48 	struct ipv4_devconf	*devconf_all;
49 	struct ipv4_devconf	*devconf_dflt;
50 #ifdef CONFIG_IP_MULTIPLE_TABLES
51 	struct fib_rules_ops	*rules_ops;
52 	bool			fib_has_custom_rules;
53 	struct fib_table __rcu	*fib_main;
54 	struct fib_table __rcu	*fib_default;
55 #endif
56 #ifdef CONFIG_IP_ROUTE_CLASSID
57 	int			fib_num_tclassid_users;
58 #endif
59 	struct hlist_head	*fib_table_hash;
60 	bool			fib_offload_disabled;
61 	struct sock		*fibnl;
62 
63 	struct sock  * __percpu	*icmp_sk;
64 	struct sock		*mc_autojoin_sk;
65 
66 	struct inet_peer_base	*peers;
67 	struct sock  * __percpu	*tcp_sk;
68 	struct netns_frags	frags;
69 #ifdef CONFIG_NETFILTER
70 	struct xt_table		*iptable_filter;
71 	struct xt_table		*iptable_mangle;
72 	struct xt_table		*iptable_raw;
73 	struct xt_table		*arptable_filter;
74 #ifdef CONFIG_SECURITY
75 	struct xt_table		*iptable_security;
76 #endif
77 	struct xt_table		*nat_table;
78 #endif
79 
80 	int sysctl_icmp_echo_ignore_all;
81 	int sysctl_icmp_echo_ignore_broadcasts;
82 	int sysctl_icmp_ignore_bogus_error_responses;
83 	int sysctl_icmp_ratelimit;
84 	int sysctl_icmp_ratemask;
85 	int sysctl_icmp_errors_use_inbound_ifaddr;
86 
87 	struct local_ports ip_local_ports;
88 
89 	int sysctl_tcp_ecn;
90 	int sysctl_tcp_ecn_fallback;
91 
92 	int sysctl_ip_default_ttl;
93 	int sysctl_ip_no_pmtu_disc;
94 	int sysctl_ip_fwd_use_pmtu;
95 	int sysctl_ip_nonlocal_bind;
96 	/* Shall we try to damage output packets if routing dev changes? */
97 	int sysctl_ip_dynaddr;
98 	int sysctl_ip_early_demux;
99 	int sysctl_tcp_early_demux;
100 	int sysctl_udp_early_demux;
101 
102 	int sysctl_fwmark_reflect;
103 	int sysctl_tcp_fwmark_accept;
104 #ifdef CONFIG_NET_L3_MASTER_DEV
105 	int sysctl_tcp_l3mdev_accept;
106 #endif
107 	int sysctl_tcp_mtu_probing;
108 	int sysctl_tcp_base_mss;
109 	int sysctl_tcp_probe_threshold;
110 	u32 sysctl_tcp_probe_interval;
111 
112 	int sysctl_tcp_keepalive_time;
113 	int sysctl_tcp_keepalive_probes;
114 	int sysctl_tcp_keepalive_intvl;
115 
116 	int sysctl_tcp_syn_retries;
117 	int sysctl_tcp_synack_retries;
118 	int sysctl_tcp_syncookies;
119 	int sysctl_tcp_reordering;
120 	int sysctl_tcp_retries1;
121 	int sysctl_tcp_retries2;
122 	int sysctl_tcp_orphan_retries;
123 	int sysctl_tcp_fin_timeout;
124 	unsigned int sysctl_tcp_notsent_lowat;
125 	int sysctl_tcp_tw_reuse;
126 	int sysctl_tcp_sack;
127 	int sysctl_tcp_window_scaling;
128 	int sysctl_tcp_timestamps;
129 	struct inet_timewait_death_row tcp_death_row;
130 	int sysctl_max_syn_backlog;
131 
132 #ifdef CONFIG_NET_L3_MASTER_DEV
133 	int sysctl_udp_l3mdev_accept;
134 #endif
135 
136 	int sysctl_igmp_max_memberships;
137 	int sysctl_igmp_max_msf;
138 	int sysctl_igmp_llm_reports;
139 	int sysctl_igmp_qrv;
140 
141 	struct ping_group_range ping_group_range;
142 
143 	atomic_t dev_addr_genid;
144 
145 #ifdef CONFIG_SYSCTL
146 	unsigned long *sysctl_local_reserved_ports;
147 	int sysctl_ip_prot_sock;
148 #endif
149 
150 #ifdef CONFIG_IP_MROUTE
151 #ifndef CONFIG_IP_MROUTE_MULTIPLE_TABLES
152 	struct mr_table		*mrt;
153 #else
154 	struct list_head	mr_tables;
155 	struct fib_rules_ops	*mr_rules_ops;
156 #endif
157 #endif
158 #ifdef CONFIG_IP_ROUTE_MULTIPATH
159 	int sysctl_fib_multipath_use_neigh;
160 	int sysctl_fib_multipath_hash_policy;
161 #endif
162 
163 	struct fib_notifier_ops	*notifier_ops;
164 	unsigned int	fib_seq;	/* protected by rtnl_mutex */
165 
166 	atomic_t	rt_genid;
167 };
168 #endif
169