aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-09-09 22:51:04 -0400
committerDavid S. Miller <davem@davemloft.net>2008-09-09 22:51:04 -0400
commitdacc62dbf56e872ad96edde0393b9deb56d80cd5 (patch)
tree3d1b3e25aba9c5324bb0f6289033f502fa6ccb8c /include
parent47abf28d5b36521558a848a346064a3a3c82bd9e (diff)
parentc051a0a2c9e283c1123ed3ce65e66e41d2ce5e24 (diff)
Merge branch 'lvs-next-2.6' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/lvs-2.6
Diffstat (limited to 'include')
-rw-r--r--include/net/ip_vs.h308
1 files changed, 238 insertions, 70 deletions
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index a25ad243031d..33e2ac6ceb3e 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -21,11 +21,103 @@
21#include <linux/timer.h> 21#include <linux/timer.h>
22 22
23#include <net/checksum.h> 23#include <net/checksum.h>
24#include <linux/netfilter.h> /* for union nf_inet_addr */
25#include <linux/ipv6.h> /* for struct ipv6hdr */
26#include <net/ipv6.h> /* for ipv6_addr_copy */
27
28struct ip_vs_iphdr {
29 int len;
30 __u8 protocol;
31 union nf_inet_addr saddr;
32 union nf_inet_addr daddr;
33};
34
35static inline void
36ip_vs_fill_iphdr(int af, const void *nh, struct ip_vs_iphdr *iphdr)
37{
38#ifdef CONFIG_IP_VS_IPV6
39 if (af == AF_INET6) {
40 const struct ipv6hdr *iph = nh;
41 iphdr->len = sizeof(struct ipv6hdr);
42 iphdr->protocol = iph->nexthdr;
43 ipv6_addr_copy(&iphdr->saddr.in6, &iph->saddr);
44 ipv6_addr_copy(&iphdr->daddr.in6, &iph->daddr);
45 } else
46#endif
47 {
48 const struct iphdr *iph = nh;
49 iphdr->len = iph->ihl * 4;
50 iphdr->protocol = iph->protocol;
51 iphdr->saddr.ip = iph->saddr;
52 iphdr->daddr.ip = iph->daddr;
53 }
54}
55
56static inline void ip_vs_addr_copy(int af, union nf_inet_addr *dst,
57 const union nf_inet_addr *src)
58{
59#ifdef CONFIG_IP_VS_IPV6
60 if (af == AF_INET6)
61 ipv6_addr_copy(&dst->in6, &src->in6);
62 else
63#endif
64 dst->ip = src->ip;
65}
66
67static inline int ip_vs_addr_equal(int af, const union nf_inet_addr *a,
68 const union nf_inet_addr *b)
69{
70#ifdef CONFIG_IP_VS_IPV6
71 if (af == AF_INET6)
72 return ipv6_addr_equal(&a->in6, &b->in6);
73#endif
74 return a->ip == b->ip;
75}
24 76
25#ifdef CONFIG_IP_VS_DEBUG 77#ifdef CONFIG_IP_VS_DEBUG
26#include <linux/net.h> 78#include <linux/net.h>
27 79
28extern int ip_vs_get_debug_level(void); 80extern int ip_vs_get_debug_level(void);
81
82static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
83 const union nf_inet_addr *addr,
84 int *idx)
85{
86 int len;
87#ifdef CONFIG_IP_VS_IPV6
88 if (af == AF_INET6)
89 len = snprintf(&buf[*idx], buf_len - *idx, "[" NIP6_FMT "]",
90 NIP6(addr->in6)) + 1;
91 else
92#endif
93 len = snprintf(&buf[*idx], buf_len - *idx, NIPQUAD_FMT,
94 NIPQUAD(addr->ip)) + 1;
95
96 *idx += len;
97 BUG_ON(*idx > buf_len + 1);
98 return &buf[*idx - len];
99}
100
101#define IP_VS_DBG_BUF(level, msg...) \
102 do { \
103 char ip_vs_dbg_buf[160]; \
104 int ip_vs_dbg_idx = 0; \
105 if (level <= ip_vs_get_debug_level()) \
106 printk(KERN_DEBUG "IPVS: " msg); \
107 } while (0)
108#define IP_VS_ERR_BUF(msg...) \
109 do { \
110 char ip_vs_dbg_buf[160]; \
111 int ip_vs_dbg_idx = 0; \
112 printk(KERN_ERR "IPVS: " msg); \
113 } while (0)
114
115/* Only use from within IP_VS_DBG_BUF() or IP_VS_ERR_BUF macros */
116#define IP_VS_DBG_ADDR(af, addr) \
117 ip_vs_dbg_addr(af, ip_vs_dbg_buf, \
118 sizeof(ip_vs_dbg_buf), addr, \
119 &ip_vs_dbg_idx)
120
29#define IP_VS_DBG(level, msg...) \ 121#define IP_VS_DBG(level, msg...) \
30 do { \ 122 do { \
31 if (level <= ip_vs_get_debug_level()) \ 123 if (level <= ip_vs_get_debug_level()) \
@@ -48,6 +140,8 @@ extern int ip_vs_get_debug_level(void);
48 pp->debug_packet(pp, skb, ofs, msg); \ 140 pp->debug_packet(pp, skb, ofs, msg); \
49 } while (0) 141 } while (0)
50#else /* NO DEBUGGING at ALL */ 142#else /* NO DEBUGGING at ALL */
143#define IP_VS_DBG_BUF(level, msg...) do {} while (0)
144#define IP_VS_ERR_BUF(msg...) do {} while (0)
51#define IP_VS_DBG(level, msg...) do {} while (0) 145#define IP_VS_DBG(level, msg...) do {} while (0)
52#define IP_VS_DBG_RL(msg...) do {} while (0) 146#define IP_VS_DBG_RL(msg...) do {} while (0)
53#define IP_VS_DBG_PKT(level, pp, skb, ofs, msg) do {} while (0) 147#define IP_VS_DBG_PKT(level, pp, skb, ofs, msg) do {} while (0)
@@ -160,27 +254,10 @@ struct ip_vs_estimator {
160 254
161struct ip_vs_stats 255struct ip_vs_stats
162{ 256{
163 __u32 conns; /* connections scheduled */ 257 struct ip_vs_stats_user ustats; /* statistics */
164 __u32 inpkts; /* incoming packets */ 258 struct ip_vs_estimator est; /* estimator */
165 __u32 outpkts; /* outgoing packets */
166 __u64 inbytes; /* incoming bytes */
167 __u64 outbytes; /* outgoing bytes */
168
169 __u32 cps; /* current connection rate */
170 __u32 inpps; /* current in packet rate */
171 __u32 outpps; /* current out packet rate */
172 __u32 inbps; /* current in byte rate */
173 __u32 outbps; /* current out byte rate */
174
175 /*
176 * Don't add anything before the lock, because we use memcpy() to copy
177 * the members before the lock to struct ip_vs_stats_user in
178 * ip_vs_ctl.c.
179 */
180 259
181 spinlock_t lock; /* spin lock */ 260 spinlock_t lock; /* spin lock */
182
183 struct ip_vs_estimator est; /* estimator */
184}; 261};
185 262
186struct dst_entry; 263struct dst_entry;
@@ -202,21 +279,23 @@ struct ip_vs_protocol {
202 279
203 void (*exit)(struct ip_vs_protocol *pp); 280 void (*exit)(struct ip_vs_protocol *pp);
204 281
205 int (*conn_schedule)(struct sk_buff *skb, 282 int (*conn_schedule)(int af, struct sk_buff *skb,
206 struct ip_vs_protocol *pp, 283 struct ip_vs_protocol *pp,
207 int *verdict, struct ip_vs_conn **cpp); 284 int *verdict, struct ip_vs_conn **cpp);
208 285
209 struct ip_vs_conn * 286 struct ip_vs_conn *
210 (*conn_in_get)(const struct sk_buff *skb, 287 (*conn_in_get)(int af,
288 const struct sk_buff *skb,
211 struct ip_vs_protocol *pp, 289 struct ip_vs_protocol *pp,
212 const struct iphdr *iph, 290 const struct ip_vs_iphdr *iph,
213 unsigned int proto_off, 291 unsigned int proto_off,
214 int inverse); 292 int inverse);
215 293
216 struct ip_vs_conn * 294 struct ip_vs_conn *
217 (*conn_out_get)(const struct sk_buff *skb, 295 (*conn_out_get)(int af,
296 const struct sk_buff *skb,
218 struct ip_vs_protocol *pp, 297 struct ip_vs_protocol *pp,
219 const struct iphdr *iph, 298 const struct ip_vs_iphdr *iph,
220 unsigned int proto_off, 299 unsigned int proto_off,
221 int inverse); 300 int inverse);
222 301
@@ -226,7 +305,8 @@ struct ip_vs_protocol {
226 int (*dnat_handler)(struct sk_buff *skb, 305 int (*dnat_handler)(struct sk_buff *skb,
227 struct ip_vs_protocol *pp, struct ip_vs_conn *cp); 306 struct ip_vs_protocol *pp, struct ip_vs_conn *cp);
228 307
229 int (*csum_check)(struct sk_buff *skb, struct ip_vs_protocol *pp); 308 int (*csum_check)(int af, struct sk_buff *skb,
309 struct ip_vs_protocol *pp);
230 310
231 const char *(*state_name)(int state); 311 const char *(*state_name)(int state);
232 312
@@ -259,9 +339,10 @@ struct ip_vs_conn {
259 struct list_head c_list; /* hashed list heads */ 339 struct list_head c_list; /* hashed list heads */
260 340
261 /* Protocol, addresses and port numbers */ 341 /* Protocol, addresses and port numbers */
262 __be32 caddr; /* client address */ 342 u16 af; /* address family */
263 __be32 vaddr; /* virtual address */ 343 union nf_inet_addr caddr; /* client address */
264 __be32 daddr; /* destination address */ 344 union nf_inet_addr vaddr; /* virtual address */
345 union nf_inet_addr daddr; /* destination address */
265 __be16 cport; 346 __be16 cport;
266 __be16 vport; 347 __be16 vport;
267 __be16 dport; 348 __be16 dport;
@@ -305,6 +386,45 @@ struct ip_vs_conn {
305 386
306 387
307/* 388/*
389 * Extended internal versions of struct ip_vs_service_user and
390 * ip_vs_dest_user for IPv6 support.
391 *
392 * We need these to conveniently pass around service and destination
393 * options, but unfortunately, we also need to keep the old definitions to
394 * maintain userspace backwards compatibility for the setsockopt interface.
395 */
396struct ip_vs_service_user_kern {
397 /* virtual service addresses */
398 u16 af;
399 u16 protocol;
400 union nf_inet_addr addr; /* virtual ip address */
401 u16 port;
402 u32 fwmark; /* firwall mark of service */
403
404 /* virtual service options */
405 char *sched_name;
406 unsigned flags; /* virtual service flags */
407 unsigned timeout; /* persistent timeout in sec */
408 u32 netmask; /* persistent netmask */
409};
410
411
412struct ip_vs_dest_user_kern {
413 /* destination server address */
414 union nf_inet_addr addr;
415 u16 port;
416
417 /* real server options */
418 unsigned conn_flags; /* connection flags */
419 int weight; /* destination weight */
420
421 /* thresholds for active connections */
422 u32 u_threshold; /* upper threshold */
423 u32 l_threshold; /* lower threshold */
424};
425
426
427/*
308 * The information about the virtual service offered to the net 428 * The information about the virtual service offered to the net
309 * and the forwarding entries 429 * and the forwarding entries
310 */ 430 */
@@ -314,8 +434,9 @@ struct ip_vs_service {
314 atomic_t refcnt; /* reference counter */ 434 atomic_t refcnt; /* reference counter */
315 atomic_t usecnt; /* use counter */ 435 atomic_t usecnt; /* use counter */
316 436
437 u16 af; /* address family */
317 __u16 protocol; /* which protocol (TCP/UDP) */ 438 __u16 protocol; /* which protocol (TCP/UDP) */
318 __be32 addr; /* IP address for virtual service */ 439 union nf_inet_addr addr; /* IP address for virtual service */
319 __be16 port; /* port number for the service */ 440 __be16 port; /* port number for the service */
320 __u32 fwmark; /* firewall mark of the service */ 441 __u32 fwmark; /* firewall mark of the service */
321 unsigned flags; /* service status flags */ 442 unsigned flags; /* service status flags */
@@ -342,7 +463,8 @@ struct ip_vs_dest {
342 struct list_head n_list; /* for the dests in the service */ 463 struct list_head n_list; /* for the dests in the service */
343 struct list_head d_list; /* for table with all the dests */ 464 struct list_head d_list; /* for table with all the dests */
344 465
345 __be32 addr; /* IP address of the server */ 466 u16 af; /* address family */
467 union nf_inet_addr addr; /* IP address of the server */
346 __be16 port; /* port number of the server */ 468 __be16 port; /* port number of the server */
347 volatile unsigned flags; /* dest status flags */ 469 volatile unsigned flags; /* dest status flags */
348 atomic_t conn_flags; /* flags to copy to conn */ 470 atomic_t conn_flags; /* flags to copy to conn */
@@ -366,7 +488,7 @@ struct ip_vs_dest {
366 /* for virtual service */ 488 /* for virtual service */
367 struct ip_vs_service *svc; /* service it belongs to */ 489 struct ip_vs_service *svc; /* service it belongs to */
368 __u16 protocol; /* which protocol (TCP/UDP) */ 490 __u16 protocol; /* which protocol (TCP/UDP) */
369 __be32 vaddr; /* virtual IP address */ 491 union nf_inet_addr vaddr; /* virtual IP address */
370 __be16 vport; /* virtual port number */ 492 __be16 vport; /* virtual port number */
371 __u32 vfwmark; /* firewall mark of service */ 493 __u32 vfwmark; /* firewall mark of service */
372}; 494};
@@ -380,6 +502,9 @@ struct ip_vs_scheduler {
380 char *name; /* scheduler name */ 502 char *name; /* scheduler name */
381 atomic_t refcnt; /* reference counter */ 503 atomic_t refcnt; /* reference counter */
382 struct module *module; /* THIS_MODULE/NULL */ 504 struct module *module; /* THIS_MODULE/NULL */
505#ifdef CONFIG_IP_VS_IPV6
506 int supports_ipv6; /* scheduler has IPv6 support */
507#endif
383 508
384 /* scheduler initializing service */ 509 /* scheduler initializing service */
385 int (*init_service)(struct ip_vs_service *svc); 510 int (*init_service)(struct ip_vs_service *svc);
@@ -479,16 +604,8 @@ extern void ip_vs_init_hash_table(struct list_head *table, int rows);
479#ifndef CONFIG_IP_VS_TAB_BITS 604#ifndef CONFIG_IP_VS_TAB_BITS
480#define CONFIG_IP_VS_TAB_BITS 12 605#define CONFIG_IP_VS_TAB_BITS 12
481#endif 606#endif
482/* make sure that IP_VS_CONN_TAB_BITS is located in [8, 20] */ 607
483#if CONFIG_IP_VS_TAB_BITS < 8
484#define IP_VS_CONN_TAB_BITS 8
485#endif
486#if CONFIG_IP_VS_TAB_BITS > 20
487#define IP_VS_CONN_TAB_BITS 20
488#endif
489#if 8 <= CONFIG_IP_VS_TAB_BITS && CONFIG_IP_VS_TAB_BITS <= 20
490#define IP_VS_CONN_TAB_BITS CONFIG_IP_VS_TAB_BITS 608#define IP_VS_CONN_TAB_BITS CONFIG_IP_VS_TAB_BITS
491#endif
492#define IP_VS_CONN_TAB_SIZE (1 << IP_VS_CONN_TAB_BITS) 609#define IP_VS_CONN_TAB_SIZE (1 << IP_VS_CONN_TAB_BITS)
493#define IP_VS_CONN_TAB_MASK (IP_VS_CONN_TAB_SIZE - 1) 610#define IP_VS_CONN_TAB_MASK (IP_VS_CONN_TAB_SIZE - 1)
494 611
@@ -500,11 +617,16 @@ enum {
500}; 617};
501 618
502extern struct ip_vs_conn *ip_vs_conn_in_get 619extern struct ip_vs_conn *ip_vs_conn_in_get
503(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port); 620(int af, int protocol, const union nf_inet_addr *s_addr, __be16 s_port,
621 const union nf_inet_addr *d_addr, __be16 d_port);
622
504extern struct ip_vs_conn *ip_vs_ct_in_get 623extern struct ip_vs_conn *ip_vs_ct_in_get
505(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port); 624(int af, int protocol, const union nf_inet_addr *s_addr, __be16 s_port,
625 const union nf_inet_addr *d_addr, __be16 d_port);
626
506extern struct ip_vs_conn *ip_vs_conn_out_get 627extern struct ip_vs_conn *ip_vs_conn_out_get
507(int protocol, __be32 s_addr, __be16 s_port, __be32 d_addr, __be16 d_port); 628(int af, int protocol, const union nf_inet_addr *s_addr, __be16 s_port,
629 const union nf_inet_addr *d_addr, __be16 d_port);
508 630
509/* put back the conn without restarting its timer */ 631/* put back the conn without restarting its timer */
510static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) 632static inline void __ip_vs_conn_put(struct ip_vs_conn *cp)
@@ -515,8 +637,9 @@ extern void ip_vs_conn_put(struct ip_vs_conn *cp);
515extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport); 637extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport);
516 638
517extern struct ip_vs_conn * 639extern struct ip_vs_conn *
518ip_vs_conn_new(int proto, __be32 caddr, __be16 cport, __be32 vaddr, __be16 vport, 640ip_vs_conn_new(int af, int proto, const union nf_inet_addr *caddr, __be16 cport,
519 __be32 daddr, __be16 dport, unsigned flags, 641 const union nf_inet_addr *vaddr, __be16 vport,
642 const union nf_inet_addr *daddr, __be16 dport, unsigned flags,
520 struct ip_vs_dest *dest); 643 struct ip_vs_dest *dest);
521extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp); 644extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp);
522 645
@@ -532,24 +655,32 @@ static inline void ip_vs_control_del(struct ip_vs_conn *cp)
532{ 655{
533 struct ip_vs_conn *ctl_cp = cp->control; 656 struct ip_vs_conn *ctl_cp = cp->control;
534 if (!ctl_cp) { 657 if (!ctl_cp) {
535 IP_VS_ERR("request control DEL for uncontrolled: " 658 IP_VS_ERR_BUF("request control DEL for uncontrolled: "
536 "%d.%d.%d.%d:%d to %d.%d.%d.%d:%d\n", 659 "%s:%d to %s:%d\n",
537 NIPQUAD(cp->caddr),ntohs(cp->cport), 660 IP_VS_DBG_ADDR(cp->af, &cp->caddr),
538 NIPQUAD(cp->vaddr),ntohs(cp->vport)); 661 ntohs(cp->cport),
662 IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
663 ntohs(cp->vport));
664
539 return; 665 return;
540 } 666 }
541 667
542 IP_VS_DBG(7, "DELeting control for: " 668 IP_VS_DBG_BUF(7, "DELeting control for: "
543 "cp.dst=%d.%d.%d.%d:%d ctl_cp.dst=%d.%d.%d.%d:%d\n", 669 "cp.dst=%s:%d ctl_cp.dst=%s:%d\n",
544 NIPQUAD(cp->caddr),ntohs(cp->cport), 670 IP_VS_DBG_ADDR(cp->af, &cp->caddr),
545 NIPQUAD(ctl_cp->caddr),ntohs(ctl_cp->cport)); 671 ntohs(cp->cport),
672 IP_VS_DBG_ADDR(cp->af, &ctl_cp->caddr),
673 ntohs(ctl_cp->cport));
546 674
547 cp->control = NULL; 675 cp->control = NULL;
548 if (atomic_read(&ctl_cp->n_control) == 0) { 676 if (atomic_read(&ctl_cp->n_control) == 0) {
549 IP_VS_ERR("BUG control DEL with n=0 : " 677 IP_VS_ERR_BUF("BUG control DEL with n=0 : "
550 "%d.%d.%d.%d:%d to %d.%d.%d.%d:%d\n", 678 "%s:%d to %s:%d\n",
551 NIPQUAD(cp->caddr),ntohs(cp->cport), 679 IP_VS_DBG_ADDR(cp->af, &cp->caddr),
552 NIPQUAD(cp->vaddr),ntohs(cp->vport)); 680 ntohs(cp->cport),
681 IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
682 ntohs(cp->vport));
683
553 return; 684 return;
554 } 685 }
555 atomic_dec(&ctl_cp->n_control); 686 atomic_dec(&ctl_cp->n_control);
@@ -559,17 +690,22 @@ static inline void
559ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp) 690ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp)
560{ 691{
561 if (cp->control) { 692 if (cp->control) {
562 IP_VS_ERR("request control ADD for already controlled: " 693 IP_VS_ERR_BUF("request control ADD for already controlled: "
563 "%d.%d.%d.%d:%d to %d.%d.%d.%d:%d\n", 694 "%s:%d to %s:%d\n",
564 NIPQUAD(cp->caddr),ntohs(cp->cport), 695 IP_VS_DBG_ADDR(cp->af, &cp->caddr),
565 NIPQUAD(cp->vaddr),ntohs(cp->vport)); 696 ntohs(cp->cport),
697 IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
698 ntohs(cp->vport));
699
566 ip_vs_control_del(cp); 700 ip_vs_control_del(cp);
567 } 701 }
568 702
569 IP_VS_DBG(7, "ADDing control for: " 703 IP_VS_DBG_BUF(7, "ADDing control for: "
570 "cp.dst=%d.%d.%d.%d:%d ctl_cp.dst=%d.%d.%d.%d:%d\n", 704 "cp.dst=%s:%d ctl_cp.dst=%s:%d\n",
571 NIPQUAD(cp->caddr),ntohs(cp->cport), 705 IP_VS_DBG_ADDR(cp->af, &cp->caddr),
572 NIPQUAD(ctl_cp->caddr),ntohs(ctl_cp->cport)); 706 ntohs(cp->cport),
707 IP_VS_DBG_ADDR(cp->af, &ctl_cp->caddr),
708 ntohs(ctl_cp->cport));
573 709
574 cp->control = ctl_cp; 710 cp->control = ctl_cp;
575 atomic_inc(&ctl_cp->n_control); 711 atomic_inc(&ctl_cp->n_control);
@@ -647,7 +783,8 @@ extern struct ip_vs_stats ip_vs_stats;
647extern const struct ctl_path net_vs_ctl_path[]; 783extern const struct ctl_path net_vs_ctl_path[];
648 784
649extern struct ip_vs_service * 785extern struct ip_vs_service *
650ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport); 786ip_vs_service_get(int af, __u32 fwmark, __u16 protocol,
787 const union nf_inet_addr *vaddr, __be16 vport);
651 788
652static inline void ip_vs_service_put(struct ip_vs_service *svc) 789static inline void ip_vs_service_put(struct ip_vs_service *svc)
653{ 790{
@@ -655,14 +792,16 @@ static inline void ip_vs_service_put(struct ip_vs_service *svc)
655} 792}
656 793
657extern struct ip_vs_dest * 794extern struct ip_vs_dest *
658ip_vs_lookup_real_service(__u16 protocol, __be32 daddr, __be16 dport); 795ip_vs_lookup_real_service(int af, __u16 protocol,
796 const union nf_inet_addr *daddr, __be16 dport);
797
659extern int ip_vs_use_count_inc(void); 798extern int ip_vs_use_count_inc(void);
660extern void ip_vs_use_count_dec(void); 799extern void ip_vs_use_count_dec(void);
661extern int ip_vs_control_init(void); 800extern int ip_vs_control_init(void);
662extern void ip_vs_control_cleanup(void); 801extern void ip_vs_control_cleanup(void);
663extern struct ip_vs_dest * 802extern struct ip_vs_dest *
664ip_vs_find_dest(__be32 daddr, __be16 dport, 803ip_vs_find_dest(int af, const union nf_inet_addr *daddr, __be16 dport,
665 __be32 vaddr, __be16 vport, __u16 protocol); 804 const union nf_inet_addr *vaddr, __be16 vport, __u16 protocol);
666extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp); 805extern struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp);
667 806
668 807
@@ -706,6 +845,19 @@ extern int ip_vs_icmp_xmit
706(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp, int offset); 845(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp, int offset);
707extern void ip_vs_dst_reset(struct ip_vs_dest *dest); 846extern void ip_vs_dst_reset(struct ip_vs_dest *dest);
708 847
848#ifdef CONFIG_IP_VS_IPV6
849extern int ip_vs_bypass_xmit_v6
850(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
851extern int ip_vs_nat_xmit_v6
852(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
853extern int ip_vs_tunnel_xmit_v6
854(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
855extern int ip_vs_dr_xmit_v6
856(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
857extern int ip_vs_icmp_xmit_v6
858(struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp,
859 int offset);
860#endif
709 861
710/* 862/*
711 * This is a simple mechanism to ignore packets when 863 * This is a simple mechanism to ignore packets when
@@ -750,7 +902,12 @@ static inline char ip_vs_fwd_tag(struct ip_vs_conn *cp)
750} 902}
751 903
752extern void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp, 904extern void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp,
753 struct ip_vs_conn *cp, int dir); 905 struct ip_vs_conn *cp, int dir);
906
907#ifdef CONFIG_IP_VS_IPV6
908extern void ip_vs_nat_icmp_v6(struct sk_buff *skb, struct ip_vs_protocol *pp,
909 struct ip_vs_conn *cp, int dir);
910#endif
754 911
755extern __sum16 ip_vs_checksum_complete(struct sk_buff *skb, int offset); 912extern __sum16 ip_vs_checksum_complete(struct sk_buff *skb, int offset);
756 913
@@ -761,6 +918,17 @@ static inline __wsum ip_vs_check_diff4(__be32 old, __be32 new, __wsum oldsum)
761 return csum_partial((char *) diff, sizeof(diff), oldsum); 918 return csum_partial((char *) diff, sizeof(diff), oldsum);
762} 919}
763 920
921#ifdef CONFIG_IP_VS_IPV6
922static inline __wsum ip_vs_check_diff16(const __be32 *old, const __be32 *new,
923 __wsum oldsum)
924{
925 __be32 diff[8] = { ~old[3], ~old[2], ~old[1], ~old[0],
926 new[3], new[2], new[1], new[0] };
927
928 return csum_partial((char *) diff, sizeof(diff), oldsum);
929}
930#endif
931
764static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum) 932static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum)
765{ 933{
766 __be16 diff[2] = { ~old, new }; 934 __be16 diff[2] = { ~old, new };