1 |
commit: e5b05fbed2b4de4849173bca88bf50f4505c2031 |
2 |
Author: Ultrabug <ultrabug <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Feb 7 13:33:50 2011 +0000 |
4 |
Commit: Alexys Jacob <ultrabug <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Feb 7 13:33:50 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=e5b05fbe |
7 |
|
8 |
sys-cluster/keepalived and pacemaker-gui bumps |
9 |
|
10 |
--- |
11 |
...epalived-1.2.2-do-not-need-kernel-sources.patch | 110 +++ |
12 |
.../files/keepalived-1.2.2-linux-2.6.35-ip_vs.h | 950 ++++++++++++++++++++ |
13 |
sys-cluster/keepalived/keepalived-1.2.2.ebuild | 70 ++ |
14 |
.../pacemaker-gui/pacemaker-gui-2.0.0.ebuild | 2 +- |
15 |
4 files changed, 1131 insertions(+), 1 deletions(-) |
16 |
|
17 |
diff --git a/sys-cluster/keepalived/files/keepalived-1.2.2-do-not-need-kernel-sources.patch b/sys-cluster/keepalived/files/keepalived-1.2.2-do-not-need-kernel-sources.patch |
18 |
new file mode 100644 |
19 |
index 0000000..e56cc63 |
20 |
--- /dev/null |
21 |
+++ b/sys-cluster/keepalived/files/keepalived-1.2.2-do-not-need-kernel-sources.patch |
22 |
@@ -0,0 +1,110 @@ |
23 |
+diff -urN keepalived-1.1.20-orig/configure.in keepalived-1.1.20/configure.in |
24 |
+--- keepalived-1.1.20-orig/configure.in 2009-11-05 18:23:04.000000000 +0100 |
25 |
++++ keepalived-1.1.20/configure.in 2010-05-31 11:42:05.000000000 +0200 |
26 |
+@@ -51,103 +51,18 @@ |
27 |
+ AC_CHECK_LIB(popt, poptGetContext,,AC_MSG_ERROR([Popt libraries is required])) |
28 |
+ |
29 |
+ dnl ----[ Kernel version check ]---- |
30 |
+-CPPFLAGS="$CPPFLAGS -I$kernelinc" |
31 |
+-AC_MSG_CHECKING([for kernel version]) |
32 |
+-AC_TRY_RUN([ |
33 |
+- #include <stdlib.h> |
34 |
+- #include <stdio.h> |
35 |
+- #include <linux/version.h> |
36 |
+- #if !defined(UTS_RELEASE) && !defined(LINUX_VERSION_CODE) |
37 |
+- #include <linux/utsrelease.h> |
38 |
+- #endif |
39 |
+- int main (void) { |
40 |
+- FILE *fp = fopen ("linuxinfo", "w"); |
41 |
+- if (!fp) return 1; |
42 |
+- #if defined(UTS_RELEASE) |
43 |
+- fprintf (fp, "%s\n", UTS_RELEASE); |
44 |
+- #elif defined(LINUX_VERSION_CODE) |
45 |
+- fprintf (fp, "%d.%d.%d\n", LINUX_VERSION_CODE >> 16, (LINUX_VERSION_CODE >> 8) & 0xFF, LINUX_VERSION_CODE & 0xFF); |
46 |
+- #else |
47 |
+- fprintf (fp, "0.0.0\n"); /* Let's fail gently */ |
48 |
+- #endif |
49 |
+- fclose (fp); |
50 |
+- return 0; |
51 |
+- } |
52 |
+- ], [ |
53 |
+- LINUX_MAJOR=`cat linuxinfo | cut -d'.' -f1` |
54 |
+- LINUX_MINOR=`cat linuxinfo | cut -d'.' -f2` |
55 |
+- LINUX_PATCH=`cat linuxinfo | cut -d'.' -f3` |
56 |
+- ], [ |
57 |
+- LINUX_MAJOR="0" |
58 |
+- LINUX_MINOR="0" |
59 |
+- LINUX_PATCH="0" |
60 |
+- ], [ |
61 |
+- LINUX_MAJOR="0" |
62 |
+- LINUX_MINOR="0" |
63 |
+- LINUX_PATCH="0" |
64 |
+- ]) |
65 |
+- rm -f linuxinfo |
66 |
+- |
67 |
+- if test "$kernelversion" = "2.4"; then |
68 |
+- KERN="_KRNL_2_4_" |
69 |
+- AC_MSG_RESULT([2.4]) |
70 |
+- elif test "$kernelversion" = "2.6"; then |
71 |
+- KERN="_KRNL_2_6_" |
72 |
+- AC_MSG_RESULT([2.6]) |
73 |
+- else |
74 |
+- AC_MSG_RESULT([$LINUX_MAJOR.$LINUX_MINOR.$LINUX_PATCH]) |
75 |
+- if test "$LINUX_MINOR" = "6"; then |
76 |
+- KERN="_KRNL_2_6_" |
77 |
+- elif test "$LINUX_MINOR" = "4"; then |
78 |
+- KERN="_KRNL_2_4_" |
79 |
+- else |
80 |
+- KERN="_KRNL_2_6_" |
81 |
+- fi |
82 |
+- if test "$LINUX_MAJOR" = "0" -a "$LINUX_MINOR" = "0" -a "$LINUX_PATCH" = "0"; then |
83 |
+- AC_MSG_WARN([Cannot determine Linux Kernel version.]) |
84 |
+- fi |
85 |
+- fi |
86 |
+- |
87 |
++KERN="_KRNL_2_6_" |
88 |
+ AC_SUBST(KERN) |
89 |
+ |
90 |
+ dnl ----[ Checks for LVS and VRRP support ]---- |
91 |
+-IPVS_SUPPORT="_WITHOUT_LVS_" |
92 |
+-if test "$enable_lvs" != "no"; then |
93 |
+- AC_CHECK_HEADER([net/ip_vs.h], |
94 |
+- [IPVS_SUPPORT="_WITH_LVS_"], |
95 |
+- [ |
96 |
+- IPVS_SUPPORT="_WITHOUT_LVS_" |
97 |
+- AC_MSG_WARN([keepalived will be built without LVS support.]) |
98 |
+- ]) |
99 |
+-fi |
100 |
++IPVS_SUPPORT="_WITH_LVS_" |
101 |
+ |
102 |
+ if test "$IPVS_SUPPORT" = "_WITHOUT_LVS_" -a "$enable_vrrp" = "no"; then |
103 |
+ AC_MSG_ERROR([keepalived MUST be compiled at least with LVS or VRRP framework]) |
104 |
+ fi |
105 |
+ |
106 |
+ dnl ----[ IPVS syncd support probe ]--- |
107 |
+-IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_" |
108 |
+-if test "$IPVS_SUPPORT" = "_WITH_LVS_"; then |
109 |
+- AC_MSG_CHECKING([for IPVS syncd support]) |
110 |
+- if test "$KERN" = "_KRNL_2_6_"; then |
111 |
+- IPVS_SYNCD="_HAVE_IPVS_SYNCD_" |
112 |
+- elif test "_KRNL_2_4_"; then |
113 |
+- IPVS_SYNCD="_HAVE_IPVS_SYNCD_" |
114 |
+- else |
115 |
+- IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_" |
116 |
+- fi |
117 |
+- |
118 |
+- if test "${IPVS_SUPPORT}" = "_WITHOUT_LVS_" -o "$enable_lvs_syncd" = "no"; then |
119 |
+- IPVS_SYNCD="_WITHOUT_IPVS_SYNCD_" |
120 |
+- fi |
121 |
+- |
122 |
+- if test "$IPVS_SYNCD" = "_HAVE_IPVS_SYNCD_"; then |
123 |
+- AC_MSG_RESULT([yes]) |
124 |
+- else |
125 |
+- AC_MSG_RESULT([no]) |
126 |
+- fi |
127 |
+-fi |
128 |
+- |
129 |
++IPVS_SYNCD="_HAVE_IPVS_SYNCD_" |
130 |
+ AC_SUBST(IPVS_SYNCD) |
131 |
+ |
132 |
+ dnl ----[ Checks for kernel netlink support ]---- |
133 |
|
134 |
diff --git a/sys-cluster/keepalived/files/keepalived-1.2.2-linux-2.6.35-ip_vs.h b/sys-cluster/keepalived/files/keepalived-1.2.2-linux-2.6.35-ip_vs.h |
135 |
new file mode 100644 |
136 |
index 0000000..fe82b1e |
137 |
--- /dev/null |
138 |
+++ b/sys-cluster/keepalived/files/keepalived-1.2.2-linux-2.6.35-ip_vs.h |
139 |
@@ -0,0 +1,950 @@ |
140 |
+/* |
141 |
+ * IP Virtual Server |
142 |
+ * data structure and functionality definitions |
143 |
+ */ |
144 |
+ |
145 |
+#ifndef _NET_IP_VS_H |
146 |
+#define _NET_IP_VS_H |
147 |
+ |
148 |
+#include <linux/ip_vs.h> /* definitions shared with userland */ |
149 |
+ |
150 |
+/* old ipvsadm versions still include this file directly */ |
151 |
+#ifdef __KERNEL__ |
152 |
+ |
153 |
+#include <asm/types.h> /* for __uXX types */ |
154 |
+ |
155 |
+#include <linux/sysctl.h> /* for ctl_path */ |
156 |
+#include <linux/list.h> /* for struct list_head */ |
157 |
+#include <linux/spinlock.h> /* for struct rwlock_t */ |
158 |
+#include <asm/atomic.h> /* for struct atomic_t */ |
159 |
+#include <linux/compiler.h> |
160 |
+#include <linux/timer.h> |
161 |
+ |
162 |
+#include <net/checksum.h> |
163 |
+#include <linux/netfilter.h> /* for union nf_inet_addr */ |
164 |
+#include <linux/ip.h> |
165 |
+#include <linux/ipv6.h> /* for struct ipv6hdr */ |
166 |
+#include <net/ipv6.h> /* for ipv6_addr_copy */ |
167 |
+ |
168 |
+ |
169 |
+/* Connections' size value needed by ip_vs_ctl.c */ |
170 |
+extern int ip_vs_conn_tab_size; |
171 |
+ |
172 |
+ |
173 |
+struct ip_vs_iphdr { |
174 |
+ int len; |
175 |
+ __u8 protocol; |
176 |
+ union nf_inet_addr saddr; |
177 |
+ union nf_inet_addr daddr; |
178 |
+}; |
179 |
+ |
180 |
+static inline void |
181 |
+ip_vs_fill_iphdr(int af, const void *nh, struct ip_vs_iphdr *iphdr) |
182 |
+{ |
183 |
+#ifdef CONFIG_IP_VS_IPV6 |
184 |
+ if (af == AF_INET6) { |
185 |
+ const struct ipv6hdr *iph = nh; |
186 |
+ iphdr->len = sizeof(struct ipv6hdr); |
187 |
+ iphdr->protocol = iph->nexthdr; |
188 |
+ ipv6_addr_copy(&iphdr->saddr.in6, &iph->saddr); |
189 |
+ ipv6_addr_copy(&iphdr->daddr.in6, &iph->daddr); |
190 |
+ } else |
191 |
+#endif |
192 |
+ { |
193 |
+ const struct iphdr *iph = nh; |
194 |
+ iphdr->len = iph->ihl * 4; |
195 |
+ iphdr->protocol = iph->protocol; |
196 |
+ iphdr->saddr.ip = iph->saddr; |
197 |
+ iphdr->daddr.ip = iph->daddr; |
198 |
+ } |
199 |
+} |
200 |
+ |
201 |
+static inline void ip_vs_addr_copy(int af, union nf_inet_addr *dst, |
202 |
+ const union nf_inet_addr *src) |
203 |
+{ |
204 |
+#ifdef CONFIG_IP_VS_IPV6 |
205 |
+ if (af == AF_INET6) |
206 |
+ ipv6_addr_copy(&dst->in6, &src->in6); |
207 |
+ else |
208 |
+#endif |
209 |
+ dst->ip = src->ip; |
210 |
+} |
211 |
+ |
212 |
+static inline int ip_vs_addr_equal(int af, const union nf_inet_addr *a, |
213 |
+ const union nf_inet_addr *b) |
214 |
+{ |
215 |
+#ifdef CONFIG_IP_VS_IPV6 |
216 |
+ if (af == AF_INET6) |
217 |
+ return ipv6_addr_equal(&a->in6, &b->in6); |
218 |
+#endif |
219 |
+ return a->ip == b->ip; |
220 |
+} |
221 |
+ |
222 |
+#ifdef CONFIG_IP_VS_DEBUG |
223 |
+#include <linux/net.h> |
224 |
+ |
225 |
+extern int ip_vs_get_debug_level(void); |
226 |
+ |
227 |
+static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len, |
228 |
+ const union nf_inet_addr *addr, |
229 |
+ int *idx) |
230 |
+{ |
231 |
+ int len; |
232 |
+#ifdef CONFIG_IP_VS_IPV6 |
233 |
+ if (af == AF_INET6) |
234 |
+ len = snprintf(&buf[*idx], buf_len - *idx, "[%pI6]", |
235 |
+ &addr->in6) + 1; |
236 |
+ else |
237 |
+#endif |
238 |
+ len = snprintf(&buf[*idx], buf_len - *idx, "%pI4", |
239 |
+ &addr->ip) + 1; |
240 |
+ |
241 |
+ *idx += len; |
242 |
+ BUG_ON(*idx > buf_len + 1); |
243 |
+ return &buf[*idx - len]; |
244 |
+} |
245 |
+ |
246 |
+#define IP_VS_DBG_BUF(level, msg, ...) \ |
247 |
+ do { \ |
248 |
+ char ip_vs_dbg_buf[160]; \ |
249 |
+ int ip_vs_dbg_idx = 0; \ |
250 |
+ if (level <= ip_vs_get_debug_level()) \ |
251 |
+ printk(KERN_DEBUG pr_fmt(msg), ##__VA_ARGS__); \ |
252 |
+ } while (0) |
253 |
+#define IP_VS_ERR_BUF(msg...) \ |
254 |
+ do { \ |
255 |
+ char ip_vs_dbg_buf[160]; \ |
256 |
+ int ip_vs_dbg_idx = 0; \ |
257 |
+ pr_err(msg); \ |
258 |
+ } while (0) |
259 |
+ |
260 |
+/* Only use from within IP_VS_DBG_BUF() or IP_VS_ERR_BUF macros */ |
261 |
+#define IP_VS_DBG_ADDR(af, addr) \ |
262 |
+ ip_vs_dbg_addr(af, ip_vs_dbg_buf, \ |
263 |
+ sizeof(ip_vs_dbg_buf), addr, \ |
264 |
+ &ip_vs_dbg_idx) |
265 |
+ |
266 |
+#define IP_VS_DBG(level, msg, ...) \ |
267 |
+ do { \ |
268 |
+ if (level <= ip_vs_get_debug_level()) \ |
269 |
+ printk(KERN_DEBUG pr_fmt(msg), ##__VA_ARGS__); \ |
270 |
+ } while (0) |
271 |
+#define IP_VS_DBG_RL(msg, ...) \ |
272 |
+ do { \ |
273 |
+ if (net_ratelimit()) \ |
274 |
+ printk(KERN_DEBUG pr_fmt(msg), ##__VA_ARGS__); \ |
275 |
+ } while (0) |
276 |
+#define IP_VS_DBG_PKT(level, pp, skb, ofs, msg) \ |
277 |
+ do { \ |
278 |
+ if (level <= ip_vs_get_debug_level()) \ |
279 |
+ pp->debug_packet(pp, skb, ofs, msg); \ |
280 |
+ } while (0) |
281 |
+#define IP_VS_DBG_RL_PKT(level, pp, skb, ofs, msg) \ |
282 |
+ do { \ |
283 |
+ if (level <= ip_vs_get_debug_level() && \ |
284 |
+ net_ratelimit()) \ |
285 |
+ pp->debug_packet(pp, skb, ofs, msg); \ |
286 |
+ } while (0) |
287 |
+#else /* NO DEBUGGING at ALL */ |
288 |
+#define IP_VS_DBG_BUF(level, msg...) do {} while (0) |
289 |
+#define IP_VS_ERR_BUF(msg...) do {} while (0) |
290 |
+#define IP_VS_DBG(level, msg...) do {} while (0) |
291 |
+#define IP_VS_DBG_RL(msg...) do {} while (0) |
292 |
+#define IP_VS_DBG_PKT(level, pp, skb, ofs, msg) do {} while (0) |
293 |
+#define IP_VS_DBG_RL_PKT(level, pp, skb, ofs, msg) do {} while (0) |
294 |
+#endif |
295 |
+ |
296 |
+#define IP_VS_BUG() BUG() |
297 |
+#define IP_VS_ERR_RL(msg, ...) \ |
298 |
+ do { \ |
299 |
+ if (net_ratelimit()) \ |
300 |
+ pr_err(msg, ##__VA_ARGS__); \ |
301 |
+ } while (0) |
302 |
+ |
303 |
+#ifdef CONFIG_IP_VS_DEBUG |
304 |
+#define EnterFunction(level) \ |
305 |
+ do { \ |
306 |
+ if (level <= ip_vs_get_debug_level()) \ |
307 |
+ printk(KERN_DEBUG \ |
308 |
+ pr_fmt("Enter: %s, %s line %i\n"), \ |
309 |
+ __func__, __FILE__, __LINE__); \ |
310 |
+ } while (0) |
311 |
+#define LeaveFunction(level) \ |
312 |
+ do { \ |
313 |
+ if (level <= ip_vs_get_debug_level()) \ |
314 |
+ printk(KERN_DEBUG \ |
315 |
+ pr_fmt("Leave: %s, %s line %i\n"), \ |
316 |
+ __func__, __FILE__, __LINE__); \ |
317 |
+ } while (0) |
318 |
+#else |
319 |
+#define EnterFunction(level) do {} while (0) |
320 |
+#define LeaveFunction(level) do {} while (0) |
321 |
+#endif |
322 |
+ |
323 |
+#define IP_VS_WAIT_WHILE(expr) while (expr) { cpu_relax(); } |
324 |
+ |
325 |
+ |
326 |
+/* |
327 |
+ * The port number of FTP service (in network order). |
328 |
+ */ |
329 |
+#define FTPPORT cpu_to_be16(21) |
330 |
+#define FTPDATA cpu_to_be16(20) |
331 |
+ |
332 |
+/* |
333 |
+ * TCP State Values |
334 |
+ */ |
335 |
+enum { |
336 |
+ IP_VS_TCP_S_NONE = 0, |
337 |
+ IP_VS_TCP_S_ESTABLISHED, |
338 |
+ IP_VS_TCP_S_SYN_SENT, |
339 |
+ IP_VS_TCP_S_SYN_RECV, |
340 |
+ IP_VS_TCP_S_FIN_WAIT, |
341 |
+ IP_VS_TCP_S_TIME_WAIT, |
342 |
+ IP_VS_TCP_S_CLOSE, |
343 |
+ IP_VS_TCP_S_CLOSE_WAIT, |
344 |
+ IP_VS_TCP_S_LAST_ACK, |
345 |
+ IP_VS_TCP_S_LISTEN, |
346 |
+ IP_VS_TCP_S_SYNACK, |
347 |
+ IP_VS_TCP_S_LAST |
348 |
+}; |
349 |
+ |
350 |
+/* |
351 |
+ * UDP State Values |
352 |
+ */ |
353 |
+enum { |
354 |
+ IP_VS_UDP_S_NORMAL, |
355 |
+ IP_VS_UDP_S_LAST, |
356 |
+}; |
357 |
+ |
358 |
+/* |
359 |
+ * ICMP State Values |
360 |
+ */ |
361 |
+enum { |
362 |
+ IP_VS_ICMP_S_NORMAL, |
363 |
+ IP_VS_ICMP_S_LAST, |
364 |
+}; |
365 |
+ |
366 |
+/* |
367 |
+ * SCTP State Values |
368 |
+ */ |
369 |
+enum ip_vs_sctp_states { |
370 |
+ IP_VS_SCTP_S_NONE, |
371 |
+ IP_VS_SCTP_S_INIT_CLI, |
372 |
+ IP_VS_SCTP_S_INIT_SER, |
373 |
+ IP_VS_SCTP_S_INIT_ACK_CLI, |
374 |
+ IP_VS_SCTP_S_INIT_ACK_SER, |
375 |
+ IP_VS_SCTP_S_ECHO_CLI, |
376 |
+ IP_VS_SCTP_S_ECHO_SER, |
377 |
+ IP_VS_SCTP_S_ESTABLISHED, |
378 |
+ IP_VS_SCTP_S_SHUT_CLI, |
379 |
+ IP_VS_SCTP_S_SHUT_SER, |
380 |
+ IP_VS_SCTP_S_SHUT_ACK_CLI, |
381 |
+ IP_VS_SCTP_S_SHUT_ACK_SER, |
382 |
+ IP_VS_SCTP_S_CLOSED, |
383 |
+ IP_VS_SCTP_S_LAST |
384 |
+}; |
385 |
+ |
386 |
+/* |
387 |
+ * Delta sequence info structure |
388 |
+ * Each ip_vs_conn has 2 (output AND input seq. changes). |
389 |
+ * Only used in the VS/NAT. |
390 |
+ */ |
391 |
+struct ip_vs_seq { |
392 |
+ __u32 init_seq; /* Add delta from this seq */ |
393 |
+ __u32 delta; /* Delta in sequence numbers */ |
394 |
+ __u32 previous_delta; /* Delta in sequence numbers |
395 |
+ before last resized pkt */ |
396 |
+}; |
397 |
+ |
398 |
+ |
399 |
+/* |
400 |
+ * IPVS statistics objects |
401 |
+ */ |
402 |
+struct ip_vs_estimator { |
403 |
+ struct list_head list; |
404 |
+ |
405 |
+ u64 last_inbytes; |
406 |
+ u64 last_outbytes; |
407 |
+ u32 last_conns; |
408 |
+ u32 last_inpkts; |
409 |
+ u32 last_outpkts; |
410 |
+ |
411 |
+ u32 cps; |
412 |
+ u32 inpps; |
413 |
+ u32 outpps; |
414 |
+ u32 inbps; |
415 |
+ u32 outbps; |
416 |
+}; |
417 |
+ |
418 |
+struct ip_vs_stats { |
419 |
+ struct ip_vs_stats_user ustats; /* statistics */ |
420 |
+ struct ip_vs_estimator est; /* estimator */ |
421 |
+ |
422 |
+ spinlock_t lock; /* spin lock */ |
423 |
+}; |
424 |
+ |
425 |
+struct dst_entry; |
426 |
+struct iphdr; |
427 |
+struct ip_vs_conn; |
428 |
+struct ip_vs_app; |
429 |
+struct sk_buff; |
430 |
+ |
431 |
+struct ip_vs_protocol { |
432 |
+ struct ip_vs_protocol *next; |
433 |
+ char *name; |
434 |
+ u16 protocol; |
435 |
+ u16 num_states; |
436 |
+ int dont_defrag; |
437 |
+ atomic_t appcnt; /* counter of proto app incs */ |
438 |
+ int *timeout_table; /* protocol timeout table */ |
439 |
+ |
440 |
+ void (*init)(struct ip_vs_protocol *pp); |
441 |
+ |
442 |
+ void (*exit)(struct ip_vs_protocol *pp); |
443 |
+ |
444 |
+ int (*conn_schedule)(int af, struct sk_buff *skb, |
445 |
+ struct ip_vs_protocol *pp, |
446 |
+ int *verdict, struct ip_vs_conn **cpp); |
447 |
+ |
448 |
+ struct ip_vs_conn * |
449 |
+ (*conn_in_get)(int af, |
450 |
+ const struct sk_buff *skb, |
451 |
+ struct ip_vs_protocol *pp, |
452 |
+ const struct ip_vs_iphdr *iph, |
453 |
+ unsigned int proto_off, |
454 |
+ int inverse); |
455 |
+ |
456 |
+ struct ip_vs_conn * |
457 |
+ (*conn_out_get)(int af, |
458 |
+ const struct sk_buff *skb, |
459 |
+ struct ip_vs_protocol *pp, |
460 |
+ const struct ip_vs_iphdr *iph, |
461 |
+ unsigned int proto_off, |
462 |
+ int inverse); |
463 |
+ |
464 |
+ int (*snat_handler)(struct sk_buff *skb, |
465 |
+ struct ip_vs_protocol *pp, struct ip_vs_conn *cp); |
466 |
+ |
467 |
+ int (*dnat_handler)(struct sk_buff *skb, |
468 |
+ struct ip_vs_protocol *pp, struct ip_vs_conn *cp); |
469 |
+ |
470 |
+ int (*csum_check)(int af, struct sk_buff *skb, |
471 |
+ struct ip_vs_protocol *pp); |
472 |
+ |
473 |
+ const char *(*state_name)(int state); |
474 |
+ |
475 |
+ int (*state_transition)(struct ip_vs_conn *cp, int direction, |
476 |
+ const struct sk_buff *skb, |
477 |
+ struct ip_vs_protocol *pp); |
478 |
+ |
479 |
+ int (*register_app)(struct ip_vs_app *inc); |
480 |
+ |
481 |
+ void (*unregister_app)(struct ip_vs_app *inc); |
482 |
+ |
483 |
+ int (*app_conn_bind)(struct ip_vs_conn *cp); |
484 |
+ |
485 |
+ void (*debug_packet)(struct ip_vs_protocol *pp, |
486 |
+ const struct sk_buff *skb, |
487 |
+ int offset, |
488 |
+ const char *msg); |
489 |
+ |
490 |
+ void (*timeout_change)(struct ip_vs_protocol *pp, int flags); |
491 |
+ |
492 |
+ int (*set_state_timeout)(struct ip_vs_protocol *pp, char *sname, int to); |
493 |
+}; |
494 |
+ |
495 |
+extern struct ip_vs_protocol * ip_vs_proto_get(unsigned short proto); |
496 |
+ |
497 |
+/* |
498 |
+ * IP_VS structure allocated for each dynamically scheduled connection |
499 |
+ */ |
500 |
+struct ip_vs_conn { |
501 |
+ struct list_head c_list; /* hashed list heads */ |
502 |
+ |
503 |
+ /* Protocol, addresses and port numbers */ |
504 |
+ u16 af; /* address family */ |
505 |
+ union nf_inet_addr caddr; /* client address */ |
506 |
+ union nf_inet_addr vaddr; /* virtual address */ |
507 |
+ union nf_inet_addr daddr; /* destination address */ |
508 |
+ __be16 cport; |
509 |
+ __be16 vport; |
510 |
+ __be16 dport; |
511 |
+ __u16 protocol; /* Which protocol (TCP/UDP) */ |
512 |
+ |
513 |
+ /* counter and timer */ |
514 |
+ atomic_t refcnt; /* reference count */ |
515 |
+ struct timer_list timer; /* Expiration timer */ |
516 |
+ volatile unsigned long timeout; /* timeout */ |
517 |
+ |
518 |
+ /* Flags and state transition */ |
519 |
+ spinlock_t lock; /* lock for state transition */ |
520 |
+ volatile __u16 flags; /* status flags */ |
521 |
+ volatile __u16 state; /* state info */ |
522 |
+ volatile __u16 old_state; /* old state, to be used for |
523 |
+ * state transition triggerd |
524 |
+ * synchronization |
525 |
+ */ |
526 |
+ |
527 |
+ /* Control members */ |
528 |
+ struct ip_vs_conn *control; /* Master control connection */ |
529 |
+ atomic_t n_control; /* Number of controlled ones */ |
530 |
+ struct ip_vs_dest *dest; /* real server */ |
531 |
+ atomic_t in_pkts; /* incoming packet counter */ |
532 |
+ |
533 |
+ /* packet transmitter for different forwarding methods. If it |
534 |
+ mangles the packet, it must return NF_DROP or better NF_STOLEN, |
535 |
+ otherwise this must be changed to a sk_buff **. |
536 |
+ */ |
537 |
+ int (*packet_xmit)(struct sk_buff *skb, struct ip_vs_conn *cp, |
538 |
+ struct ip_vs_protocol *pp); |
539 |
+ |
540 |
+ /* Note: we can group the following members into a structure, |
541 |
+ in order to save more space, and the following members are |
542 |
+ only used in VS/NAT anyway */ |
543 |
+ struct ip_vs_app *app; /* bound ip_vs_app object */ |
544 |
+ void *app_data; /* Application private data */ |
545 |
+ struct ip_vs_seq in_seq; /* incoming seq. struct */ |
546 |
+ struct ip_vs_seq out_seq; /* outgoing seq. struct */ |
547 |
+}; |
548 |
+ |
549 |
+ |
550 |
+/* |
551 |
+ * Extended internal versions of struct ip_vs_service_user and |
552 |
+ * ip_vs_dest_user for IPv6 support. |
553 |
+ * |
554 |
+ * We need these to conveniently pass around service and destination |
555 |
+ * options, but unfortunately, we also need to keep the old definitions to |
556 |
+ * maintain userspace backwards compatibility for the setsockopt interface. |
557 |
+ */ |
558 |
+struct ip_vs_service_user_kern { |
559 |
+ /* virtual service addresses */ |
560 |
+ u16 af; |
561 |
+ u16 protocol; |
562 |
+ union nf_inet_addr addr; /* virtual ip address */ |
563 |
+ u16 port; |
564 |
+ u32 fwmark; /* firwall mark of service */ |
565 |
+ |
566 |
+ /* virtual service options */ |
567 |
+ char *sched_name; |
568 |
+ unsigned flags; /* virtual service flags */ |
569 |
+ unsigned timeout; /* persistent timeout in sec */ |
570 |
+ u32 netmask; /* persistent netmask */ |
571 |
+}; |
572 |
+ |
573 |
+ |
574 |
+struct ip_vs_dest_user_kern { |
575 |
+ /* destination server address */ |
576 |
+ union nf_inet_addr addr; |
577 |
+ u16 port; |
578 |
+ |
579 |
+ /* real server options */ |
580 |
+ unsigned conn_flags; /* connection flags */ |
581 |
+ int weight; /* destination weight */ |
582 |
+ |
583 |
+ /* thresholds for active connections */ |
584 |
+ u32 u_threshold; /* upper threshold */ |
585 |
+ u32 l_threshold; /* lower threshold */ |
586 |
+}; |
587 |
+ |
588 |
+ |
589 |
+/* |
590 |
+ * The information about the virtual service offered to the net |
591 |
+ * and the forwarding entries |
592 |
+ */ |
593 |
+struct ip_vs_service { |
594 |
+ struct list_head s_list; /* for normal service table */ |
595 |
+ struct list_head f_list; /* for fwmark-based service table */ |
596 |
+ atomic_t refcnt; /* reference counter */ |
597 |
+ atomic_t usecnt; /* use counter */ |
598 |
+ |
599 |
+ u16 af; /* address family */ |
600 |
+ __u16 protocol; /* which protocol (TCP/UDP) */ |
601 |
+ union nf_inet_addr addr; /* IP address for virtual service */ |
602 |
+ __be16 port; /* port number for the service */ |
603 |
+ __u32 fwmark; /* firewall mark of the service */ |
604 |
+ unsigned flags; /* service status flags */ |
605 |
+ unsigned timeout; /* persistent timeout in ticks */ |
606 |
+ __be32 netmask; /* grouping granularity */ |
607 |
+ |
608 |
+ struct list_head destinations; /* real server d-linked list */ |
609 |
+ __u32 num_dests; /* number of servers */ |
610 |
+ struct ip_vs_stats stats; /* statistics for the service */ |
611 |
+ struct ip_vs_app *inc; /* bind conns to this app inc */ |
612 |
+ |
613 |
+ /* for scheduling */ |
614 |
+ struct ip_vs_scheduler *scheduler; /* bound scheduler object */ |
615 |
+ rwlock_t sched_lock; /* lock sched_data */ |
616 |
+ void *sched_data; /* scheduler application data */ |
617 |
+}; |
618 |
+ |
619 |
+ |
620 |
+/* |
621 |
+ * The real server destination forwarding entry |
622 |
+ * with ip address, port number, and so on. |
623 |
+ */ |
624 |
+struct ip_vs_dest { |
625 |
+ struct list_head n_list; /* for the dests in the service */ |
626 |
+ struct list_head d_list; /* for table with all the dests */ |
627 |
+ |
628 |
+ u16 af; /* address family */ |
629 |
+ union nf_inet_addr addr; /* IP address of the server */ |
630 |
+ __be16 port; /* port number of the server */ |
631 |
+ volatile unsigned flags; /* dest status flags */ |
632 |
+ atomic_t conn_flags; /* flags to copy to conn */ |
633 |
+ atomic_t weight; /* server weight */ |
634 |
+ |
635 |
+ atomic_t refcnt; /* reference counter */ |
636 |
+ struct ip_vs_stats stats; /* statistics */ |
637 |
+ |
638 |
+ /* connection counters and thresholds */ |
639 |
+ atomic_t activeconns; /* active connections */ |
640 |
+ atomic_t inactconns; /* inactive connections */ |
641 |
+ atomic_t persistconns; /* persistent connections */ |
642 |
+ __u32 u_threshold; /* upper threshold */ |
643 |
+ __u32 l_threshold; /* lower threshold */ |
644 |
+ |
645 |
+ /* for destination cache */ |
646 |
+ spinlock_t dst_lock; /* lock of dst_cache */ |
647 |
+ struct dst_entry *dst_cache; /* destination cache entry */ |
648 |
+ u32 dst_rtos; /* RT_TOS(tos) for dst */ |
649 |
+ |
650 |
+ /* for virtual service */ |
651 |
+ struct ip_vs_service *svc; /* service it belongs to */ |
652 |
+ __u16 protocol; /* which protocol (TCP/UDP) */ |
653 |
+ union nf_inet_addr vaddr; /* virtual IP address */ |
654 |
+ __be16 vport; /* virtual port number */ |
655 |
+ __u32 vfwmark; /* firewall mark of service */ |
656 |
+}; |
657 |
+ |
658 |
+ |
659 |
+/* |
660 |
+ * The scheduler object |
661 |
+ */ |
662 |
+struct ip_vs_scheduler { |
663 |
+ struct list_head n_list; /* d-linked list head */ |
664 |
+ char *name; /* scheduler name */ |
665 |
+ atomic_t refcnt; /* reference counter */ |
666 |
+ struct module *module; /* THIS_MODULE/NULL */ |
667 |
+ |
668 |
+ /* scheduler initializing service */ |
669 |
+ int (*init_service)(struct ip_vs_service *svc); |
670 |
+ /* scheduling service finish */ |
671 |
+ int (*done_service)(struct ip_vs_service *svc); |
672 |
+ /* scheduler updating service */ |
673 |
+ int (*update_service)(struct ip_vs_service *svc); |
674 |
+ |
675 |
+ /* selecting a server from the given service */ |
676 |
+ struct ip_vs_dest* (*schedule)(struct ip_vs_service *svc, |
677 |
+ const struct sk_buff *skb); |
678 |
+}; |
679 |
+ |
680 |
+ |
681 |
+/* |
682 |
+ * The application module object (a.k.a. app incarnation) |
683 |
+ */ |
684 |
+struct ip_vs_app { |
685 |
+ struct list_head a_list; /* member in app list */ |
686 |
+ int type; /* IP_VS_APP_TYPE_xxx */ |
687 |
+ char *name; /* application module name */ |
688 |
+ __u16 protocol; |
689 |
+ struct module *module; /* THIS_MODULE/NULL */ |
690 |
+ struct list_head incs_list; /* list of incarnations */ |
691 |
+ |
692 |
+ /* members for application incarnations */ |
693 |
+ struct list_head p_list; /* member in proto app list */ |
694 |
+ struct ip_vs_app *app; /* its real application */ |
695 |
+ __be16 port; /* port number in net order */ |
696 |
+ atomic_t usecnt; /* usage counter */ |
697 |
+ |
698 |
+ /* output hook: return false if can't linearize. diff set for TCP. */ |
699 |
+ int (*pkt_out)(struct ip_vs_app *, struct ip_vs_conn *, |
700 |
+ struct sk_buff *, int *diff); |
701 |
+ |
702 |
+ /* input hook: return false if can't linearize. diff set for TCP. */ |
703 |
+ int (*pkt_in)(struct ip_vs_app *, struct ip_vs_conn *, |
704 |
+ struct sk_buff *, int *diff); |
705 |
+ |
706 |
+ /* ip_vs_app initializer */ |
707 |
+ int (*init_conn)(struct ip_vs_app *, struct ip_vs_conn *); |
708 |
+ |
709 |
+ /* ip_vs_app finish */ |
710 |
+ int (*done_conn)(struct ip_vs_app *, struct ip_vs_conn *); |
711 |
+ |
712 |
+ |
713 |
+ /* not used now */ |
714 |
+ int (*bind_conn)(struct ip_vs_app *, struct ip_vs_conn *, |
715 |
+ struct ip_vs_protocol *); |
716 |
+ |
717 |
+ void (*unbind_conn)(struct ip_vs_app *, struct ip_vs_conn *); |
718 |
+ |
719 |
+ int * timeout_table; |
720 |
+ int * timeouts; |
721 |
+ int timeouts_size; |
722 |
+ |
723 |
+ int (*conn_schedule)(struct sk_buff *skb, struct ip_vs_app *app, |
724 |
+ int *verdict, struct ip_vs_conn **cpp); |
725 |
+ |
726 |
+ struct ip_vs_conn * |
727 |
+ (*conn_in_get)(const struct sk_buff *skb, struct ip_vs_app *app, |
728 |
+ const struct iphdr *iph, unsigned int proto_off, |
729 |
+ int inverse); |
730 |
+ |
731 |
+ struct ip_vs_conn * |
732 |
+ (*conn_out_get)(const struct sk_buff *skb, struct ip_vs_app *app, |
733 |
+ const struct iphdr *iph, unsigned int proto_off, |
734 |
+ int inverse); |
735 |
+ |
736 |
+ int (*state_transition)(struct ip_vs_conn *cp, int direction, |
737 |
+ const struct sk_buff *skb, |
738 |
+ struct ip_vs_app *app); |
739 |
+ |
740 |
+ void (*timeout_change)(struct ip_vs_app *app, int flags); |
741 |
+}; |
742 |
+ |
743 |
+ |
744 |
+/* |
745 |
+ * IPVS core functions |
746 |
+ * (from ip_vs_core.c) |
747 |
+ */ |
748 |
+extern const char *ip_vs_proto_name(unsigned proto); |
749 |
+extern void ip_vs_init_hash_table(struct list_head *table, int rows); |
750 |
+#define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table((t), ARRAY_SIZE((t))) |
751 |
+ |
752 |
+#define IP_VS_APP_TYPE_FTP 1 |
753 |
+ |
754 |
+/* |
755 |
+ * ip_vs_conn handling functions |
756 |
+ * (from ip_vs_conn.c) |
757 |
+ */ |
758 |
+ |
759 |
+enum { |
760 |
+ IP_VS_DIR_INPUT = 0, |
761 |
+ IP_VS_DIR_OUTPUT, |
762 |
+ IP_VS_DIR_INPUT_ONLY, |
763 |
+ IP_VS_DIR_LAST, |
764 |
+}; |
765 |
+ |
766 |
+extern struct ip_vs_conn *ip_vs_conn_in_get |
767 |
+(int af, int protocol, const union nf_inet_addr *s_addr, __be16 s_port, |
768 |
+ const union nf_inet_addr *d_addr, __be16 d_port); |
769 |
+ |
770 |
+extern struct ip_vs_conn *ip_vs_ct_in_get |
771 |
+(int af, int protocol, const union nf_inet_addr *s_addr, __be16 s_port, |
772 |
+ const union nf_inet_addr *d_addr, __be16 d_port); |
773 |
+ |
774 |
+extern struct ip_vs_conn *ip_vs_conn_out_get |
775 |
+(int af, int protocol, const union nf_inet_addr *s_addr, __be16 s_port, |
776 |
+ const union nf_inet_addr *d_addr, __be16 d_port); |
777 |
+ |
778 |
+/* put back the conn without restarting its timer */ |
779 |
+static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) |
780 |
+{ |
781 |
+ atomic_dec(&cp->refcnt); |
782 |
+} |
783 |
+extern void ip_vs_conn_put(struct ip_vs_conn *cp); |
784 |
+extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport); |
785 |
+ |
786 |
+extern struct ip_vs_conn * |
787 |
+ip_vs_conn_new(int af, int proto, const union nf_inet_addr *caddr, __be16 cport, |
788 |
+ const union nf_inet_addr *vaddr, __be16 vport, |
789 |
+ const union nf_inet_addr *daddr, __be16 dport, unsigned flags, |
790 |
+ struct ip_vs_dest *dest); |
791 |
+extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp); |
792 |
+ |
793 |
+extern const char * ip_vs_state_name(__u16 proto, int state); |
794 |
+ |
795 |
+extern void ip_vs_tcp_conn_listen(struct ip_vs_conn *cp); |
796 |
+extern int ip_vs_check_template(struct ip_vs_conn *ct); |
797 |
+extern void ip_vs_random_dropentry(void); |
798 |
+extern int ip_vs_conn_init(void); |
799 |
+extern void ip_vs_conn_cleanup(void); |
800 |
+ |
801 |
+static inline void ip_vs_control_del(struct ip_vs_conn *cp) |
802 |
+{ |
803 |
+ struct ip_vs_conn *ctl_cp = cp->control; |
804 |
+ if (!ctl_cp) { |
805 |
+ IP_VS_ERR_BUF("request control DEL for uncontrolled: " |
806 |
+ "%s:%d to %s:%d\n", |
807 |
+ IP_VS_DBG_ADDR(cp->af, &cp->caddr), |
808 |
+ ntohs(cp->cport), |
809 |
+ IP_VS_DBG_ADDR(cp->af, &cp->vaddr), |
810 |
+ ntohs(cp->vport)); |
811 |
+ |
812 |
+ return; |
813 |
+ } |
814 |
+ |
815 |
+ IP_VS_DBG_BUF(7, "DELeting control for: " |
816 |
+ "cp.dst=%s:%d ctl_cp.dst=%s:%d\n", |
817 |
+ IP_VS_DBG_ADDR(cp->af, &cp->caddr), |
818 |
+ ntohs(cp->cport), |
819 |
+ IP_VS_DBG_ADDR(cp->af, &ctl_cp->caddr), |
820 |
+ ntohs(ctl_cp->cport)); |
821 |
+ |
822 |
+ cp->control = NULL; |
823 |
+ if (atomic_read(&ctl_cp->n_control) == 0) { |
824 |
+ IP_VS_ERR_BUF("BUG control DEL with n=0 : " |
825 |
+ "%s:%d to %s:%d\n", |
826 |
+ IP_VS_DBG_ADDR(cp->af, &cp->caddr), |
827 |
+ ntohs(cp->cport), |
828 |
+ IP_VS_DBG_ADDR(cp->af, &cp->vaddr), |
829 |
+ ntohs(cp->vport)); |
830 |
+ |
831 |
+ return; |
832 |
+ } |
833 |
+ atomic_dec(&ctl_cp->n_control); |
834 |
+} |
835 |
+ |
836 |
+static inline void |
837 |
+ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp) |
838 |
+{ |
839 |
+ if (cp->control) { |
840 |
+ IP_VS_ERR_BUF("request control ADD for already controlled: " |
841 |
+ "%s:%d to %s:%d\n", |
842 |
+ IP_VS_DBG_ADDR(cp->af, &cp->caddr), |
843 |
+ ntohs(cp->cport), |
844 |
+ IP_VS_DBG_ADDR(cp->af, &cp->vaddr), |
845 |
+ ntohs(cp->vport)); |
846 |
+ |
847 |
+ ip_vs_control_del(cp); |
848 |
+ } |
849 |
+ |
850 |
+ IP_VS_DBG_BUF(7, "ADDing control for: " |
851 |
+ "cp.dst=%s:%d ctl_cp.dst=%s:%d\n", |
852 |
+ IP_VS_DBG_ADDR(cp->af, &cp->caddr), |
853 |
+ ntohs(cp->cport), |
854 |
+ IP_VS_DBG_ADDR(cp->af, &ctl_cp->caddr), |
855 |
+ ntohs(ctl_cp->cport)); |
856 |
+ |
857 |
+ cp->control = ctl_cp; |
858 |
+ atomic_inc(&ctl_cp->n_control); |
859 |
+} |
860 |
+ |
861 |
+ |
862 |
+/* |
863 |
+ * IPVS application functions |
864 |
+ * (from ip_vs_app.c) |
865 |
+ */ |
866 |
+#define IP_VS_APP_MAX_PORTS 8 |
867 |
+extern int register_ip_vs_app(struct ip_vs_app *app); |
868 |
+extern void unregister_ip_vs_app(struct ip_vs_app *app); |
869 |
+extern int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp); |
870 |
+extern void ip_vs_unbind_app(struct ip_vs_conn *cp); |
871 |
+extern int |
872 |
+register_ip_vs_app_inc(struct ip_vs_app *app, __u16 proto, __u16 port); |
873 |
+extern int ip_vs_app_inc_get(struct ip_vs_app *inc); |
874 |
+extern void ip_vs_app_inc_put(struct ip_vs_app *inc); |
875 |
+ |
876 |
+extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb); |
877 |
+extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb); |
878 |
+extern int ip_vs_skb_replace(struct sk_buff *skb, gfp_t pri, |
879 |
+ char *o_buf, int o_len, char *n_buf, int n_len); |
880 |
+extern int ip_vs_app_init(void); |
881 |
+extern void ip_vs_app_cleanup(void); |
882 |
+ |
883 |
+ |
884 |
+/* |
885 |
+ * IPVS protocol functions (from ip_vs_proto.c) |
886 |
+ */ |
887 |
+extern int ip_vs_protocol_init(void); |
888 |
+extern void ip_vs_protocol_cleanup(void); |
889 |
+extern void ip_vs_protocol_timeout_change(int flags); |
890 |
+extern int *ip_vs_create_timeout_table(int *table, int size); |
891 |
+extern int |
892 |
+ip_vs_set_state_timeout(int *table, int num, const char *const *names, |
893 |
+ const char *name, int to); |
894 |
+extern void |
895 |
+ip_vs_tcpudp_debug_packet(struct ip_vs_protocol *pp, const struct sk_buff *skb, |
896 |
+ int offset, const char *msg); |
897 |
+ |
898 |
+extern struct ip_vs_protocol ip_vs_protocol_tcp; |
899 |
+extern struct ip_vs_protocol ip_vs_protocol_udp; |
900 |
+extern struct ip_vs_protocol ip_vs_protocol_icmp; |
901 |
+extern struct ip_vs_protocol ip_vs_protocol_esp; |
902 |
+extern struct ip_vs_protocol ip_vs_protocol_ah; |
903 |
+extern struct ip_vs_protocol ip_vs_protocol_sctp; |
904 |
+ |
905 |
+/* |
906 |
+ * Registering/unregistering scheduler functions |
907 |
+ * (from ip_vs_sched.c) |
908 |
+ */ |
909 |
+extern int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); |
910 |
+extern int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); |
911 |
+extern int ip_vs_bind_scheduler(struct ip_vs_service *svc, |
912 |
+ struct ip_vs_scheduler *scheduler); |
913 |
+extern int ip_vs_unbind_scheduler(struct ip_vs_service *svc); |
914 |
+extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name); |
915 |
+extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); |
916 |
+extern struct ip_vs_conn * |
917 |
+ip_vs_schedule(struct ip_vs_service *svc, const struct sk_buff *skb); |
918 |
+extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, |
919 |
+ struct ip_vs_protocol *pp); |
920 |
+ |
921 |
+ |
922 |
+/* |
923 |
+ * IPVS control data and functions (from ip_vs_ctl.c) |
924 |
+ */ |
925 |
+extern int sysctl_ip_vs_cache_bypass; |
926 |
+extern int sysctl_ip_vs_expire_nodest_conn; |
927 |
+extern int sysctl_ip_vs_expire_quiescent_template; |
928 |
+extern int sysctl_ip_vs_sync_threshold[2]; |
929 |
+extern int sysctl_ip_vs_nat_icmp_send; |
930 |
+extern struct ip_vs_stats ip_vs_stats; |
931 |
+extern const struct ctl_path net_vs_ctl_path[]; |
932 |
+ |
933 |
+extern struct ip_vs_service * |
934 |
+ip_vs_service_get(int af, __u32 fwmark, __u16 protocol, |
935 |
+ const union nf_inet_addr *vaddr, __be16 vport); |
936 |
+ |
937 |
+static inline void ip_vs_service_put(struct ip_vs_service *svc) |
938 |
+{ |
939 |
+ atomic_dec(&svc->usecnt); |
940 |
+} |
941 |
+ |
942 |
+extern struct ip_vs_dest * |
943 |
+ip_vs_lookup_real_service(int af, __u16 protocol, |
944 |
+ const union nf_inet_addr *daddr, __be16 dport); |
945 |
+ |
946 |
+extern int ip_vs_use_count_inc(void); |
947 |
+extern void ip_vs_use_count_dec(void); |
948 |
+extern int ip_vs_control_init(void); |
949 |
+extern void ip_vs_control_cleanup(void); |
950 |
+extern struct ip_vs_dest * |
951 |
+ip_vs_find_dest(int af, const union nf_inet_addr *daddr, __be16 dport, |
952 |
+ const union nf_inet_addr *vaddr, __be16 vport, __u16 protocol); |
953 |
+extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp); |
954 |
+ |
955 |
+ |
956 |
+/* |
957 |
+ * IPVS sync daemon data and function prototypes |
958 |
+ * (from ip_vs_sync.c) |
959 |
+ */ |
960 |
+extern volatile int ip_vs_sync_state; |
961 |
+extern volatile int ip_vs_master_syncid; |
962 |
+extern volatile int ip_vs_backup_syncid; |
963 |
+extern char ip_vs_master_mcast_ifn[IP_VS_IFNAME_MAXLEN]; |
964 |
+extern char ip_vs_backup_mcast_ifn[IP_VS_IFNAME_MAXLEN]; |
965 |
+extern int start_sync_thread(int state, char *mcast_ifn, __u8 syncid); |
966 |
+extern int stop_sync_thread(int state); |
967 |
+extern void ip_vs_sync_conn(struct ip_vs_conn *cp); |
968 |
+ |
969 |
+ |
970 |
+/* |
971 |
+ * IPVS rate estimator prototypes (from ip_vs_est.c) |
972 |
+ */ |
973 |
+extern int ip_vs_estimator_init(void); |
974 |
+extern void ip_vs_estimator_cleanup(void); |
975 |
+extern void ip_vs_new_estimator(struct ip_vs_stats *stats); |
976 |
+extern void ip_vs_kill_estimator(struct ip_vs_stats *stats); |
977 |
+extern void ip_vs_zero_estimator(struct ip_vs_stats *stats); |
978 |
+ |
979 |
+/* |
980 |
+ * Various IPVS packet transmitters (from ip_vs_xmit.c) |
981 |
+ */ |
982 |
+extern int ip_vs_null_xmit |
983 |
+(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); |
984 |
+extern int ip_vs_bypass_xmit |
985 |
+(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); |
986 |
+extern int ip_vs_nat_xmit |
987 |
+(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); |
988 |
+extern int ip_vs_tunnel_xmit |
989 |
+(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); |
990 |
+extern int ip_vs_dr_xmit |
991 |
+(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); |
992 |
+extern int ip_vs_icmp_xmit |
993 |
+(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp, int offset); |
994 |
+extern void ip_vs_dst_reset(struct ip_vs_dest *dest); |
995 |
+ |
996 |
+#ifdef CONFIG_IP_VS_IPV6 |
997 |
+extern int ip_vs_bypass_xmit_v6 |
998 |
+(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); |
999 |
+extern int ip_vs_nat_xmit_v6 |
1000 |
+(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); |
1001 |
+extern int ip_vs_tunnel_xmit_v6 |
1002 |
+(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); |
1003 |
+extern int ip_vs_dr_xmit_v6 |
1004 |
+(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); |
1005 |
+extern int ip_vs_icmp_xmit_v6 |
1006 |
+(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp, |
1007 |
+ int offset); |
1008 |
+#endif |
1009 |
+ |
1010 |
+/* |
1011 |
+ * This is a simple mechanism to ignore packets when |
1012 |
+ * we are loaded. Just set ip_vs_drop_rate to 'n' and |
1013 |
+ * we start to drop 1/rate of the packets |
1014 |
+ */ |
1015 |
+extern int ip_vs_drop_rate; |
1016 |
+extern int ip_vs_drop_counter; |
1017 |
+ |
1018 |
+static __inline__ int ip_vs_todrop(void) |
1019 |
+{ |
1020 |
+ if (!ip_vs_drop_rate) return 0; |
1021 |
+ if (--ip_vs_drop_counter > 0) return 0; |
1022 |
+ ip_vs_drop_counter = ip_vs_drop_rate; |
1023 |
+ return 1; |
1024 |
+} |
1025 |
+ |
1026 |
+/* |
1027 |
+ * ip_vs_fwd_tag returns the forwarding tag of the connection |
1028 |
+ */ |
1029 |
+#define IP_VS_FWD_METHOD(cp) (cp->flags & IP_VS_CONN_F_FWD_MASK) |
1030 |
+ |
1031 |
+static inline char ip_vs_fwd_tag(struct ip_vs_conn *cp) |
1032 |
+{ |
1033 |
+ char fwd; |
1034 |
+ |
1035 |
+ switch (IP_VS_FWD_METHOD(cp)) { |
1036 |
+ case IP_VS_CONN_F_MASQ: |
1037 |
+ fwd = 'M'; break; |
1038 |
+ case IP_VS_CONN_F_LOCALNODE: |
1039 |
+ fwd = 'L'; break; |
1040 |
+ case IP_VS_CONN_F_TUNNEL: |
1041 |
+ fwd = 'T'; break; |
1042 |
+ case IP_VS_CONN_F_DROUTE: |
1043 |
+ fwd = 'R'; break; |
1044 |
+ case IP_VS_CONN_F_BYPASS: |
1045 |
+ fwd = 'B'; break; |
1046 |
+ default: |
1047 |
+ fwd = '?'; break; |
1048 |
+ } |
1049 |
+ return fwd; |
1050 |
+} |
1051 |
+ |
1052 |
+extern void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp, |
1053 |
+ struct ip_vs_conn *cp, int dir); |
1054 |
+ |
1055 |
+#ifdef CONFIG_IP_VS_IPV6 |
1056 |
+extern void ip_vs_nat_icmp_v6(struct sk_buff *skb, struct ip_vs_protocol *pp, |
1057 |
+ struct ip_vs_conn *cp, int dir); |
1058 |
+#endif |
1059 |
+ |
1060 |
+extern __sum16 ip_vs_checksum_complete(struct sk_buff *skb, int offset); |
1061 |
+ |
1062 |
+static inline __wsum ip_vs_check_diff4(__be32 old, __be32 new, __wsum oldsum) |
1063 |
+{ |
1064 |
+ __be32 diff[2] = { ~old, new }; |
1065 |
+ |
1066 |
+ return csum_partial(diff, sizeof(diff), oldsum); |
1067 |
+} |
1068 |
+ |
1069 |
+#ifdef CONFIG_IP_VS_IPV6 |
1070 |
+static inline __wsum ip_vs_check_diff16(const __be32 *old, const __be32 *new, |
1071 |
+ __wsum oldsum) |
1072 |
+{ |
1073 |
+ __be32 diff[8] = { ~old[3], ~old[2], ~old[1], ~old[0], |
1074 |
+ new[3], new[2], new[1], new[0] }; |
1075 |
+ |
1076 |
+ return csum_partial(diff, sizeof(diff), oldsum); |
1077 |
+} |
1078 |
+#endif |
1079 |
+ |
1080 |
+static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum) |
1081 |
+{ |
1082 |
+ __be16 diff[2] = { ~old, new }; |
1083 |
+ |
1084 |
+ return csum_partial(diff, sizeof(diff), oldsum); |
1085 |
+} |
1086 |
+ |
1087 |
+#endif /* __KERNEL__ */ |
1088 |
+ |
1089 |
+#endif /* _NET_IP_VS_H */ |
1090 |
|
1091 |
diff --git a/sys-cluster/keepalived/keepalived-1.2.2.ebuild b/sys-cluster/keepalived/keepalived-1.2.2.ebuild |
1092 |
new file mode 100644 |
1093 |
index 0000000..8159701 |
1094 |
--- /dev/null |
1095 |
+++ b/sys-cluster/keepalived/keepalived-1.2.2.ebuild |
1096 |
@@ -0,0 +1,70 @@ |
1097 |
+# Copyright 1999-2010 Gentoo Foundation |
1098 |
+# Distributed under the terms of the GNU General Public License v2 |
1099 |
+# $Header: $ |
1100 |
+ |
1101 |
+EAPI=3 |
1102 |
+ |
1103 |
+inherit flag-o-matic autotools base |
1104 |
+ |
1105 |
+DESCRIPTION="A strong & robust keepalive facility to the Linux Virtual Server project" |
1106 |
+HOMEPAGE="http://www.keepalived.org/" |
1107 |
+SRC_URI="http://www.keepalived.org/software/${P}.tar.gz" |
1108 |
+ |
1109 |
+LICENSE="GPL-2" |
1110 |
+SLOT="0" |
1111 |
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86" |
1112 |
+IUSE="debug +lvs" |
1113 |
+ |
1114 |
+RDEPEND="dev-libs/popt |
1115 |
+ sys-apps/iproute2 |
1116 |
+ dev-libs/openssl |
1117 |
+ lvs? ( sys-cluster/ipvsadm )" |
1118 |
+DEPEND="${RDEPEND} |
1119 |
+ =sys-kernel/linux-headers-2.6*" |
1120 |
+ |
1121 |
+use lvs && PATCHES=( "${FILESDIR}/${P}-do-not-need-kernel-sources.patch" ) |
1122 |
+ |
1123 |
+src_prepare() { |
1124 |
+ base_src_prepare |
1125 |
+ |
1126 |
+ if use lvs; then |
1127 |
+ # Prepare a suitable copy of the IPVS headers |
1128 |
+ # So that we don't need kernel sources at all! |
1129 |
+ mkdir -p "${S}"/include/net || die "Failed to prepare ipvs header directory" |
1130 |
+ cp -f "${FILESDIR}"/${PN}-1.2.1-linux-2.6.35-ip_vs.h \ |
1131 |
+ "${S}"/include/net/ip_vs.h || die "Failed to add ipvs header" |
1132 |
+ |
1133 |
+ # Ensure that keepalived can find the header that we are injecting |
1134 |
+ append-flags -I"${S}"/include |
1135 |
+ |
1136 |
+ eautoreconf |
1137 |
+ fi |
1138 |
+} |
1139 |
+ |
1140 |
+src_configure() { |
1141 |
+ STRIP=/bin/true \ |
1142 |
+ econf \ |
1143 |
+ --enable-vrrp \ |
1144 |
+ $(use_enable lvs) \ |
1145 |
+ $(use_enable lvs lvs-syncd) \ |
1146 |
+ $(use_enable debug) |
1147 |
+} |
1148 |
+ |
1149 |
+src_install() { |
1150 |
+ base_src_install |
1151 |
+ |
1152 |
+ newinitd "${FILESDIR}"/init-keepalived keepalived || die |
1153 |
+ |
1154 |
+ dodoc doc/keepalived.conf.SYNOPSIS || die |
1155 |
+ dodoc README CONTRIBUTORS INSTALL VERSION ChangeLog AUTHOR TODO || die |
1156 |
+ |
1157 |
+ docinto genhash |
1158 |
+ dodoc genhash/README genhash/AUTHOR genhash/ChangeLog genhash/VERSION || die |
1159 |
+ # This was badly named by upstream, it's more HOWTO than anything else. |
1160 |
+ newdoc INSTALL INSTALL+HOWTO || die |
1161 |
+ |
1162 |
+ # Security risk to bundle SSL certs |
1163 |
+ rm -f "${D}"/etc/keepalived/samples/*.pem |
1164 |
+ # Clean up sysvinit files |
1165 |
+ rm -rf "${D}"/etc/sysconfig "${D}"/etc/rc.d/ |
1166 |
+} |
1167 |
|
1168 |
diff --git a/sys-cluster/pacemaker-gui/pacemaker-gui-2.0.0.ebuild b/sys-cluster/pacemaker-gui/pacemaker-gui-2.0.0.ebuild |
1169 |
index 592b5e3..e1cf1ef 100644 |
1170 |
--- a/sys-cluster/pacemaker-gui/pacemaker-gui-2.0.0.ebuild |
1171 |
+++ b/sys-cluster/pacemaker-gui/pacemaker-gui-2.0.0.ebuild |
1172 |
@@ -27,7 +27,7 @@ CDEPEND=" |
1173 |
sys-apps/util-linux |
1174 |
dev-lang/swig |
1175 |
sys-cluster/cluster-glue |
1176 |
- >=sys-cluster/pacemaker-1.1[ais?,heartbeat?] |
1177 |
+ >=sys-cluster/pacemaker-1.1 |
1178 |
!heartbeat? ( !ais? ( sys-cluster/pacemaker[ais] ) ) |
1179 |
sys-libs/ncurses |
1180 |
sys-libs/pam |