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