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.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c
index a2d69b2ce6a1..1f3fc66e6943 100644
--- a/net/ipv4/ipvs/ip_vs_ctl.c
+++ b/net/ipv4/ipvs/ip_vs_ctl.c
@@ -421,23 +421,24 @@ __ip_vs_svc_fwm_get(int af, __u32 fwmark)
421} 421}
422 422
423struct ip_vs_service * 423struct ip_vs_service *
424ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport) 424ip_vs_service_get(int af, __u32 fwmark, __u16 protocol,
425 const union nf_inet_addr *vaddr, __be16 vport)
425{ 426{
426 struct ip_vs_service *svc; 427 struct ip_vs_service *svc;
427 union nf_inet_addr _vaddr = { .ip = vaddr }; 428
428 read_lock(&__ip_vs_svc_lock); 429 read_lock(&__ip_vs_svc_lock);
429 430
430 /* 431 /*
431 * Check the table hashed by fwmark first 432 * Check the table hashed by fwmark first
432 */ 433 */
433 if (fwmark && (svc = __ip_vs_svc_fwm_get(AF_INET, fwmark))) 434 if (fwmark && (svc = __ip_vs_svc_fwm_get(af, fwmark)))
434 goto out; 435 goto out;
435 436
436 /* 437 /*
437 * Check the table hashed by <protocol,addr,port> 438 * Check the table hashed by <protocol,addr,port>
438 * for "full" addressed entries 439 * for "full" addressed entries
439 */ 440 */
440 svc = __ip_vs_service_get(AF_INET, protocol, &_vaddr, vport); 441 svc = __ip_vs_service_get(af, protocol, vaddr, vport);
441 442
442 if (svc == NULL 443 if (svc == NULL
443 && protocol == IPPROTO_TCP 444 && protocol == IPPROTO_TCP
@@ -447,7 +448,7 @@ ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport)
447 * Check if ftp service entry exists, the packet 448 * Check if ftp service entry exists, the packet
448 * might belong to FTP data connections. 449 * might belong to FTP data connections.
449 */ 450 */
450 svc = __ip_vs_service_get(AF_INET, protocol, &_vaddr, FTPPORT); 451 svc = __ip_vs_service_get(af, protocol, vaddr, FTPPORT);
451 } 452 }
452 453
453 if (svc == NULL 454 if (svc == NULL
@@ -455,16 +456,16 @@ ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport)
455 /* 456 /*
456 * Check if the catch-all port (port zero) exists 457 * Check if the catch-all port (port zero) exists
457 */ 458 */
458 svc = __ip_vs_service_get(AF_INET, protocol, &_vaddr, 0); 459 svc = __ip_vs_service_get(af, protocol, vaddr, 0);
459 } 460 }
460 461
461 out: 462 out:
462 read_unlock(&__ip_vs_svc_lock); 463 read_unlock(&__ip_vs_svc_lock);
463 464
464 IP_VS_DBG(9, "lookup service: fwm %u %s %u.%u.%u.%u:%u %s\n", 465 IP_VS_DBG_BUF(9, "lookup service: fwm %u %s %s:%u %s\n",
465 fwmark, ip_vs_proto_name(protocol), 466 fwmark, ip_vs_proto_name(protocol),
466 NIPQUAD(vaddr), ntohs(vport), 467 IP_VS_DBG_ADDR(af, vaddr), ntohs(vport),
467 svc?"hit":"not hit"); 468 svc ? "hit" : "not hit");
468 469
469 return svc; 470 return svc;
470} 471}
@@ -605,8 +606,9 @@ struct ip_vs_dest *ip_vs_find_dest(__be32 daddr, __be16 dport,
605{ 606{
606 struct ip_vs_dest *dest; 607 struct ip_vs_dest *dest;
607 struct ip_vs_service *svc; 608 struct ip_vs_service *svc;
609 union nf_inet_addr _vaddr = { .ip = vaddr };
608 610
609 svc = ip_vs_service_get(0, protocol, vaddr, vport); 611 svc = ip_vs_service_get(AF_INET, 0, protocol, &_vaddr, vport);
610 if (!svc) 612 if (!svc)
611 return NULL; 613 return NULL;
612 dest = ip_vs_lookup_dest(svc, daddr, dport); 614 dest = ip_vs_lookup_dest(svc, daddr, dport);