1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef _IP_VS_H
20 #define _IP_VS_H
21 #include <linux/types.h>
22 #define IP_VS_VERSION_CODE 0x010201
23 #define NVERSION(version) (version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF
24 #define IP_VS_SVC_F_PERSISTENT 0x0001
25 #define IP_VS_SVC_F_HASHED 0x0002
26 #define IP_VS_SVC_F_ONEPACKET 0x0004
27 #define IP_VS_SVC_F_SCHED1 0x0008
28 #define IP_VS_SVC_F_SCHED2 0x0010
29 #define IP_VS_SVC_F_SCHED3 0x0020
30 #define IP_VS_SVC_F_SCHED_SH_FALLBACK IP_VS_SVC_F_SCHED1
31 #define IP_VS_SVC_F_SCHED_SH_PORT IP_VS_SVC_F_SCHED2
32 #define IP_VS_DEST_F_AVAILABLE 0x0001
33 #define IP_VS_DEST_F_OVERLOAD 0x0002
34 #define IP_VS_STATE_NONE 0x0000
35 #define IP_VS_STATE_MASTER 0x0001
36 #define IP_VS_STATE_BACKUP 0x0002
37 #define IP_VS_BASE_CTL (64 + 1024 + 64)
38 #define IP_VS_SO_SET_NONE IP_VS_BASE_CTL
39 #define IP_VS_SO_SET_INSERT (IP_VS_BASE_CTL + 1)
40 #define IP_VS_SO_SET_ADD (IP_VS_BASE_CTL + 2)
41 #define IP_VS_SO_SET_EDIT (IP_VS_BASE_CTL + 3)
42 #define IP_VS_SO_SET_DEL (IP_VS_BASE_CTL + 4)
43 #define IP_VS_SO_SET_FLUSH (IP_VS_BASE_CTL + 5)
44 #define IP_VS_SO_SET_LIST (IP_VS_BASE_CTL + 6)
45 #define IP_VS_SO_SET_ADDDEST (IP_VS_BASE_CTL + 7)
46 #define IP_VS_SO_SET_DELDEST (IP_VS_BASE_CTL + 8)
47 #define IP_VS_SO_SET_EDITDEST (IP_VS_BASE_CTL + 9)
48 #define IP_VS_SO_SET_TIMEOUT (IP_VS_BASE_CTL + 10)
49 #define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL + 11)
50 #define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL + 12)
51 #define IP_VS_SO_SET_RESTORE (IP_VS_BASE_CTL + 13)
52 #define IP_VS_SO_SET_SAVE (IP_VS_BASE_CTL + 14)
53 #define IP_VS_SO_SET_ZERO (IP_VS_BASE_CTL + 15)
54 #define IP_VS_SO_SET_MAX IP_VS_SO_SET_ZERO
55 #define IP_VS_SO_GET_VERSION IP_VS_BASE_CTL
56 #define IP_VS_SO_GET_INFO (IP_VS_BASE_CTL + 1)
57 #define IP_VS_SO_GET_SERVICES (IP_VS_BASE_CTL + 2)
58 #define IP_VS_SO_GET_SERVICE (IP_VS_BASE_CTL + 3)
59 #define IP_VS_SO_GET_DESTS (IP_VS_BASE_CTL + 4)
60 #define IP_VS_SO_GET_DEST (IP_VS_BASE_CTL + 5)
61 #define IP_VS_SO_GET_TIMEOUT (IP_VS_BASE_CTL + 6)
62 #define IP_VS_SO_GET_DAEMON (IP_VS_BASE_CTL + 7)
63 #define IP_VS_SO_GET_MAX IP_VS_SO_GET_DAEMON
64 #define IP_VS_CONN_F_FWD_MASK 0x0007
65 #define IP_VS_CONN_F_MASQ 0x0000
66 #define IP_VS_CONN_F_LOCALNODE 0x0001
67 #define IP_VS_CONN_F_TUNNEL 0x0002
68 #define IP_VS_CONN_F_DROUTE 0x0003
69 #define IP_VS_CONN_F_BYPASS 0x0004
70 #define IP_VS_CONN_F_SYNC 0x0020
71 #define IP_VS_CONN_F_HASHED 0x0040
72 #define IP_VS_CONN_F_NOOUTPUT 0x0080
73 #define IP_VS_CONN_F_INACTIVE 0x0100
74 #define IP_VS_CONN_F_OUT_SEQ 0x0200
75 #define IP_VS_CONN_F_IN_SEQ 0x0400
76 #define IP_VS_CONN_F_SEQ_MASK 0x0600
77 #define IP_VS_CONN_F_NO_CPORT 0x0800
78 #define IP_VS_CONN_F_TEMPLATE 0x1000
79 #define IP_VS_CONN_F_ONE_PACKET 0x2000
80 #define IP_VS_CONN_F_BACKUP_MASK (IP_VS_CONN_F_FWD_MASK | IP_VS_CONN_F_NOOUTPUT | IP_VS_CONN_F_INACTIVE | IP_VS_CONN_F_SEQ_MASK | IP_VS_CONN_F_NO_CPORT | IP_VS_CONN_F_TEMPLATE)
81 #define IP_VS_CONN_F_BACKUP_UPD_MASK (IP_VS_CONN_F_INACTIVE | IP_VS_CONN_F_SEQ_MASK)
82 #define IP_VS_CONN_F_NFCT (1 << 16)
83 #define IP_VS_CONN_F_DEST_MASK (IP_VS_CONN_F_FWD_MASK | IP_VS_CONN_F_ONE_PACKET | IP_VS_CONN_F_NFCT | 0)
84 #define IP_VS_SCHEDNAME_MAXLEN 16
85 #define IP_VS_PENAME_MAXLEN 16
86 #define IP_VS_IFNAME_MAXLEN 16
87 #define IP_VS_PEDATA_MAXLEN 255
88 enum {
89   IP_VS_CONN_F_TUNNEL_TYPE_IPIP = 0,
90   IP_VS_CONN_F_TUNNEL_TYPE_GUE,
91   IP_VS_CONN_F_TUNNEL_TYPE_GRE,
92   IP_VS_CONN_F_TUNNEL_TYPE_MAX,
93 };
94 #define IP_VS_TUNNEL_ENCAP_FLAG_NOCSUM (0)
95 #define IP_VS_TUNNEL_ENCAP_FLAG_CSUM (1 << 0)
96 #define IP_VS_TUNNEL_ENCAP_FLAG_REMCSUM (1 << 1)
97 struct ip_vs_service_user {
98   __u16 protocol;
99   __be32 addr;
100   __be16 port;
101   __u32 fwmark;
102   char sched_name[IP_VS_SCHEDNAME_MAXLEN];
103   unsigned int flags;
104   unsigned int timeout;
105   __be32 netmask;
106 };
107 struct ip_vs_dest_user {
108   __be32 addr;
109   __be16 port;
110   unsigned int conn_flags;
111   int weight;
112   __u32 u_threshold;
113   __u32 l_threshold;
114 };
115 struct ip_vs_stats_user {
116   __u32 conns;
117   __u32 inpkts;
118   __u32 outpkts;
119   __u64 inbytes;
120   __u64 outbytes;
121   __u32 cps;
122   __u32 inpps;
123   __u32 outpps;
124   __u32 inbps;
125   __u32 outbps;
126 };
127 struct ip_vs_getinfo {
128   unsigned int version;
129   unsigned int size;
130   unsigned int num_services;
131 };
132 struct ip_vs_service_entry {
133   __u16 protocol;
134   __be32 addr;
135   __be16 port;
136   __u32 fwmark;
137   char sched_name[IP_VS_SCHEDNAME_MAXLEN];
138   unsigned int flags;
139   unsigned int timeout;
140   __be32 netmask;
141   unsigned int num_dests;
142   struct ip_vs_stats_user stats;
143 };
144 struct ip_vs_dest_entry {
145   __be32 addr;
146   __be16 port;
147   unsigned int conn_flags;
148   int weight;
149   __u32 u_threshold;
150   __u32 l_threshold;
151   __u32 activeconns;
152   __u32 inactconns;
153   __u32 persistconns;
154   struct ip_vs_stats_user stats;
155 };
156 struct ip_vs_get_dests {
157   __u16 protocol;
158   __be32 addr;
159   __be16 port;
160   __u32 fwmark;
161   unsigned int num_dests;
162   struct ip_vs_dest_entry entrytable[0];
163 };
164 struct ip_vs_get_services {
165   unsigned int num_services;
166   struct ip_vs_service_entry entrytable[0];
167 };
168 struct ip_vs_timeout_user {
169   int tcp_timeout;
170   int tcp_fin_timeout;
171   int udp_timeout;
172 };
173 struct ip_vs_daemon_user {
174   int state;
175   char mcast_ifn[IP_VS_IFNAME_MAXLEN];
176   int syncid;
177 };
178 #define IPVS_GENL_NAME "IPVS"
179 #define IPVS_GENL_VERSION 0x1
180 struct ip_vs_flags {
181   __u32 flags;
182   __u32 mask;
183 };
184 enum {
185   IPVS_CMD_UNSPEC = 0,
186   IPVS_CMD_NEW_SERVICE,
187   IPVS_CMD_SET_SERVICE,
188   IPVS_CMD_DEL_SERVICE,
189   IPVS_CMD_GET_SERVICE,
190   IPVS_CMD_NEW_DEST,
191   IPVS_CMD_SET_DEST,
192   IPVS_CMD_DEL_DEST,
193   IPVS_CMD_GET_DEST,
194   IPVS_CMD_NEW_DAEMON,
195   IPVS_CMD_DEL_DAEMON,
196   IPVS_CMD_GET_DAEMON,
197   IPVS_CMD_SET_CONFIG,
198   IPVS_CMD_GET_CONFIG,
199   IPVS_CMD_SET_INFO,
200   IPVS_CMD_GET_INFO,
201   IPVS_CMD_ZERO,
202   IPVS_CMD_FLUSH,
203   __IPVS_CMD_MAX,
204 };
205 #define IPVS_CMD_MAX (__IPVS_CMD_MAX - 1)
206 enum {
207   IPVS_CMD_ATTR_UNSPEC = 0,
208   IPVS_CMD_ATTR_SERVICE,
209   IPVS_CMD_ATTR_DEST,
210   IPVS_CMD_ATTR_DAEMON,
211   IPVS_CMD_ATTR_TIMEOUT_TCP,
212   IPVS_CMD_ATTR_TIMEOUT_TCP_FIN,
213   IPVS_CMD_ATTR_TIMEOUT_UDP,
214   __IPVS_CMD_ATTR_MAX,
215 };
216 #define IPVS_CMD_ATTR_MAX (__IPVS_CMD_ATTR_MAX - 1)
217 enum {
218   IPVS_SVC_ATTR_UNSPEC = 0,
219   IPVS_SVC_ATTR_AF,
220   IPVS_SVC_ATTR_PROTOCOL,
221   IPVS_SVC_ATTR_ADDR,
222   IPVS_SVC_ATTR_PORT,
223   IPVS_SVC_ATTR_FWMARK,
224   IPVS_SVC_ATTR_SCHED_NAME,
225   IPVS_SVC_ATTR_FLAGS,
226   IPVS_SVC_ATTR_TIMEOUT,
227   IPVS_SVC_ATTR_NETMASK,
228   IPVS_SVC_ATTR_STATS,
229   IPVS_SVC_ATTR_PE_NAME,
230   IPVS_SVC_ATTR_STATS64,
231   __IPVS_SVC_ATTR_MAX,
232 };
233 #define IPVS_SVC_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1)
234 enum {
235   IPVS_DEST_ATTR_UNSPEC = 0,
236   IPVS_DEST_ATTR_ADDR,
237   IPVS_DEST_ATTR_PORT,
238   IPVS_DEST_ATTR_FWD_METHOD,
239   IPVS_DEST_ATTR_WEIGHT,
240   IPVS_DEST_ATTR_U_THRESH,
241   IPVS_DEST_ATTR_L_THRESH,
242   IPVS_DEST_ATTR_ACTIVE_CONNS,
243   IPVS_DEST_ATTR_INACT_CONNS,
244   IPVS_DEST_ATTR_PERSIST_CONNS,
245   IPVS_DEST_ATTR_STATS,
246   IPVS_DEST_ATTR_ADDR_FAMILY,
247   IPVS_DEST_ATTR_STATS64,
248   IPVS_DEST_ATTR_TUN_TYPE,
249   IPVS_DEST_ATTR_TUN_PORT,
250   IPVS_DEST_ATTR_TUN_FLAGS,
251   __IPVS_DEST_ATTR_MAX,
252 };
253 #define IPVS_DEST_ATTR_MAX (__IPVS_DEST_ATTR_MAX - 1)
254 enum {
255   IPVS_DAEMON_ATTR_UNSPEC = 0,
256   IPVS_DAEMON_ATTR_STATE,
257   IPVS_DAEMON_ATTR_MCAST_IFN,
258   IPVS_DAEMON_ATTR_SYNC_ID,
259   IPVS_DAEMON_ATTR_SYNC_MAXLEN,
260   IPVS_DAEMON_ATTR_MCAST_GROUP,
261   IPVS_DAEMON_ATTR_MCAST_GROUP6,
262   IPVS_DAEMON_ATTR_MCAST_PORT,
263   IPVS_DAEMON_ATTR_MCAST_TTL,
264   __IPVS_DAEMON_ATTR_MAX,
265 };
266 #define IPVS_DAEMON_ATTR_MAX (__IPVS_DAEMON_ATTR_MAX - 1)
267 enum {
268   IPVS_STATS_ATTR_UNSPEC = 0,
269   IPVS_STATS_ATTR_CONNS,
270   IPVS_STATS_ATTR_INPKTS,
271   IPVS_STATS_ATTR_OUTPKTS,
272   IPVS_STATS_ATTR_INBYTES,
273   IPVS_STATS_ATTR_OUTBYTES,
274   IPVS_STATS_ATTR_CPS,
275   IPVS_STATS_ATTR_INPPS,
276   IPVS_STATS_ATTR_OUTPPS,
277   IPVS_STATS_ATTR_INBPS,
278   IPVS_STATS_ATTR_OUTBPS,
279   IPVS_STATS_ATTR_PAD,
280   __IPVS_STATS_ATTR_MAX,
281 };
282 #define IPVS_STATS_ATTR_MAX (__IPVS_STATS_ATTR_MAX - 1)
283 enum {
284   IPVS_INFO_ATTR_UNSPEC = 0,
285   IPVS_INFO_ATTR_VERSION,
286   IPVS_INFO_ATTR_CONN_TAB_SIZE,
287   __IPVS_INFO_ATTR_MAX,
288 };
289 #define IPVS_INFO_ATTR_MAX (__IPVS_INFO_ATTR_MAX - 1)
290 #endif
291