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