aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ipvs/ip_vs_ctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/ipvs/ip_vs_ctl.c')
-rw-r--r--net/ipv4/ipvs/ip_vs_ctl.c37
1 files changed, 19 insertions, 18 deletions
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);