aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/ip_vs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/ip_vs.h')
-rw-r--r--include/net/ip_vs.h253
1 files changed, 8 insertions, 245 deletions
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 9a51ebad3f1f..cbb59ebed4ae 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -3,254 +3,17 @@
3 * data structure and functionality definitions 3 * data structure and functionality definitions
4 */ 4 */
5 5
6#ifndef _IP_VS_H 6#ifndef _NET_IP_VS_H
7#define _IP_VS_H 7#define _NET_IP_VS_H
8
9#include <asm/types.h> /* For __uXX types */
10#include <linux/types.h> /* For __beXX types in userland */
11
12#include <linux/sysctl.h> /* For ctl_path */
13
14#define IP_VS_VERSION_CODE 0x010201
15#define NVERSION(version) \
16 (version >> 16) & 0xFF, \
17 (version >> 8) & 0xFF, \
18 version & 0xFF
19
20/*
21 * Virtual Service Flags
22 */
23#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */
24#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */
25
26/*
27 * Destination Server Flags
28 */
29#define IP_VS_DEST_F_AVAILABLE 0x0001 /* server is available */
30#define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */
31
32/*
33 * IPVS sync daemon states
34 */
35#define IP_VS_STATE_NONE 0x0000 /* daemon is stopped */
36#define IP_VS_STATE_MASTER 0x0001 /* started as master */
37#define IP_VS_STATE_BACKUP 0x0002 /* started as backup */
38
39/*
40 * IPVS socket options
41 */
42#define IP_VS_BASE_CTL (64+1024+64) /* base */
43
44#define IP_VS_SO_SET_NONE IP_VS_BASE_CTL /* just peek */
45#define IP_VS_SO_SET_INSERT (IP_VS_BASE_CTL+1)
46#define IP_VS_SO_SET_ADD (IP_VS_BASE_CTL+2)
47#define IP_VS_SO_SET_EDIT (IP_VS_BASE_CTL+3)
48#define IP_VS_SO_SET_DEL (IP_VS_BASE_CTL+4)
49#define IP_VS_SO_SET_FLUSH (IP_VS_BASE_CTL+5)
50#define IP_VS_SO_SET_LIST (IP_VS_BASE_CTL+6)
51#define IP_VS_SO_SET_ADDDEST (IP_VS_BASE_CTL+7)
52#define IP_VS_SO_SET_DELDEST (IP_VS_BASE_CTL+8)
53#define IP_VS_SO_SET_EDITDEST (IP_VS_BASE_CTL+9)
54#define IP_VS_SO_SET_TIMEOUT (IP_VS_BASE_CTL+10)
55#define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11)
56#define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12)
57#define IP_VS_SO_SET_RESTORE (IP_VS_BASE_CTL+13)
58#define IP_VS_SO_SET_SAVE (IP_VS_BASE_CTL+14)
59#define IP_VS_SO_SET_ZERO (IP_VS_BASE_CTL+15)
60#define IP_VS_SO_SET_MAX IP_VS_SO_SET_ZERO
61
62#define IP_VS_SO_GET_VERSION IP_VS_BASE_CTL
63#define IP_VS_SO_GET_INFO (IP_VS_BASE_CTL+1)
64#define IP_VS_SO_GET_SERVICES (IP_VS_BASE_CTL+2)
65#define IP_VS_SO_GET_SERVICE (IP_VS_BASE_CTL+3)
66#define IP_VS_SO_GET_DESTS (IP_VS_BASE_CTL+4)
67#define IP_VS_SO_GET_DEST (IP_VS_BASE_CTL+5) /* not used now */
68#define IP_VS_SO_GET_TIMEOUT (IP_VS_BASE_CTL+6)
69#define IP_VS_SO_GET_DAEMON (IP_VS_BASE_CTL+7)
70#define IP_VS_SO_GET_MAX IP_VS_SO_GET_DAEMON
71
72
73/*
74 * IPVS Connection Flags
75 */
76#define IP_VS_CONN_F_FWD_MASK 0x0007 /* mask for the fwd methods */
77#define IP_VS_CONN_F_MASQ 0x0000 /* masquerading/NAT */
78#define IP_VS_CONN_F_LOCALNODE 0x0001 /* local node */
79#define IP_VS_CONN_F_TUNNEL 0x0002 /* tunneling */
80#define IP_VS_CONN_F_DROUTE 0x0003 /* direct routing */
81#define IP_VS_CONN_F_BYPASS 0x0004 /* cache bypass */
82#define IP_VS_CONN_F_SYNC 0x0020 /* entry created by sync */
83#define IP_VS_CONN_F_HASHED 0x0040 /* hashed entry */
84#define IP_VS_CONN_F_NOOUTPUT 0x0080 /* no output packets */
85#define IP_VS_CONN_F_INACTIVE 0x0100 /* not established */
86#define IP_VS_CONN_F_OUT_SEQ 0x0200 /* must do output seq adjust */
87#define IP_VS_CONN_F_IN_SEQ 0x0400 /* must do input seq adjust */
88#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */
89#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */
90#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
91
92/* Move it to better place one day, for now keep it unique */
93#define NFC_IPVS_PROPERTY 0x10000
94
95#define IP_VS_SCHEDNAME_MAXLEN 16
96#define IP_VS_IFNAME_MAXLEN 16
97
98
99/*
100 * The struct ip_vs_service_user and struct ip_vs_dest_user are
101 * used to set IPVS rules through setsockopt.
102 */
103struct ip_vs_service_user {
104 /* virtual service addresses */
105 u_int16_t protocol;
106 __be32 addr; /* virtual ip address */
107 __be16 port;
108 u_int32_t fwmark; /* firwall mark of service */
109
110 /* virtual service options */
111 char sched_name[IP_VS_SCHEDNAME_MAXLEN];
112 unsigned flags; /* virtual service flags */
113 unsigned timeout; /* persistent timeout in sec */
114 __be32 netmask; /* persistent netmask */
115};
116
117
118struct ip_vs_dest_user {
119 /* destination server address */
120 __be32 addr;
121 __be16 port;
122
123 /* real server options */
124 unsigned conn_flags; /* connection flags */
125 int weight; /* destination weight */
126
127 /* thresholds for active connections */
128 u_int32_t u_threshold; /* upper threshold */
129 u_int32_t l_threshold; /* lower threshold */
130};
131
132
133/*
134 * IPVS statistics object (for user space)
135 */
136struct ip_vs_stats_user
137{
138 __u32 conns; /* connections scheduled */
139 __u32 inpkts; /* incoming packets */
140 __u32 outpkts; /* outgoing packets */
141 __u64 inbytes; /* incoming bytes */
142 __u64 outbytes; /* outgoing bytes */
143
144 __u32 cps; /* current connection rate */
145 __u32 inpps; /* current in packet rate */
146 __u32 outpps; /* current out packet rate */
147 __u32 inbps; /* current in byte rate */
148 __u32 outbps; /* current out byte rate */
149};
150
151
152/* The argument to IP_VS_SO_GET_INFO */
153struct ip_vs_getinfo {
154 /* version number */
155 unsigned int version;
156
157 /* size of connection hash table */
158 unsigned int size;
159
160 /* number of virtual services */
161 unsigned int num_services;
162};
163
164
165/* The argument to IP_VS_SO_GET_SERVICE */
166struct ip_vs_service_entry {
167 /* which service: user fills in these */
168 u_int16_t protocol;
169 __be32 addr; /* virtual address */
170 __be16 port;
171 u_int32_t fwmark; /* firwall mark of service */
172
173 /* service options */
174 char sched_name[IP_VS_SCHEDNAME_MAXLEN];
175 unsigned flags; /* virtual service flags */
176 unsigned timeout; /* persistent timeout */
177 __be32 netmask; /* persistent netmask */
178
179 /* number of real servers */
180 unsigned int num_dests;
181
182 /* statistics */
183 struct ip_vs_stats_user stats;
184};
185
186
187struct ip_vs_dest_entry {
188 __be32 addr; /* destination address */
189 __be16 port;
190 unsigned conn_flags; /* connection flags */
191 int weight; /* destination weight */
192
193 u_int32_t u_threshold; /* upper threshold */
194 u_int32_t l_threshold; /* lower threshold */
195
196 u_int32_t activeconns; /* active connections */
197 u_int32_t inactconns; /* inactive connections */
198 u_int32_t persistconns; /* persistent connections */
199
200 /* statistics */
201 struct ip_vs_stats_user stats;
202};
203
204
205/* The argument to IP_VS_SO_GET_DESTS */
206struct ip_vs_get_dests {
207 /* which service: user fills in these */
208 u_int16_t protocol;
209 __be32 addr; /* virtual address */
210 __be16 port;
211 u_int32_t fwmark; /* firwall mark of service */
212
213 /* number of real servers */
214 unsigned int num_dests;
215
216 /* the real servers */
217 struct ip_vs_dest_entry entrytable[0];
218};
219
220
221/* The argument to IP_VS_SO_GET_SERVICES */
222struct ip_vs_get_services {
223 /* number of virtual services */
224 unsigned int num_services;
225
226 /* service table */
227 struct ip_vs_service_entry entrytable[0];
228};
229
230
231/* The argument to IP_VS_SO_GET_TIMEOUT */
232struct ip_vs_timeout_user {
233 int tcp_timeout;
234 int tcp_fin_timeout;
235 int udp_timeout;
236};
237
238
239/* The argument to IP_VS_SO_GET_DAEMON */
240struct ip_vs_daemon_user {
241 /* sync daemon state (master/backup) */
242 int state;
243
244 /* multicast interface name */
245 char mcast_ifn[IP_VS_IFNAME_MAXLEN];
246
247 /* SyncID we belong to */
248 int syncid;
249};
250 8
9#include <linux/ip_vs.h> /* definitions shared with userland */
251 10
11/* old ipvsadm versions still include this file directly */
252#ifdef __KERNEL__ 12#ifdef __KERNEL__
253 13
14#include <asm/types.h> /* for __uXX types */
15
16#include <linux/sysctl.h> /* for ctl_path */
254#include <linux/list.h> /* for struct list_head */ 17#include <linux/list.h> /* for struct list_head */
255#include <linux/spinlock.h> /* for struct rwlock_t */ 18#include <linux/spinlock.h> /* for struct rwlock_t */
256#include <asm/atomic.h> /* for struct atomic_t */ 19#include <asm/atomic.h> /* for struct atomic_t */
@@ -981,4 +744,4 @@ static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum)
981 744
982#endif /* __KERNEL__ */ 745#endif /* __KERNEL__ */
983 746
984#endif /* _IP_VS_H */ 747#endif /* _NET_IP_VS_H */