aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/ip_vs.h18
-rw-r--r--net/ipv4/ipvs/ip_vs_conn.c60
-rw-r--r--net/ipv4/ipvs/ip_vs_core.c28
-rw-r--r--net/ipv4/ipvs/ip_vs_ctl.c37
-rw-r--r--net/ipv4/ipvs/ip_vs_dh.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_ftp.c18
-rw-r--r--net/ipv4/ipvs/ip_vs_lblc.c4
-rw-r--r--net/ipv4/ipvs/ip_vs_lblcr.c8
-rw-r--r--net/ipv4/ipvs/ip_vs_lc.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_nq.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_proto_tcp.c16
-rw-r--r--net/ipv4/ipvs/ip_vs_proto_udp.c12
-rw-r--r--net/ipv4/ipvs/ip_vs_rr.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_sed.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_sh.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_sync.c6
-rw-r--r--net/ipv4/ipvs/ip_vs_wlc.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_wrr.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_xmit.c12
19 files changed, 121 insertions, 114 deletions
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index a25ad243031d..d32825585500 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -21,6 +21,9 @@
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 */
24 27
25#ifdef CONFIG_IP_VS_DEBUG 28#ifdef CONFIG_IP_VS_DEBUG
26#include <linux/net.h> 29#include <linux/net.h>
@@ -259,9 +262,10 @@ struct ip_vs_conn {
259 struct list_head c_list; /* hashed list heads */ 262 struct list_head c_list; /* hashed list heads */
260 263
261 /* Protocol, addresses and port numbers */ 264 /* Protocol, addresses and port numbers */
262 __be32 caddr; /* client address */ 265 u16 af; /* address family */
263 __be32 vaddr; /* virtual address */ 266 union nf_inet_addr caddr; /* client address */
264 __be32 daddr; /* destination address */ 267 union nf_inet_addr vaddr; /* virtual address */
268 union nf_inet_addr daddr; /* destination address */
265 __be16 cport; 269 __be16 cport;
266 __be16 vport; 270 __be16 vport;
267 __be16 dport; 271 __be16 dport;
@@ -314,8 +318,9 @@ struct ip_vs_service {
314 atomic_t refcnt; /* reference counter */ 318 atomic_t refcnt; /* reference counter */
315 atomic_t usecnt; /* use counter */ 319 atomic_t usecnt; /* use counter */
316 320
321 u16 af; /* address family */
317 __u16 protocol; /* which protocol (TCP/UDP) */ 322 __u16 protocol; /* which protocol (TCP/UDP) */
318 __be32 addr; /* IP address for virtual service */ 323 union nf_inet_addr addr; /* IP address for virtual service */
319 __be16 port; /* port number for the service */ 324 __be16 port; /* port number for the service */
320 __u32 fwmark; /* firewall mark of the service */ 325 __u32 fwmark; /* firewall mark of the service */
321 unsigned flags; /* service status flags */ 326 unsigned flags; /* service status flags */
@@ -342,7 +347,8 @@ struct ip_vs_dest {
342 struct list_head n_list; /* for the dests in the service */ 347 struct list_head n_list; /* for the dests in the service */
343 struct list_head d_list; /* for table with all the dests */ 348 struct list_head d_list; /* for table with all the dests */
344 349
345 __be32 addr; /* IP address of the server */ 350 u16 af; /* address family */
351 union nf_inet_addr addr; /* IP address of the server */
346 __be16 port; /* port number of the server */ 352 __be16 port; /* port number of the server */
347 volatile unsigned flags; /* dest status flags */ 353 volatile unsigned flags; /* dest status flags */
348 atomic_t conn_flags; /* flags to copy to conn */ 354 atomic_t conn_flags; /* flags to copy to conn */
@@ -366,7 +372,7 @@ struct ip_vs_dest {
366 /* for virtual service */ 372 /* for virtual service */
367 struct ip_vs_service *svc; /* service it belongs to */ 373 struct ip_vs_service *svc; /* service it belongs to */
368 __u16 protocol; /* which protocol (TCP/UDP) */ 374 __u16 protocol; /* which protocol (TCP/UDP) */
369 __be32 vaddr; /* virtual IP address */ 375 union nf_inet_addr vaddr; /* virtual IP address */
370 __be16 vport; /* virtual port number */ 376 __be16 vport; /* virtual port number */
371 __u32 vfwmark; /* firewall mark of service */ 377 __u32 vfwmark; /* firewall mark of service */
372}; 378};
diff --git a/net/ipv4/ipvs/ip_vs_conn.c b/net/ipv4/ipvs/ip_vs_conn.c
index 44a6872dc245..639d4bc7fc1d 100644
--- a/net/ipv4/ipvs/ip_vs_conn.c
+++ b/net/ipv4/ipvs/ip_vs_conn.c
@@ -131,7 +131,7 @@ static inline int ip_vs_conn_hash(struct ip_vs_conn *cp)
131 int ret; 131 int ret;
132 132
133 /* Hash by protocol, client address and port */ 133 /* Hash by protocol, client address and port */
134 hash = ip_vs_conn_hashkey(cp->protocol, cp->caddr, cp->cport); 134 hash = ip_vs_conn_hashkey(cp->protocol, cp->caddr.ip, cp->cport);
135 135
136 ct_write_lock(hash); 136 ct_write_lock(hash);
137 137
@@ -162,7 +162,7 @@ static inline int ip_vs_conn_unhash(struct ip_vs_conn *cp)
162 int ret; 162 int ret;
163 163
164 /* unhash it and decrease its reference counter */ 164 /* unhash it and decrease its reference counter */
165 hash = ip_vs_conn_hashkey(cp->protocol, cp->caddr, cp->cport); 165 hash = ip_vs_conn_hashkey(cp->protocol, cp->caddr.ip, cp->cport);
166 166
167 ct_write_lock(hash); 167 ct_write_lock(hash);
168 168
@@ -197,10 +197,10 @@ static inline struct ip_vs_conn *__ip_vs_conn_in_get
197 ct_read_lock(hash); 197 ct_read_lock(hash);
198 198
199 list_for_each_entry(cp, &ip_vs_conn_tab[hash], c_list) { 199 list_for_each_entry(cp, &ip_vs_conn_tab[hash], c_list) {
200 if (s_addr==cp->caddr && s_port==cp->cport && 200 if (s_addr == cp->caddr.ip && s_port == cp->cport &&
201 d_port==cp->vport && d_addr==cp->vaddr && 201 d_port == cp->vport && d_addr == cp->vaddr.ip &&
202 ((!s_port) ^ (!(cp->flags & IP_VS_CONN_F_NO_CPORT))) && 202 ((!s_port) ^ (!(cp->flags & IP_VS_CONN_F_NO_CPORT))) &&
203 protocol==cp->protocol) { 203 protocol == cp->protocol) {
204 /* HIT */ 204 /* HIT */
205 atomic_inc(&cp->refcnt); 205 atomic_inc(&cp->refcnt);
206 ct_read_unlock(hash); 206 ct_read_unlock(hash);
@@ -243,10 +243,10 @@ struct ip_vs_conn *ip_vs_ct_in_get
243 ct_read_lock(hash); 243 ct_read_lock(hash);
244 244
245 list_for_each_entry(cp, &ip_vs_conn_tab[hash], c_list) { 245 list_for_each_entry(cp, &ip_vs_conn_tab[hash], c_list) {
246 if (s_addr==cp->caddr && s_port==cp->cport && 246 if (s_addr == cp->caddr.ip && s_port == cp->cport &&
247 d_port==cp->vport && d_addr==cp->vaddr && 247 d_port == cp->vport && d_addr == cp->vaddr.ip &&
248 cp->flags & IP_VS_CONN_F_TEMPLATE && 248 cp->flags & IP_VS_CONN_F_TEMPLATE &&
249 protocol==cp->protocol) { 249 protocol == cp->protocol) {
250 /* HIT */ 250 /* HIT */
251 atomic_inc(&cp->refcnt); 251 atomic_inc(&cp->refcnt);
252 goto out; 252 goto out;
@@ -286,8 +286,8 @@ struct ip_vs_conn *ip_vs_conn_out_get
286 ct_read_lock(hash); 286 ct_read_lock(hash);
287 287
288 list_for_each_entry(cp, &ip_vs_conn_tab[hash], c_list) { 288 list_for_each_entry(cp, &ip_vs_conn_tab[hash], c_list) {
289 if (d_addr == cp->caddr && d_port == cp->cport && 289 if (d_addr == cp->caddr.ip && d_port == cp->cport &&
290 s_port == cp->dport && s_addr == cp->daddr && 290 s_port == cp->dport && s_addr == cp->daddr.ip &&
291 protocol == cp->protocol) { 291 protocol == cp->protocol) {
292 /* HIT */ 292 /* HIT */
293 atomic_inc(&cp->refcnt); 293 atomic_inc(&cp->refcnt);
@@ -406,9 +406,9 @@ ip_vs_bind_dest(struct ip_vs_conn *cp, struct ip_vs_dest *dest)
406 "d:%u.%u.%u.%u:%d fwd:%c s:%u conn->flags:%X conn->refcnt:%d " 406 "d:%u.%u.%u.%u:%d fwd:%c s:%u conn->flags:%X conn->refcnt:%d "
407 "dest->refcnt:%d\n", 407 "dest->refcnt:%d\n",
408 ip_vs_proto_name(cp->protocol), 408 ip_vs_proto_name(cp->protocol),
409 NIPQUAD(cp->caddr), ntohs(cp->cport), 409 NIPQUAD(cp->caddr.ip), ntohs(cp->cport),
410 NIPQUAD(cp->vaddr), ntohs(cp->vport), 410 NIPQUAD(cp->vaddr.ip), ntohs(cp->vport),
411 NIPQUAD(cp->daddr), ntohs(cp->dport), 411 NIPQUAD(cp->daddr.ip), ntohs(cp->dport),
412 ip_vs_fwd_tag(cp), cp->state, 412 ip_vs_fwd_tag(cp), cp->state,
413 cp->flags, atomic_read(&cp->refcnt), 413 cp->flags, atomic_read(&cp->refcnt),
414 atomic_read(&dest->refcnt)); 414 atomic_read(&dest->refcnt));
@@ -444,8 +444,8 @@ struct ip_vs_dest *ip_vs_try_bind_dest(struct ip_vs_conn *cp)
444 struct ip_vs_dest *dest; 444 struct ip_vs_dest *dest;
445 445
446 if ((cp) && (!cp->dest)) { 446 if ((cp) && (!cp->dest)) {
447 dest = ip_vs_find_dest(cp->daddr, cp->dport, 447 dest = ip_vs_find_dest(cp->daddr.ip, cp->dport,
448 cp->vaddr, cp->vport, cp->protocol); 448 cp->vaddr.ip, cp->vport, cp->protocol);
449 ip_vs_bind_dest(cp, dest); 449 ip_vs_bind_dest(cp, dest);
450 return dest; 450 return dest;
451 } else 451 } else
@@ -468,9 +468,9 @@ static inline void ip_vs_unbind_dest(struct ip_vs_conn *cp)
468 "d:%u.%u.%u.%u:%d fwd:%c s:%u conn->flags:%X conn->refcnt:%d " 468 "d:%u.%u.%u.%u:%d fwd:%c s:%u conn->flags:%X conn->refcnt:%d "
469 "dest->refcnt:%d\n", 469 "dest->refcnt:%d\n",
470 ip_vs_proto_name(cp->protocol), 470 ip_vs_proto_name(cp->protocol),
471 NIPQUAD(cp->caddr), ntohs(cp->cport), 471 NIPQUAD(cp->caddr.ip), ntohs(cp->cport),
472 NIPQUAD(cp->vaddr), ntohs(cp->vport), 472 NIPQUAD(cp->vaddr.ip), ntohs(cp->vport),
473 NIPQUAD(cp->daddr), ntohs(cp->dport), 473 NIPQUAD(cp->daddr.ip), ntohs(cp->dport),
474 ip_vs_fwd_tag(cp), cp->state, 474 ip_vs_fwd_tag(cp), cp->state,
475 cp->flags, atomic_read(&cp->refcnt), 475 cp->flags, atomic_read(&cp->refcnt),
476 atomic_read(&dest->refcnt)); 476 atomic_read(&dest->refcnt));
@@ -530,9 +530,9 @@ int ip_vs_check_template(struct ip_vs_conn *ct)
530 "protocol %s s:%u.%u.%u.%u:%d v:%u.%u.%u.%u:%d " 530 "protocol %s s:%u.%u.%u.%u:%d v:%u.%u.%u.%u:%d "
531 "-> d:%u.%u.%u.%u:%d\n", 531 "-> d:%u.%u.%u.%u:%d\n",
532 ip_vs_proto_name(ct->protocol), 532 ip_vs_proto_name(ct->protocol),
533 NIPQUAD(ct->caddr), ntohs(ct->cport), 533 NIPQUAD(ct->caddr.ip), ntohs(ct->cport),
534 NIPQUAD(ct->vaddr), ntohs(ct->vport), 534 NIPQUAD(ct->vaddr.ip), ntohs(ct->vport),
535 NIPQUAD(ct->daddr), ntohs(ct->dport)); 535 NIPQUAD(ct->daddr.ip), ntohs(ct->dport));
536 536
537 /* 537 /*
538 * Invalidate the connection template 538 * Invalidate the connection template
@@ -641,11 +641,11 @@ ip_vs_conn_new(int proto, __be32 caddr, __be16 cport, __be32 vaddr, __be16 vport
641 INIT_LIST_HEAD(&cp->c_list); 641 INIT_LIST_HEAD(&cp->c_list);
642 setup_timer(&cp->timer, ip_vs_conn_expire, (unsigned long)cp); 642 setup_timer(&cp->timer, ip_vs_conn_expire, (unsigned long)cp);
643 cp->protocol = proto; 643 cp->protocol = proto;
644 cp->caddr = caddr; 644 cp->caddr.ip = caddr;
645 cp->cport = cport; 645 cp->cport = cport;
646 cp->vaddr = vaddr; 646 cp->vaddr.ip = vaddr;
647 cp->vport = vport; 647 cp->vport = vport;
648 cp->daddr = daddr; 648 cp->daddr.ip = daddr;
649 cp->dport = dport; 649 cp->dport = dport;
650 cp->flags = flags; 650 cp->flags = flags;
651 spin_lock_init(&cp->lock); 651 spin_lock_init(&cp->lock);
@@ -763,9 +763,9 @@ static int ip_vs_conn_seq_show(struct seq_file *seq, void *v)
763 seq_printf(seq, 763 seq_printf(seq,
764 "%-3s %08X %04X %08X %04X %08X %04X %-11s %7lu\n", 764 "%-3s %08X %04X %08X %04X %08X %04X %-11s %7lu\n",
765 ip_vs_proto_name(cp->protocol), 765 ip_vs_proto_name(cp->protocol),
766 ntohl(cp->caddr), ntohs(cp->cport), 766 ntohl(cp->caddr.ip), ntohs(cp->cport),
767 ntohl(cp->vaddr), ntohs(cp->vport), 767 ntohl(cp->vaddr.ip), ntohs(cp->vport),
768 ntohl(cp->daddr), ntohs(cp->dport), 768 ntohl(cp->daddr.ip), ntohs(cp->dport),
769 ip_vs_state_name(cp->protocol, cp->state), 769 ip_vs_state_name(cp->protocol, cp->state),
770 (cp->timer.expires-jiffies)/HZ); 770 (cp->timer.expires-jiffies)/HZ);
771 } 771 }
@@ -812,9 +812,9 @@ static int ip_vs_conn_sync_seq_show(struct seq_file *seq, void *v)
812 seq_printf(seq, 812 seq_printf(seq,
813 "%-3s %08X %04X %08X %04X %08X %04X %-11s %-6s %7lu\n", 813 "%-3s %08X %04X %08X %04X %08X %04X %-11s %-6s %7lu\n",
814 ip_vs_proto_name(cp->protocol), 814 ip_vs_proto_name(cp->protocol),
815 ntohl(cp->caddr), ntohs(cp->cport), 815 ntohl(cp->caddr.ip), ntohs(cp->cport),
816 ntohl(cp->vaddr), ntohs(cp->vport), 816 ntohl(cp->vaddr.ip), ntohs(cp->vport),
817 ntohl(cp->daddr), ntohs(cp->dport), 817 ntohl(cp->daddr.ip), ntohs(cp->dport),
818 ip_vs_state_name(cp->protocol, cp->state), 818 ip_vs_state_name(cp->protocol, cp->state),
819 ip_vs_origin_name(cp->flags), 819 ip_vs_origin_name(cp->flags),
820 (cp->timer.expires-jiffies)/HZ); 820 (cp->timer.expires-jiffies)/HZ);
diff --git a/net/ipv4/ipvs/ip_vs_core.c b/net/ipv4/ipvs/ip_vs_core.c
index 9fbf0a6d7392..4a54f33b60d4 100644
--- a/net/ipv4/ipvs/ip_vs_core.c
+++ b/net/ipv4/ipvs/ip_vs_core.c
@@ -232,14 +232,14 @@ ip_vs_sched_persist(struct ip_vs_service *svc,
232 snet, 0, 232 snet, 0,
233 iph->daddr, 233 iph->daddr,
234 ports[1], 234 ports[1],
235 dest->addr, dest->port, 235 dest->addr.ip, dest->port,
236 IP_VS_CONN_F_TEMPLATE, 236 IP_VS_CONN_F_TEMPLATE,
237 dest); 237 dest);
238 else 238 else
239 ct = ip_vs_conn_new(iph->protocol, 239 ct = ip_vs_conn_new(iph->protocol,
240 snet, 0, 240 snet, 0,
241 iph->daddr, 0, 241 iph->daddr, 0,
242 dest->addr, 0, 242 dest->addr.ip, 0,
243 IP_VS_CONN_F_TEMPLATE, 243 IP_VS_CONN_F_TEMPLATE,
244 dest); 244 dest);
245 if (ct == NULL) 245 if (ct == NULL)
@@ -286,14 +286,14 @@ ip_vs_sched_persist(struct ip_vs_service *svc,
286 ct = ip_vs_conn_new(IPPROTO_IP, 286 ct = ip_vs_conn_new(IPPROTO_IP,
287 snet, 0, 287 snet, 0,
288 htonl(svc->fwmark), 0, 288 htonl(svc->fwmark), 0,
289 dest->addr, 0, 289 dest->addr.ip, 0,
290 IP_VS_CONN_F_TEMPLATE, 290 IP_VS_CONN_F_TEMPLATE,
291 dest); 291 dest);
292 else 292 else
293 ct = ip_vs_conn_new(iph->protocol, 293 ct = ip_vs_conn_new(iph->protocol,
294 snet, 0, 294 snet, 0,
295 iph->daddr, 0, 295 iph->daddr, 0,
296 dest->addr, 0, 296 dest->addr.ip, 0,
297 IP_VS_CONN_F_TEMPLATE, 297 IP_VS_CONN_F_TEMPLATE,
298 dest); 298 dest);
299 if (ct == NULL) 299 if (ct == NULL)
@@ -313,7 +313,7 @@ ip_vs_sched_persist(struct ip_vs_service *svc,
313 cp = ip_vs_conn_new(iph->protocol, 313 cp = ip_vs_conn_new(iph->protocol,
314 iph->saddr, ports[0], 314 iph->saddr, ports[0],
315 iph->daddr, ports[1], 315 iph->daddr, ports[1],
316 dest->addr, dport, 316 dest->addr.ip, dport,
317 0, 317 0,
318 dest); 318 dest);
319 if (cp == NULL) { 319 if (cp == NULL) {
@@ -380,7 +380,7 @@ ip_vs_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)
380 cp = ip_vs_conn_new(iph->protocol, 380 cp = ip_vs_conn_new(iph->protocol,
381 iph->saddr, pptr[0], 381 iph->saddr, pptr[0],
382 iph->daddr, pptr[1], 382 iph->daddr, pptr[1],
383 dest->addr, dest->port?dest->port:pptr[1], 383 dest->addr.ip, dest->port ? dest->port : pptr[1],
384 0, 384 0,
385 dest); 385 dest);
386 if (cp == NULL) 386 if (cp == NULL)
@@ -389,9 +389,9 @@ ip_vs_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)
389 IP_VS_DBG(6, "Schedule fwd:%c c:%u.%u.%u.%u:%u v:%u.%u.%u.%u:%u " 389 IP_VS_DBG(6, "Schedule fwd:%c c:%u.%u.%u.%u:%u v:%u.%u.%u.%u:%u "
390 "d:%u.%u.%u.%u:%u conn->flags:%X conn->refcnt:%d\n", 390 "d:%u.%u.%u.%u:%u conn->flags:%X conn->refcnt:%d\n",
391 ip_vs_fwd_tag(cp), 391 ip_vs_fwd_tag(cp),
392 NIPQUAD(cp->caddr), ntohs(cp->cport), 392 NIPQUAD(cp->caddr.ip), ntohs(cp->cport),
393 NIPQUAD(cp->vaddr), ntohs(cp->vport), 393 NIPQUAD(cp->vaddr.ip), ntohs(cp->vport),
394 NIPQUAD(cp->daddr), ntohs(cp->dport), 394 NIPQUAD(cp->daddr.ip), ntohs(cp->dport),
395 cp->flags, atomic_read(&cp->refcnt)); 395 cp->flags, atomic_read(&cp->refcnt));
396 396
397 ip_vs_conn_stats(cp, svc); 397 ip_vs_conn_stats(cp, svc);
@@ -526,14 +526,14 @@ void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp,
526 struct iphdr *ciph = (struct iphdr *)(icmph + 1); 526 struct iphdr *ciph = (struct iphdr *)(icmph + 1);
527 527
528 if (inout) { 528 if (inout) {
529 iph->saddr = cp->vaddr; 529 iph->saddr = cp->vaddr.ip;
530 ip_send_check(iph); 530 ip_send_check(iph);
531 ciph->daddr = cp->vaddr; 531 ciph->daddr = cp->vaddr.ip;
532 ip_send_check(ciph); 532 ip_send_check(ciph);
533 } else { 533 } else {
534 iph->daddr = cp->daddr; 534 iph->daddr = cp->daddr.ip;
535 ip_send_check(iph); 535 ip_send_check(iph);
536 ciph->saddr = cp->daddr; 536 ciph->saddr = cp->daddr.ip;
537 ip_send_check(ciph); 537 ip_send_check(ciph);
538 } 538 }
539 539
@@ -762,7 +762,7 @@ ip_vs_out(unsigned int hooknum, struct sk_buff *skb,
762 /* mangle the packet */ 762 /* mangle the packet */
763 if (pp->snat_handler && !pp->snat_handler(skb, pp, cp)) 763 if (pp->snat_handler && !pp->snat_handler(skb, pp, cp))
764 goto drop; 764 goto drop;
765 ip_hdr(skb)->saddr = cp->vaddr; 765 ip_hdr(skb)->saddr = cp->vaddr.ip;
766 ip_send_check(ip_hdr(skb)); 766 ip_send_check(ip_hdr(skb));
767 767
768 /* For policy routing, packets originating from this 768 /* For policy routing, packets originating from this
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c
index ede101eeec17..3f2277b847db 100644
--- a/net/ipv4/ipvs/ip_vs_ctl.c
+++ b/net/ipv4/ipvs/ip_vs_ctl.c
@@ -317,7 +317,8 @@ static int ip_vs_svc_hash(struct ip_vs_service *svc)
317 /* 317 /*
318 * Hash it by <protocol,addr,port> in ip_vs_svc_table 318 * Hash it by <protocol,addr,port> in ip_vs_svc_table
319 */ 319 */
320 hash = ip_vs_svc_hashkey(svc->protocol, svc->addr, svc->port); 320 hash = ip_vs_svc_hashkey(svc->protocol, svc->addr.ip,
321 svc->port);
321 list_add(&svc->s_list, &ip_vs_svc_table[hash]); 322 list_add(&svc->s_list, &ip_vs_svc_table[hash]);
322 } else { 323 } else {
323 /* 324 /*
@@ -373,7 +374,7 @@ __ip_vs_service_get(__u16 protocol, __be32 vaddr, __be16 vport)
373 hash = ip_vs_svc_hashkey(protocol, vaddr, vport); 374 hash = ip_vs_svc_hashkey(protocol, vaddr, vport);
374 375
375 list_for_each_entry(svc, &ip_vs_svc_table[hash], s_list){ 376 list_for_each_entry(svc, &ip_vs_svc_table[hash], s_list){
376 if ((svc->addr == vaddr) 377 if ((svc->addr.ip == vaddr)
377 && (svc->port == vport) 378 && (svc->port == vport)
378 && (svc->protocol == protocol)) { 379 && (svc->protocol == protocol)) {
379 /* HIT */ 380 /* HIT */
@@ -503,7 +504,7 @@ static int ip_vs_rs_hash(struct ip_vs_dest *dest)
503 * Hash by proto,addr,port, 504 * Hash by proto,addr,port,
504 * which are the parameters of the real service. 505 * which are the parameters of the real service.
505 */ 506 */
506 hash = ip_vs_rs_hashkey(dest->addr, dest->port); 507 hash = ip_vs_rs_hashkey(dest->addr.ip, dest->port);
507 list_add(&dest->d_list, &ip_vs_rtable[hash]); 508 list_add(&dest->d_list, &ip_vs_rtable[hash]);
508 509
509 return 1; 510 return 1;
@@ -543,7 +544,7 @@ ip_vs_lookup_real_service(__u16 protocol, __be32 daddr, __be16 dport)
543 544
544 read_lock(&__ip_vs_rs_lock); 545 read_lock(&__ip_vs_rs_lock);
545 list_for_each_entry(dest, &ip_vs_rtable[hash], d_list) { 546 list_for_each_entry(dest, &ip_vs_rtable[hash], d_list) {
546 if ((dest->addr == daddr) 547 if ((dest->addr.ip == daddr)
547 && (dest->port == dport) 548 && (dest->port == dport)
548 && ((dest->protocol == protocol) || 549 && ((dest->protocol == protocol) ||
549 dest->vfwmark)) { 550 dest->vfwmark)) {
@@ -569,7 +570,7 @@ ip_vs_lookup_dest(struct ip_vs_service *svc, __be32 daddr, __be16 dport)
569 * Find the destination for the given service 570 * Find the destination for the given service
570 */ 571 */
571 list_for_each_entry(dest, &svc->destinations, n_list) { 572 list_for_each_entry(dest, &svc->destinations, n_list) {
572 if ((dest->addr == daddr) && (dest->port == dport)) { 573 if ((dest->addr.ip == daddr) && (dest->port == dport)) {
573 /* HIT */ 574 /* HIT */
574 return dest; 575 return dest;
575 } 576 }
@@ -626,14 +627,14 @@ ip_vs_trash_get_dest(struct ip_vs_service *svc, __be32 daddr, __be16 dport)
626 IP_VS_DBG(3, "Destination %u/%u.%u.%u.%u:%u still in trash, " 627 IP_VS_DBG(3, "Destination %u/%u.%u.%u.%u:%u still in trash, "
627 "dest->refcnt=%d\n", 628 "dest->refcnt=%d\n",
628 dest->vfwmark, 629 dest->vfwmark,
629 NIPQUAD(dest->addr), ntohs(dest->port), 630 NIPQUAD(dest->addr.ip), ntohs(dest->port),
630 atomic_read(&dest->refcnt)); 631 atomic_read(&dest->refcnt));
631 if (dest->addr == daddr && 632 if (dest->addr.ip == daddr &&
632 dest->port == dport && 633 dest->port == dport &&
633 dest->vfwmark == svc->fwmark && 634 dest->vfwmark == svc->fwmark &&
634 dest->protocol == svc->protocol && 635 dest->protocol == svc->protocol &&
635 (svc->fwmark || 636 (svc->fwmark ||
636 (dest->vaddr == svc->addr && 637 (dest->vaddr.ip == svc->addr.ip &&
637 dest->vport == svc->port))) { 638 dest->vport == svc->port))) {
638 /* HIT */ 639 /* HIT */
639 return dest; 640 return dest;
@@ -646,7 +647,7 @@ ip_vs_trash_get_dest(struct ip_vs_service *svc, __be32 daddr, __be16 dport)
646 IP_VS_DBG(3, "Removing destination %u/%u.%u.%u.%u:%u " 647 IP_VS_DBG(3, "Removing destination %u/%u.%u.%u.%u:%u "
647 "from trash\n", 648 "from trash\n",
648 dest->vfwmark, 649 dest->vfwmark,
649 NIPQUAD(dest->addr), ntohs(dest->port)); 650 NIPQUAD(dest->addr.ip), ntohs(dest->port));
650 list_del(&dest->n_list); 651 list_del(&dest->n_list);
651 ip_vs_dst_reset(dest); 652 ip_vs_dst_reset(dest);
652 __ip_vs_unbind_svc(dest); 653 __ip_vs_unbind_svc(dest);
@@ -779,10 +780,10 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest,
779 } 780 }
780 781
781 dest->protocol = svc->protocol; 782 dest->protocol = svc->protocol;
782 dest->vaddr = svc->addr; 783 dest->vaddr.ip = svc->addr.ip;
783 dest->vport = svc->port; 784 dest->vport = svc->port;
784 dest->vfwmark = svc->fwmark; 785 dest->vfwmark = svc->fwmark;
785 dest->addr = udest->addr; 786 dest->addr.ip = udest->addr;
786 dest->port = udest->port; 787 dest->port = udest->port;
787 788
788 atomic_set(&dest->activeconns, 0); 789 atomic_set(&dest->activeconns, 0);
@@ -847,7 +848,7 @@ ip_vs_add_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest)
847 NIPQUAD(daddr), ntohs(dport), 848 NIPQUAD(daddr), ntohs(dport),
848 atomic_read(&dest->refcnt), 849 atomic_read(&dest->refcnt),
849 dest->vfwmark, 850 dest->vfwmark,
850 NIPQUAD(dest->vaddr), 851 NIPQUAD(dest->vaddr.ip),
851 ntohs(dest->vport)); 852 ntohs(dest->vport));
852 __ip_vs_update_dest(svc, dest, udest); 853 __ip_vs_update_dest(svc, dest, udest);
853 854
@@ -993,7 +994,7 @@ static void __ip_vs_del_dest(struct ip_vs_dest *dest)
993 } else { 994 } else {
994 IP_VS_DBG(3, "Moving dest %u.%u.%u.%u:%u into trash, " 995 IP_VS_DBG(3, "Moving dest %u.%u.%u.%u:%u into trash, "
995 "dest->refcnt=%d\n", 996 "dest->refcnt=%d\n",
996 NIPQUAD(dest->addr), ntohs(dest->port), 997 NIPQUAD(dest->addr.ip), ntohs(dest->port),
997 atomic_read(&dest->refcnt)); 998 atomic_read(&dest->refcnt));
998 list_add(&dest->n_list, &ip_vs_dest_trash); 999 list_add(&dest->n_list, &ip_vs_dest_trash);
999 atomic_inc(&dest->refcnt); 1000 atomic_inc(&dest->refcnt);
@@ -1101,7 +1102,7 @@ ip_vs_add_service(struct ip_vs_service_user *u, struct ip_vs_service **svc_p)
1101 atomic_set(&svc->refcnt, 0); 1102 atomic_set(&svc->refcnt, 0);
1102 1103
1103 svc->protocol = u->protocol; 1104 svc->protocol = u->protocol;
1104 svc->addr = u->addr; 1105 svc->addr.ip = u->addr;
1105 svc->port = u->port; 1106 svc->port = u->port;
1106 svc->fwmark = u->fwmark; 1107 svc->fwmark = u->fwmark;
1107 svc->flags = u->flags; 1108 svc->flags = u->flags;
@@ -1751,7 +1752,7 @@ static int ip_vs_info_seq_show(struct seq_file *seq, void *v)
1751 if (iter->table == ip_vs_svc_table) 1752 if (iter->table == ip_vs_svc_table)
1752 seq_printf(seq, "%s %08X:%04X %s ", 1753 seq_printf(seq, "%s %08X:%04X %s ",
1753 ip_vs_proto_name(svc->protocol), 1754 ip_vs_proto_name(svc->protocol),
1754 ntohl(svc->addr), 1755 ntohl(svc->addr.ip),
1755 ntohs(svc->port), 1756 ntohs(svc->port),
1756 svc->scheduler->name); 1757 svc->scheduler->name);
1757 else 1758 else
@@ -1768,7 +1769,7 @@ static int ip_vs_info_seq_show(struct seq_file *seq, void *v)
1768 list_for_each_entry(dest, &svc->destinations, n_list) { 1769 list_for_each_entry(dest, &svc->destinations, n_list) {
1769 seq_printf(seq, 1770 seq_printf(seq,
1770 " -> %08X:%04X %-7s %-6d %-10d %-10d\n", 1771 " -> %08X:%04X %-7s %-6d %-10d %-10d\n",
1771 ntohl(dest->addr), ntohs(dest->port), 1772 ntohl(dest->addr.ip), ntohs(dest->port),
1772 ip_vs_fwd_name(atomic_read(&dest->conn_flags)), 1773 ip_vs_fwd_name(atomic_read(&dest->conn_flags)),
1773 atomic_read(&dest->weight), 1774 atomic_read(&dest->weight),
1774 atomic_read(&dest->activeconns), 1775 atomic_read(&dest->activeconns),
@@ -2040,7 +2041,7 @@ static void
2040ip_vs_copy_service(struct ip_vs_service_entry *dst, struct ip_vs_service *src) 2041ip_vs_copy_service(struct ip_vs_service_entry *dst, struct ip_vs_service *src)
2041{ 2042{
2042 dst->protocol = src->protocol; 2043 dst->protocol = src->protocol;
2043 dst->addr = src->addr; 2044 dst->addr = src->addr.ip;
2044 dst->port = src->port; 2045 dst->port = src->port;
2045 dst->fwmark = src->fwmark; 2046 dst->fwmark = src->fwmark;
2046 strlcpy(dst->sched_name, src->scheduler->name, sizeof(dst->sched_name)); 2047 strlcpy(dst->sched_name, src->scheduler->name, sizeof(dst->sched_name));
@@ -2114,7 +2115,7 @@ __ip_vs_get_dest_entries(const struct ip_vs_get_dests *get,
2114 if (count >= get->num_dests) 2115 if (count >= get->num_dests)
2115 break; 2116 break;
2116 2117
2117 entry.addr = dest->addr; 2118 entry.addr = dest->addr.ip;
2118 entry.port = dest->port; 2119 entry.port = dest->port;
2119 entry.conn_flags = atomic_read(&dest->conn_flags); 2120 entry.conn_flags = atomic_read(&dest->conn_flags);
2120 entry.weight = atomic_read(&dest->weight); 2121 entry.weight = atomic_read(&dest->weight);
diff --git a/net/ipv4/ipvs/ip_vs_dh.c b/net/ipv4/ipvs/ip_vs_dh.c
index fa66824d264f..9f9d795dbd77 100644
--- a/net/ipv4/ipvs/ip_vs_dh.c
+++ b/net/ipv4/ipvs/ip_vs_dh.c
@@ -218,7 +218,7 @@ ip_vs_dh_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)
218 IP_VS_DBG(6, "DH: destination IP address %u.%u.%u.%u " 218 IP_VS_DBG(6, "DH: destination IP address %u.%u.%u.%u "
219 "--> server %u.%u.%u.%u:%d\n", 219 "--> server %u.%u.%u.%u:%d\n",
220 NIPQUAD(iph->daddr), 220 NIPQUAD(iph->daddr),
221 NIPQUAD(dest->addr), 221 NIPQUAD(dest->addr.ip),
222 ntohs(dest->port)); 222 ntohs(dest->port));
223 223
224 return dest; 224 return dest;
diff --git a/net/ipv4/ipvs/ip_vs_ftp.c b/net/ipv4/ipvs/ip_vs_ftp.c
index c1c758e4f733..bfe5d7050a58 100644
--- a/net/ipv4/ipvs/ip_vs_ftp.c
+++ b/net/ipv4/ipvs/ip_vs_ftp.c
@@ -172,17 +172,17 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
172 172
173 IP_VS_DBG(7, "PASV response (%u.%u.%u.%u:%d) -> " 173 IP_VS_DBG(7, "PASV response (%u.%u.%u.%u:%d) -> "
174 "%u.%u.%u.%u:%d detected\n", 174 "%u.%u.%u.%u:%d detected\n",
175 NIPQUAD(from), ntohs(port), NIPQUAD(cp->caddr), 0); 175 NIPQUAD(from), ntohs(port), NIPQUAD(cp->caddr.ip), 0);
176 176
177 /* 177 /*
178 * Now update or create an connection entry for it 178 * Now update or create an connection entry for it
179 */ 179 */
180 n_cp = ip_vs_conn_out_get(iph->protocol, from, port, 180 n_cp = ip_vs_conn_out_get(iph->protocol, from, port,
181 cp->caddr, 0); 181 cp->caddr.ip, 0);
182 if (!n_cp) { 182 if (!n_cp) {
183 n_cp = ip_vs_conn_new(IPPROTO_TCP, 183 n_cp = ip_vs_conn_new(IPPROTO_TCP,
184 cp->caddr, 0, 184 cp->caddr.ip, 0,
185 cp->vaddr, port, 185 cp->vaddr.ip, port,
186 from, port, 186 from, port,
187 IP_VS_CONN_F_NO_CPORT, 187 IP_VS_CONN_F_NO_CPORT,
188 cp->dest); 188 cp->dest);
@@ -196,7 +196,7 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
196 /* 196 /*
197 * Replace the old passive address with the new one 197 * Replace the old passive address with the new one
198 */ 198 */
199 from = n_cp->vaddr; 199 from = n_cp->vaddr.ip;
200 port = n_cp->vport; 200 port = n_cp->vport;
201 sprintf(buf,"%d,%d,%d,%d,%d,%d", NIPQUAD(from), 201 sprintf(buf,"%d,%d,%d,%d,%d,%d", NIPQUAD(from),
202 (ntohs(port)>>8)&255, ntohs(port)&255); 202 (ntohs(port)>>8)&255, ntohs(port)&255);
@@ -306,16 +306,16 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
306 */ 306 */
307 IP_VS_DBG(7, "protocol %s %u.%u.%u.%u:%d %u.%u.%u.%u:%d\n", 307 IP_VS_DBG(7, "protocol %s %u.%u.%u.%u:%d %u.%u.%u.%u:%d\n",
308 ip_vs_proto_name(iph->protocol), 308 ip_vs_proto_name(iph->protocol),
309 NIPQUAD(to), ntohs(port), NIPQUAD(cp->vaddr), 0); 309 NIPQUAD(to), ntohs(port), NIPQUAD(cp->vaddr.ip), 0);
310 310
311 n_cp = ip_vs_conn_in_get(iph->protocol, 311 n_cp = ip_vs_conn_in_get(iph->protocol,
312 to, port, 312 to, port,
313 cp->vaddr, htons(ntohs(cp->vport)-1)); 313 cp->vaddr.ip, htons(ntohs(cp->vport)-1));
314 if (!n_cp) { 314 if (!n_cp) {
315 n_cp = ip_vs_conn_new(IPPROTO_TCP, 315 n_cp = ip_vs_conn_new(IPPROTO_TCP,
316 to, port, 316 to, port,
317 cp->vaddr, htons(ntohs(cp->vport)-1), 317 cp->vaddr.ip, htons(ntohs(cp->vport)-1),
318 cp->daddr, htons(ntohs(cp->dport)-1), 318 cp->daddr.ip, htons(ntohs(cp->dport)-1),
319 0, 319 0,
320 cp->dest); 320 cp->dest);
321 if (!n_cp) 321 if (!n_cp)
diff --git a/net/ipv4/ipvs/ip_vs_lblc.c b/net/ipv4/ipvs/ip_vs_lblc.c
index d2a43aa3fe4c..69309edc0c4a 100644
--- a/net/ipv4/ipvs/ip_vs_lblc.c
+++ b/net/ipv4/ipvs/ip_vs_lblc.c
@@ -422,7 +422,7 @@ __ip_vs_lblc_schedule(struct ip_vs_service *svc, struct iphdr *iph)
422 422
423 IP_VS_DBG(6, "LBLC: server %d.%d.%d.%d:%d " 423 IP_VS_DBG(6, "LBLC: server %d.%d.%d.%d:%d "
424 "activeconns %d refcnt %d weight %d overhead %d\n", 424 "activeconns %d refcnt %d weight %d overhead %d\n",
425 NIPQUAD(least->addr), ntohs(least->port), 425 NIPQUAD(least->addr.ip), ntohs(least->port),
426 atomic_read(&least->activeconns), 426 atomic_read(&least->activeconns),
427 atomic_read(&least->refcnt), 427 atomic_read(&least->refcnt),
428 atomic_read(&least->weight), loh); 428 atomic_read(&least->weight), loh);
@@ -506,7 +506,7 @@ out:
506 IP_VS_DBG(6, "LBLC: destination IP address %u.%u.%u.%u " 506 IP_VS_DBG(6, "LBLC: destination IP address %u.%u.%u.%u "
507 "--> server %u.%u.%u.%u:%d\n", 507 "--> server %u.%u.%u.%u:%d\n",
508 NIPQUAD(iph->daddr), 508 NIPQUAD(iph->daddr),
509 NIPQUAD(dest->addr), 509 NIPQUAD(dest->addr.ip),
510 ntohs(dest->port)); 510 ntohs(dest->port));
511 511
512 return dest; 512 return dest;
diff --git a/net/ipv4/ipvs/ip_vs_lblcr.c b/net/ipv4/ipvs/ip_vs_lblcr.c
index 375a1ffb6b65..51c746e20832 100644
--- a/net/ipv4/ipvs/ip_vs_lblcr.c
+++ b/net/ipv4/ipvs/ip_vs_lblcr.c
@@ -204,7 +204,7 @@ static inline struct ip_vs_dest *ip_vs_dest_set_min(struct ip_vs_dest_set *set)
204 204
205 IP_VS_DBG(6, "ip_vs_dest_set_min: server %d.%d.%d.%d:%d " 205 IP_VS_DBG(6, "ip_vs_dest_set_min: server %d.%d.%d.%d:%d "
206 "activeconns %d refcnt %d weight %d overhead %d\n", 206 "activeconns %d refcnt %d weight %d overhead %d\n",
207 NIPQUAD(least->addr), ntohs(least->port), 207 NIPQUAD(least->addr.ip), ntohs(least->port),
208 atomic_read(&least->activeconns), 208 atomic_read(&least->activeconns),
209 atomic_read(&least->refcnt), 209 atomic_read(&least->refcnt),
210 atomic_read(&least->weight), loh); 210 atomic_read(&least->weight), loh);
@@ -250,7 +250,7 @@ static inline struct ip_vs_dest *ip_vs_dest_set_max(struct ip_vs_dest_set *set)
250 250
251 IP_VS_DBG(6, "ip_vs_dest_set_max: server %d.%d.%d.%d:%d " 251 IP_VS_DBG(6, "ip_vs_dest_set_max: server %d.%d.%d.%d:%d "
252 "activeconns %d refcnt %d weight %d overhead %d\n", 252 "activeconns %d refcnt %d weight %d overhead %d\n",
253 NIPQUAD(most->addr), ntohs(most->port), 253 NIPQUAD(most->addr.ip), ntohs(most->port),
254 atomic_read(&most->activeconns), 254 atomic_read(&most->activeconns),
255 atomic_read(&most->refcnt), 255 atomic_read(&most->refcnt),
256 atomic_read(&most->weight), moh); 256 atomic_read(&most->weight), moh);
@@ -598,7 +598,7 @@ __ip_vs_lblcr_schedule(struct ip_vs_service *svc, struct iphdr *iph)
598 598
599 IP_VS_DBG(6, "LBLCR: server %d.%d.%d.%d:%d " 599 IP_VS_DBG(6, "LBLCR: server %d.%d.%d.%d:%d "
600 "activeconns %d refcnt %d weight %d overhead %d\n", 600 "activeconns %d refcnt %d weight %d overhead %d\n",
601 NIPQUAD(least->addr), ntohs(least->port), 601 NIPQUAD(least->addr.ip), ntohs(least->port),
602 atomic_read(&least->activeconns), 602 atomic_read(&least->activeconns),
603 atomic_read(&least->refcnt), 603 atomic_read(&least->refcnt),
604 atomic_read(&least->weight), loh); 604 atomic_read(&least->weight), loh);
@@ -706,7 +706,7 @@ out:
706 IP_VS_DBG(6, "LBLCR: destination IP address %u.%u.%u.%u " 706 IP_VS_DBG(6, "LBLCR: destination IP address %u.%u.%u.%u "
707 "--> server %u.%u.%u.%u:%d\n", 707 "--> server %u.%u.%u.%u:%d\n",
708 NIPQUAD(iph->daddr), 708 NIPQUAD(iph->daddr),
709 NIPQUAD(dest->addr), 709 NIPQUAD(dest->addr.ip),
710 ntohs(dest->port)); 710 ntohs(dest->port));
711 711
712 return dest; 712 return dest;
diff --git a/net/ipv4/ipvs/ip_vs_lc.c b/net/ipv4/ipvs/ip_vs_lc.c
index 2c3de1b63518..551d293347f8 100644
--- a/net/ipv4/ipvs/ip_vs_lc.c
+++ b/net/ipv4/ipvs/ip_vs_lc.c
@@ -68,7 +68,7 @@ ip_vs_lc_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)
68 68
69 if (least) 69 if (least)
70 IP_VS_DBG(6, "LC: server %u.%u.%u.%u:%u activeconns %d inactconns %d\n", 70 IP_VS_DBG(6, "LC: server %u.%u.%u.%u:%u activeconns %d inactconns %d\n",
71 NIPQUAD(least->addr), ntohs(least->port), 71 NIPQUAD(least->addr.ip), ntohs(least->port),
72 atomic_read(&least->activeconns), 72 atomic_read(&least->activeconns),
73 atomic_read(&least->inactconns)); 73 atomic_read(&least->inactconns));
74 74
diff --git a/net/ipv4/ipvs/ip_vs_nq.c b/net/ipv4/ipvs/ip_vs_nq.c
index 5330d5a2de14..aa0e32ad3486 100644
--- a/net/ipv4/ipvs/ip_vs_nq.c
+++ b/net/ipv4/ipvs/ip_vs_nq.c
@@ -101,7 +101,7 @@ ip_vs_nq_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)
101 out: 101 out:
102 IP_VS_DBG(6, "NQ: server %u.%u.%u.%u:%u " 102 IP_VS_DBG(6, "NQ: server %u.%u.%u.%u:%u "
103 "activeconns %d refcnt %d weight %d overhead %d\n", 103 "activeconns %d refcnt %d weight %d overhead %d\n",
104 NIPQUAD(least->addr), ntohs(least->port), 104 NIPQUAD(least->addr.ip), ntohs(least->port),
105 atomic_read(&least->activeconns), 105 atomic_read(&least->activeconns),
106 atomic_read(&least->refcnt), 106 atomic_read(&least->refcnt),
107 atomic_read(&least->weight), loh); 107 atomic_read(&least->weight), loh);
diff --git a/net/ipv4/ipvs/ip_vs_proto_tcp.c b/net/ipv4/ipvs/ip_vs_proto_tcp.c
index d0ea467986a0..15860e1441b0 100644
--- a/net/ipv4/ipvs/ip_vs_proto_tcp.c
+++ b/net/ipv4/ipvs/ip_vs_proto_tcp.c
@@ -147,7 +147,7 @@ tcp_snat_handler(struct sk_buff *skb,
147 /* Adjust TCP checksums */ 147 /* Adjust TCP checksums */
148 if (!cp->app) { 148 if (!cp->app) {
149 /* Only port and addr are changed, do fast csum update */ 149 /* Only port and addr are changed, do fast csum update */
150 tcp_fast_csum_update(tcph, cp->daddr, cp->vaddr, 150 tcp_fast_csum_update(tcph, cp->daddr.ip, cp->vaddr.ip,
151 cp->dport, cp->vport); 151 cp->dport, cp->vport);
152 if (skb->ip_summed == CHECKSUM_COMPLETE) 152 if (skb->ip_summed == CHECKSUM_COMPLETE)
153 skb->ip_summed = CHECKSUM_NONE; 153 skb->ip_summed = CHECKSUM_NONE;
@@ -155,7 +155,7 @@ tcp_snat_handler(struct sk_buff *skb,
155 /* full checksum calculation */ 155 /* full checksum calculation */
156 tcph->check = 0; 156 tcph->check = 0;
157 skb->csum = skb_checksum(skb, tcphoff, skb->len - tcphoff, 0); 157 skb->csum = skb_checksum(skb, tcphoff, skb->len - tcphoff, 0);
158 tcph->check = csum_tcpudp_magic(cp->vaddr, cp->caddr, 158 tcph->check = csum_tcpudp_magic(cp->vaddr.ip, cp->caddr.ip,
159 skb->len - tcphoff, 159 skb->len - tcphoff,
160 cp->protocol, skb->csum); 160 cp->protocol, skb->csum);
161 IP_VS_DBG(11, "O-pkt: %s O-csum=%d (+%zd)\n", 161 IP_VS_DBG(11, "O-pkt: %s O-csum=%d (+%zd)\n",
@@ -198,7 +198,7 @@ tcp_dnat_handler(struct sk_buff *skb,
198 */ 198 */
199 if (!cp->app) { 199 if (!cp->app) {
200 /* Only port and addr are changed, do fast csum update */ 200 /* Only port and addr are changed, do fast csum update */
201 tcp_fast_csum_update(tcph, cp->vaddr, cp->daddr, 201 tcp_fast_csum_update(tcph, cp->vaddr.ip, cp->daddr.ip,
202 cp->vport, cp->dport); 202 cp->vport, cp->dport);
203 if (skb->ip_summed == CHECKSUM_COMPLETE) 203 if (skb->ip_summed == CHECKSUM_COMPLETE)
204 skb->ip_summed = CHECKSUM_NONE; 204 skb->ip_summed = CHECKSUM_NONE;
@@ -206,7 +206,7 @@ tcp_dnat_handler(struct sk_buff *skb,
206 /* full checksum calculation */ 206 /* full checksum calculation */
207 tcph->check = 0; 207 tcph->check = 0;
208 skb->csum = skb_checksum(skb, tcphoff, skb->len - tcphoff, 0); 208 skb->csum = skb_checksum(skb, tcphoff, skb->len - tcphoff, 0);
209 tcph->check = csum_tcpudp_magic(cp->caddr, cp->daddr, 209 tcph->check = csum_tcpudp_magic(cp->caddr.ip, cp->daddr.ip,
210 skb->len - tcphoff, 210 skb->len - tcphoff,
211 cp->protocol, skb->csum); 211 cp->protocol, skb->csum);
212 skb->ip_summed = CHECKSUM_UNNECESSARY; 212 skb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -427,8 +427,8 @@ set_tcp_state(struct ip_vs_protocol *pp, struct ip_vs_conn *cp,
427 th->fin? 'F' : '.', 427 th->fin? 'F' : '.',
428 th->ack? 'A' : '.', 428 th->ack? 'A' : '.',
429 th->rst? 'R' : '.', 429 th->rst? 'R' : '.',
430 NIPQUAD(cp->daddr), ntohs(cp->dport), 430 NIPQUAD(cp->daddr.ip), ntohs(cp->dport),
431 NIPQUAD(cp->caddr), ntohs(cp->cport), 431 NIPQUAD(cp->caddr.ip), ntohs(cp->cport),
432 tcp_state_name(cp->state), 432 tcp_state_name(cp->state),
433 tcp_state_name(new_state), 433 tcp_state_name(new_state),
434 atomic_read(&cp->refcnt)); 434 atomic_read(&cp->refcnt));
@@ -549,8 +549,8 @@ tcp_app_conn_bind(struct ip_vs_conn *cp)
549 IP_VS_DBG(9, "%s: Binding conn %u.%u.%u.%u:%u->" 549 IP_VS_DBG(9, "%s: Binding conn %u.%u.%u.%u:%u->"
550 "%u.%u.%u.%u:%u to app %s on port %u\n", 550 "%u.%u.%u.%u:%u to app %s on port %u\n",
551 __func__, 551 __func__,
552 NIPQUAD(cp->caddr), ntohs(cp->cport), 552 NIPQUAD(cp->caddr.ip), ntohs(cp->cport),
553 NIPQUAD(cp->vaddr), ntohs(cp->vport), 553 NIPQUAD(cp->vaddr.ip), ntohs(cp->vport),
554 inc->name, ntohs(inc->port)); 554 inc->name, ntohs(inc->port));
555 cp->app = inc; 555 cp->app = inc;
556 if (inc->init_conn) 556 if (inc->init_conn)
diff --git a/net/ipv4/ipvs/ip_vs_proto_udp.c b/net/ipv4/ipvs/ip_vs_proto_udp.c
index c6be5d56823f..8dfad5db8295 100644
--- a/net/ipv4/ipvs/ip_vs_proto_udp.c
+++ b/net/ipv4/ipvs/ip_vs_proto_udp.c
@@ -158,7 +158,7 @@ udp_snat_handler(struct sk_buff *skb,
158 */ 158 */
159 if (!cp->app && (udph->check != 0)) { 159 if (!cp->app && (udph->check != 0)) {
160 /* Only port and addr are changed, do fast csum update */ 160 /* Only port and addr are changed, do fast csum update */
161 udp_fast_csum_update(udph, cp->daddr, cp->vaddr, 161 udp_fast_csum_update(udph, cp->daddr.ip, cp->vaddr.ip,
162 cp->dport, cp->vport); 162 cp->dport, cp->vport);
163 if (skb->ip_summed == CHECKSUM_COMPLETE) 163 if (skb->ip_summed == CHECKSUM_COMPLETE)
164 skb->ip_summed = CHECKSUM_NONE; 164 skb->ip_summed = CHECKSUM_NONE;
@@ -166,7 +166,7 @@ udp_snat_handler(struct sk_buff *skb,
166 /* full checksum calculation */ 166 /* full checksum calculation */
167 udph->check = 0; 167 udph->check = 0;
168 skb->csum = skb_checksum(skb, udphoff, skb->len - udphoff, 0); 168 skb->csum = skb_checksum(skb, udphoff, skb->len - udphoff, 0);
169 udph->check = csum_tcpudp_magic(cp->vaddr, cp->caddr, 169 udph->check = csum_tcpudp_magic(cp->vaddr.ip, cp->caddr.ip,
170 skb->len - udphoff, 170 skb->len - udphoff,
171 cp->protocol, skb->csum); 171 cp->protocol, skb->csum);
172 if (udph->check == 0) 172 if (udph->check == 0)
@@ -211,7 +211,7 @@ udp_dnat_handler(struct sk_buff *skb,
211 */ 211 */
212 if (!cp->app && (udph->check != 0)) { 212 if (!cp->app && (udph->check != 0)) {
213 /* Only port and addr are changed, do fast csum update */ 213 /* Only port and addr are changed, do fast csum update */
214 udp_fast_csum_update(udph, cp->vaddr, cp->daddr, 214 udp_fast_csum_update(udph, cp->vaddr.ip, cp->daddr.ip,
215 cp->vport, cp->dport); 215 cp->vport, cp->dport);
216 if (skb->ip_summed == CHECKSUM_COMPLETE) 216 if (skb->ip_summed == CHECKSUM_COMPLETE)
217 skb->ip_summed = CHECKSUM_NONE; 217 skb->ip_summed = CHECKSUM_NONE;
@@ -219,7 +219,7 @@ udp_dnat_handler(struct sk_buff *skb,
219 /* full checksum calculation */ 219 /* full checksum calculation */
220 udph->check = 0; 220 udph->check = 0;
221 skb->csum = skb_checksum(skb, udphoff, skb->len - udphoff, 0); 221 skb->csum = skb_checksum(skb, udphoff, skb->len - udphoff, 0);
222 udph->check = csum_tcpudp_magic(cp->caddr, cp->daddr, 222 udph->check = csum_tcpudp_magic(cp->caddr.ip, cp->daddr.ip,
223 skb->len - udphoff, 223 skb->len - udphoff,
224 cp->protocol, skb->csum); 224 cp->protocol, skb->csum);
225 if (udph->check == 0) 225 if (udph->check == 0)
@@ -343,8 +343,8 @@ static int udp_app_conn_bind(struct ip_vs_conn *cp)
343 IP_VS_DBG(9, "%s: Binding conn %u.%u.%u.%u:%u->" 343 IP_VS_DBG(9, "%s: Binding conn %u.%u.%u.%u:%u->"
344 "%u.%u.%u.%u:%u to app %s on port %u\n", 344 "%u.%u.%u.%u:%u to app %s on port %u\n",
345 __func__, 345 __func__,
346 NIPQUAD(cp->caddr), ntohs(cp->cport), 346 NIPQUAD(cp->caddr.ip), ntohs(cp->cport),
347 NIPQUAD(cp->vaddr), ntohs(cp->vport), 347 NIPQUAD(cp->vaddr.ip), ntohs(cp->vport),
348 inc->name, ntohs(inc->port)); 348 inc->name, ntohs(inc->port));
349 cp->app = inc; 349 cp->app = inc;
350 if (inc->init_conn) 350 if (inc->init_conn)
diff --git a/net/ipv4/ipvs/ip_vs_rr.c b/net/ipv4/ipvs/ip_vs_rr.c
index f74929117534..27f0b624283d 100644
--- a/net/ipv4/ipvs/ip_vs_rr.c
+++ b/net/ipv4/ipvs/ip_vs_rr.c
@@ -76,7 +76,7 @@ ip_vs_rr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)
76 write_unlock(&svc->sched_lock); 76 write_unlock(&svc->sched_lock);
77 IP_VS_DBG(6, "RR: server %u.%u.%u.%u:%u " 77 IP_VS_DBG(6, "RR: server %u.%u.%u.%u:%u "
78 "activeconns %d refcnt %d weight %d\n", 78 "activeconns %d refcnt %d weight %d\n",
79 NIPQUAD(dest->addr), ntohs(dest->port), 79 NIPQUAD(dest->addr.ip), ntohs(dest->port),
80 atomic_read(&dest->activeconns), 80 atomic_read(&dest->activeconns),
81 atomic_read(&dest->refcnt), atomic_read(&dest->weight)); 81 atomic_read(&dest->refcnt), atomic_read(&dest->weight));
82 82
diff --git a/net/ipv4/ipvs/ip_vs_sed.c b/net/ipv4/ipvs/ip_vs_sed.c
index 53f73bea66ce..38b574b2fdf0 100644
--- a/net/ipv4/ipvs/ip_vs_sed.c
+++ b/net/ipv4/ipvs/ip_vs_sed.c
@@ -103,7 +103,7 @@ ip_vs_sed_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)
103 103
104 IP_VS_DBG(6, "SED: server %u.%u.%u.%u:%u " 104 IP_VS_DBG(6, "SED: server %u.%u.%u.%u:%u "
105 "activeconns %d refcnt %d weight %d overhead %d\n", 105 "activeconns %d refcnt %d weight %d overhead %d\n",
106 NIPQUAD(least->addr), ntohs(least->port), 106 NIPQUAD(least->addr.ip), ntohs(least->port),
107 atomic_read(&least->activeconns), 107 atomic_read(&least->activeconns),
108 atomic_read(&least->refcnt), 108 atomic_read(&least->refcnt),
109 atomic_read(&least->weight), loh); 109 atomic_read(&least->weight), loh);
diff --git a/net/ipv4/ipvs/ip_vs_sh.c b/net/ipv4/ipvs/ip_vs_sh.c
index 7b979e228056..c9e54e2ec290 100644
--- a/net/ipv4/ipvs/ip_vs_sh.c
+++ b/net/ipv4/ipvs/ip_vs_sh.c
@@ -215,7 +215,7 @@ ip_vs_sh_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)
215 IP_VS_DBG(6, "SH: source IP address %u.%u.%u.%u " 215 IP_VS_DBG(6, "SH: source IP address %u.%u.%u.%u "
216 "--> server %u.%u.%u.%u:%d\n", 216 "--> server %u.%u.%u.%u:%d\n",
217 NIPQUAD(iph->saddr), 217 NIPQUAD(iph->saddr),
218 NIPQUAD(dest->addr), 218 NIPQUAD(dest->addr.ip),
219 ntohs(dest->port)); 219 ntohs(dest->port));
220 220
221 return dest; 221 return dest;
diff --git a/net/ipv4/ipvs/ip_vs_sync.c b/net/ipv4/ipvs/ip_vs_sync.c
index a652da2c3200..2cf47b2e1669 100644
--- a/net/ipv4/ipvs/ip_vs_sync.c
+++ b/net/ipv4/ipvs/ip_vs_sync.c
@@ -256,9 +256,9 @@ void ip_vs_sync_conn(struct ip_vs_conn *cp)
256 s->cport = cp->cport; 256 s->cport = cp->cport;
257 s->vport = cp->vport; 257 s->vport = cp->vport;
258 s->dport = cp->dport; 258 s->dport = cp->dport;
259 s->caddr = cp->caddr; 259 s->caddr = cp->caddr.ip;
260 s->vaddr = cp->vaddr; 260 s->vaddr = cp->vaddr.ip;
261 s->daddr = cp->daddr; 261 s->daddr = cp->daddr.ip;
262 s->flags = htons(cp->flags & ~IP_VS_CONN_F_HASHED); 262 s->flags = htons(cp->flags & ~IP_VS_CONN_F_HASHED);
263 s->state = htons(cp->state); 263 s->state = htons(cp->state);
264 if (cp->flags & IP_VS_CONN_F_SEQ_MASK) { 264 if (cp->flags & IP_VS_CONN_F_SEQ_MASK) {
diff --git a/net/ipv4/ipvs/ip_vs_wlc.c b/net/ipv4/ipvs/ip_vs_wlc.c
index df7ad8d74766..09fd993040f5 100644
--- a/net/ipv4/ipvs/ip_vs_wlc.c
+++ b/net/ipv4/ipvs/ip_vs_wlc.c
@@ -91,7 +91,7 @@ ip_vs_wlc_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)
91 91
92 IP_VS_DBG(6, "WLC: server %u.%u.%u.%u:%u " 92 IP_VS_DBG(6, "WLC: server %u.%u.%u.%u:%u "
93 "activeconns %d refcnt %d weight %d overhead %d\n", 93 "activeconns %d refcnt %d weight %d overhead %d\n",
94 NIPQUAD(least->addr), ntohs(least->port), 94 NIPQUAD(least->addr.ip), ntohs(least->port),
95 atomic_read(&least->activeconns), 95 atomic_read(&least->activeconns),
96 atomic_read(&least->refcnt), 96 atomic_read(&least->refcnt),
97 atomic_read(&least->weight), loh); 97 atomic_read(&least->weight), loh);
diff --git a/net/ipv4/ipvs/ip_vs_wrr.c b/net/ipv4/ipvs/ip_vs_wrr.c
index 0d86a79b87b5..19c49b234f35 100644
--- a/net/ipv4/ipvs/ip_vs_wrr.c
+++ b/net/ipv4/ipvs/ip_vs_wrr.c
@@ -197,7 +197,7 @@ ip_vs_wrr_schedule(struct ip_vs_service *svc, const struct sk_buff *skb)
197 197
198 IP_VS_DBG(6, "WRR: server %u.%u.%u.%u:%u " 198 IP_VS_DBG(6, "WRR: server %u.%u.%u.%u:%u "
199 "activeconns %d refcnt %d weight %d\n", 199 "activeconns %d refcnt %d weight %d\n",
200 NIPQUAD(dest->addr), ntohs(dest->port), 200 NIPQUAD(dest->addr.ip), ntohs(dest->port),
201 atomic_read(&dest->activeconns), 201 atomic_read(&dest->activeconns),
202 atomic_read(&dest->refcnt), 202 atomic_read(&dest->refcnt),
203 atomic_read(&dest->weight)); 203 atomic_read(&dest->weight));
diff --git a/net/ipv4/ipvs/ip_vs_xmit.c b/net/ipv4/ipvs/ip_vs_xmit.c
index 9892d4aca42e..88199c9f2d31 100644
--- a/net/ipv4/ipvs/ip_vs_xmit.c
+++ b/net/ipv4/ipvs/ip_vs_xmit.c
@@ -71,7 +71,7 @@ __ip_vs_get_out_rt(struct ip_vs_conn *cp, u32 rtos)
71 .oif = 0, 71 .oif = 0,
72 .nl_u = { 72 .nl_u = {
73 .ip4_u = { 73 .ip4_u = {
74 .daddr = dest->addr, 74 .daddr = dest->addr.ip,
75 .saddr = 0, 75 .saddr = 0,
76 .tos = rtos, } }, 76 .tos = rtos, } },
77 }; 77 };
@@ -80,12 +80,12 @@ __ip_vs_get_out_rt(struct ip_vs_conn *cp, u32 rtos)
80 spin_unlock(&dest->dst_lock); 80 spin_unlock(&dest->dst_lock);
81 IP_VS_DBG_RL("ip_route_output error, " 81 IP_VS_DBG_RL("ip_route_output error, "
82 "dest: %u.%u.%u.%u\n", 82 "dest: %u.%u.%u.%u\n",
83 NIPQUAD(dest->addr)); 83 NIPQUAD(dest->addr.ip));
84 return NULL; 84 return NULL;
85 } 85 }
86 __ip_vs_dst_set(dest, rtos, dst_clone(&rt->u.dst)); 86 __ip_vs_dst_set(dest, rtos, dst_clone(&rt->u.dst));
87 IP_VS_DBG(10, "new dst %u.%u.%u.%u, refcnt=%d, rtos=%X\n", 87 IP_VS_DBG(10, "new dst %u.%u.%u.%u, refcnt=%d, rtos=%X\n",
88 NIPQUAD(dest->addr), 88 NIPQUAD(dest->addr.ip),
89 atomic_read(&rt->u.dst.__refcnt), rtos); 89 atomic_read(&rt->u.dst.__refcnt), rtos);
90 } 90 }
91 spin_unlock(&dest->dst_lock); 91 spin_unlock(&dest->dst_lock);
@@ -94,14 +94,14 @@ __ip_vs_get_out_rt(struct ip_vs_conn *cp, u32 rtos)
94 .oif = 0, 94 .oif = 0,
95 .nl_u = { 95 .nl_u = {
96 .ip4_u = { 96 .ip4_u = {
97 .daddr = cp->daddr, 97 .daddr = cp->daddr.ip,
98 .saddr = 0, 98 .saddr = 0,
99 .tos = rtos, } }, 99 .tos = rtos, } },
100 }; 100 };
101 101
102 if (ip_route_output_key(&init_net, &rt, &fl)) { 102 if (ip_route_output_key(&init_net, &rt, &fl)) {
103 IP_VS_DBG_RL("ip_route_output error, dest: " 103 IP_VS_DBG_RL("ip_route_output error, dest: "
104 "%u.%u.%u.%u\n", NIPQUAD(cp->daddr)); 104 "%u.%u.%u.%u\n", NIPQUAD(cp->daddr.ip));
105 return NULL; 105 return NULL;
106 } 106 }
107 } 107 }
@@ -264,7 +264,7 @@ ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
264 /* mangle the packet */ 264 /* mangle the packet */
265 if (pp->dnat_handler && !pp->dnat_handler(skb, pp, cp)) 265 if (pp->dnat_handler && !pp->dnat_handler(skb, pp, cp))
266 goto tx_error; 266 goto tx_error;
267 ip_hdr(skb)->daddr = cp->daddr; 267 ip_hdr(skb)->daddr = cp->daddr.ip;
268 ip_send_check(ip_hdr(skb)); 268 ip_send_check(ip_hdr(skb));
269 269
270 IP_VS_DBG_PKT(10, pp, skb, 0, "After DNAT"); 270 IP_VS_DBG_PKT(10, pp, skb, 0, "After DNAT");