aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulius Volz <juliusv@google.com>2008-09-02 09:55:53 -0400
committerSimon Horman <horms@verge.net.au>2008-09-04 21:17:12 -0400
commitcfc78c5a09241a3a9561466834996a7fb90c4228 (patch)
tree7377af0f95a7dbfc877d927534c23c7146f3e813
parent09571c7ae30865adfa79dccd12a822a65d2c4b5a (diff)
IPVS: Adjust various debug outputs to use new macros
Adjust various debug outputs to use the new *_BUF macro variants for correct output of v4/v6 addresses. Signed-off-by: Julius Volz <juliusv@google.com> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--include/net/ip_vs.h53
-rw-r--r--net/ipv4/ipvs/ip_vs_conn.c57
-rw-r--r--net/ipv4/ipvs/ip_vs_ctl.c24
-rw-r--r--net/ipv4/ipvs/ip_vs_proto_tcp.c45
-rw-r--r--net/ipv4/ipvs/ip_vs_proto_udp.c15
5 files changed, 111 insertions, 83 deletions
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index a719c0ef99ec..1b13cef4b547 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -680,24 +680,32 @@ static inline void ip_vs_control_del(struct ip_vs_conn *cp)
680{ 680{
681 struct ip_vs_conn *ctl_cp = cp->control; 681 struct ip_vs_conn *ctl_cp = cp->control;
682 if (!ctl_cp) { 682 if (!ctl_cp) {
683 IP_VS_ERR("request control DEL for uncontrolled: " 683 IP_VS_ERR_BUF("request control DEL for uncontrolled: "
684 "%d.%d.%d.%d:%d to %d.%d.%d.%d:%d\n", 684 "%s:%d to %s:%d\n",
685 NIPQUAD(cp->caddr),ntohs(cp->cport), 685 IP_VS_DBG_ADDR(cp->af, &cp->caddr),
686 NIPQUAD(cp->vaddr),ntohs(cp->vport)); 686 ntohs(cp->cport),
687 IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
688 ntohs(cp->vport));
689
687 return; 690 return;
688 } 691 }
689 692
690 IP_VS_DBG(7, "DELeting control for: " 693 IP_VS_DBG_BUF(7, "DELeting control for: "
691 "cp.dst=%d.%d.%d.%d:%d ctl_cp.dst=%d.%d.%d.%d:%d\n", 694 "cp.dst=%s:%d ctl_cp.dst=%s:%d\n",
692 NIPQUAD(cp->caddr),ntohs(cp->cport), 695 IP_VS_DBG_ADDR(cp->af, &cp->caddr),
693 NIPQUAD(ctl_cp->caddr),ntohs(ctl_cp->cport)); 696 ntohs(cp->cport),
697 IP_VS_DBG_ADDR(cp->af, &ctl_cp->caddr),
698 ntohs(ctl_cp->cport));
694 699
695 cp->control = NULL; 700 cp->control = NULL;
696 if (atomic_read(&ctl_cp->n_control) == 0) { 701 if (atomic_read(&ctl_cp->n_control) == 0) {
697 IP_VS_ERR("BUG control DEL with n=0 : " 702 IP_VS_ERR_BUF("BUG control DEL with n=0 : "
698 "%d.%d.%d.%d:%d to %d.%d.%d.%d:%d\n", 703 "%s:%d to %s:%d\n",
699 NIPQUAD(cp->caddr),ntohs(cp->cport), 704 IP_VS_DBG_ADDR(cp->af, &cp->caddr),
700 NIPQUAD(cp->vaddr),ntohs(cp->vport)); 705 ntohs(cp->cport),
706 IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
707 ntohs(cp->vport));
708
701 return; 709 return;
702 } 710 }
703 atomic_dec(&ctl_cp->n_control); 711 atomic_dec(&ctl_cp->n_control);
@@ -707,17 +715,22 @@ static inline void
707ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp) 715ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp)
708{ 716{
709 if (cp->control) { 717 if (cp->control) {
710 IP_VS_ERR("request control ADD for already controlled: " 718 IP_VS_ERR_BUF("request control ADD for already controlled: "
711 "%d.%d.%d.%d:%d to %d.%d.%d.%d:%d\n", 719 "%s:%d to %s:%d\n",
712 NIPQUAD(cp->caddr),ntohs(cp->cport), 720 IP_VS_DBG_ADDR(cp->af, &cp->caddr),
713 NIPQUAD(cp->vaddr),ntohs(cp->vport)); 721 ntohs(cp->cport),
722 IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
723 ntohs(cp->vport));
724
714 ip_vs_control_del(cp); 725 ip_vs_control_del(cp);
715 } 726 }
716 727
717 IP_VS_DBG(7, "ADDing control for: " 728 IP_VS_DBG_BUF(7, "ADDing control for: "
718 "cp.dst=%d.%d.%d.%d:%d ctl_cp.dst=%d.%d.%d.%d:%d\n", 729 "cp.dst=%s:%d ctl_cp.dst=%s:%d\n",
719 NIPQUAD(cp->caddr),ntohs(cp->cport), 730 IP_VS_DBG_ADDR(cp->af, &cp->caddr),
720 NIPQUAD(ctl_cp->caddr),ntohs(ctl_cp->cport)); 731 ntohs(cp->cport),
732 IP_VS_DBG_ADDR(cp->af, &ctl_cp->caddr),
733 ntohs(ctl_cp->cport));
721 734
722 cp->control = ctl_cp; 735 cp->control = ctl_cp;
723 atomic_inc(&ctl_cp->n_control); 736 atomic_inc(&ctl_cp->n_control);
diff --git a/net/ipv4/ipvs/ip_vs_conn.c b/net/ipv4/ipvs/ip_vs_conn.c
index e7603d749c09..9a24332fbed8 100644
--- a/net/ipv4/ipvs/ip_vs_conn.c
+++ b/net/ipv4/ipvs/ip_vs_conn.c
@@ -449,16 +449,16 @@ ip_vs_bind_dest(struct ip_vs_conn *cp, struct ip_vs_dest *dest)
449 cp->flags |= atomic_read(&dest->conn_flags); 449 cp->flags |= atomic_read(&dest->conn_flags);
450 cp->dest = dest; 450 cp->dest = dest;
451 451
452 IP_VS_DBG(7, "Bind-dest %s c:%u.%u.%u.%u:%d v:%u.%u.%u.%u:%d " 452 IP_VS_DBG_BUF(7, "Bind-dest %s c:%s:%d v:%s:%d "
453 "d:%u.%u.%u.%u:%d fwd:%c s:%u conn->flags:%X conn->refcnt:%d " 453 "d:%s:%d fwd:%c s:%u conn->flags:%X conn->refcnt:%d "
454 "dest->refcnt:%d\n", 454 "dest->refcnt:%d\n",
455 ip_vs_proto_name(cp->protocol), 455 ip_vs_proto_name(cp->protocol),
456 NIPQUAD(cp->caddr.ip), ntohs(cp->cport), 456 IP_VS_DBG_ADDR(cp->af, &cp->caddr), ntohs(cp->cport),
457 NIPQUAD(cp->vaddr.ip), ntohs(cp->vport), 457 IP_VS_DBG_ADDR(cp->af, &cp->vaddr), ntohs(cp->vport),
458 NIPQUAD(cp->daddr.ip), ntohs(cp->dport), 458 IP_VS_DBG_ADDR(cp->af, &cp->daddr), ntohs(cp->dport),
459 ip_vs_fwd_tag(cp), cp->state, 459 ip_vs_fwd_tag(cp), cp->state,
460 cp->flags, atomic_read(&cp->refcnt), 460 cp->flags, atomic_read(&cp->refcnt),
461 atomic_read(&dest->refcnt)); 461 atomic_read(&dest->refcnt));
462 462
463 /* Update the connection counters */ 463 /* Update the connection counters */
464 if (!(cp->flags & IP_VS_CONN_F_TEMPLATE)) { 464 if (!(cp->flags & IP_VS_CONN_F_TEMPLATE)) {
@@ -512,16 +512,16 @@ static inline void ip_vs_unbind_dest(struct ip_vs_conn *cp)
512 if (!dest) 512 if (!dest)
513 return; 513 return;
514 514
515 IP_VS_DBG(7, "Unbind-dest %s c:%u.%u.%u.%u:%d v:%u.%u.%u.%u:%d " 515 IP_VS_DBG_BUF(7, "Unbind-dest %s c:%s:%d v:%s:%d "
516 "d:%u.%u.%u.%u:%d fwd:%c s:%u conn->flags:%X conn->refcnt:%d " 516 "d:%s:%d fwd:%c s:%u conn->flags:%X conn->refcnt:%d "
517 "dest->refcnt:%d\n", 517 "dest->refcnt:%d\n",
518 ip_vs_proto_name(cp->protocol), 518 ip_vs_proto_name(cp->protocol),
519 NIPQUAD(cp->caddr.ip), ntohs(cp->cport), 519 IP_VS_DBG_ADDR(cp->af, &cp->caddr), ntohs(cp->cport),
520 NIPQUAD(cp->vaddr.ip), ntohs(cp->vport), 520 IP_VS_DBG_ADDR(cp->af, &cp->vaddr), ntohs(cp->vport),
521 NIPQUAD(cp->daddr.ip), ntohs(cp->dport), 521 IP_VS_DBG_ADDR(cp->af, &cp->daddr), ntohs(cp->dport),
522 ip_vs_fwd_tag(cp), cp->state, 522 ip_vs_fwd_tag(cp), cp->state,
523 cp->flags, atomic_read(&cp->refcnt), 523 cp->flags, atomic_read(&cp->refcnt),
524 atomic_read(&dest->refcnt)); 524 atomic_read(&dest->refcnt));
525 525
526 /* Update the connection counters */ 526 /* Update the connection counters */
527 if (!(cp->flags & IP_VS_CONN_F_TEMPLATE)) { 527 if (!(cp->flags & IP_VS_CONN_F_TEMPLATE)) {
@@ -574,13 +574,16 @@ int ip_vs_check_template(struct ip_vs_conn *ct)
574 !(dest->flags & IP_VS_DEST_F_AVAILABLE) || 574 !(dest->flags & IP_VS_DEST_F_AVAILABLE) ||
575 (sysctl_ip_vs_expire_quiescent_template && 575 (sysctl_ip_vs_expire_quiescent_template &&
576 (atomic_read(&dest->weight) == 0))) { 576 (atomic_read(&dest->weight) == 0))) {
577 IP_VS_DBG(9, "check_template: dest not available for " 577 IP_VS_DBG_BUF(9, "check_template: dest not available for "
578 "protocol %s s:%u.%u.%u.%u:%d v:%u.%u.%u.%u:%d " 578 "protocol %s s:%s:%d v:%s:%d "
579 "-> d:%u.%u.%u.%u:%d\n", 579 "-> d:%s:%d\n",
580 ip_vs_proto_name(ct->protocol), 580 ip_vs_proto_name(ct->protocol),
581 NIPQUAD(ct->caddr.ip), ntohs(ct->cport), 581 IP_VS_DBG_ADDR(ct->af, &ct->caddr),
582 NIPQUAD(ct->vaddr.ip), ntohs(ct->vport), 582 ntohs(ct->cport),
583 NIPQUAD(ct->daddr.ip), ntohs(ct->dport)); 583 IP_VS_DBG_ADDR(ct->af, &ct->vaddr),
584 ntohs(ct->vport),
585 IP_VS_DBG_ADDR(ct->af, &ct->daddr),
586 ntohs(ct->dport));
584 587
585 /* 588 /*
586 * Invalidate the connection template 589 * Invalidate the connection template
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c
index 640203a153c6..6dbc527285fa 100644
--- a/net/ipv4/ipvs/ip_vs_ctl.c
+++ b/net/ipv4/ipvs/ip_vs_ctl.c
@@ -924,13 +924,14 @@ ip_vs_add_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest)
924 dest = ip_vs_trash_get_dest(svc, &daddr, dport); 924 dest = ip_vs_trash_get_dest(svc, &daddr, dport);
925 925
926 if (dest != NULL) { 926 if (dest != NULL) {
927 IP_VS_DBG(3, "Get destination %u.%u.%u.%u:%u from trash, " 927 IP_VS_DBG_BUF(3, "Get destination %s:%u from trash, "
928 "dest->refcnt=%d, service %u/%u.%u.%u.%u:%u\n", 928 "dest->refcnt=%d, service %u/%s:%u\n",
929 NIPQUAD(daddr), ntohs(dport), 929 IP_VS_DBG_ADDR(svc->af, &daddr), ntohs(dport),
930 atomic_read(&dest->refcnt), 930 atomic_read(&dest->refcnt),
931 dest->vfwmark, 931 dest->vfwmark,
932 NIPQUAD(dest->vaddr.ip), 932 IP_VS_DBG_ADDR(svc->af, &dest->vaddr),
933 ntohs(dest->vport)); 933 ntohs(dest->vport));
934
934 __ip_vs_update_dest(svc, dest, udest); 935 __ip_vs_update_dest(svc, dest, udest);
935 936
936 /* 937 /*
@@ -1076,10 +1077,11 @@ static void __ip_vs_del_dest(struct ip_vs_dest *dest)
1076 atomic_dec(&dest->svc->refcnt); 1077 atomic_dec(&dest->svc->refcnt);
1077 kfree(dest); 1078 kfree(dest);
1078 } else { 1079 } else {
1079 IP_VS_DBG(3, "Moving dest %u.%u.%u.%u:%u into trash, " 1080 IP_VS_DBG_BUF(3, "Moving dest %s:%u into trash, "
1080 "dest->refcnt=%d\n", 1081 "dest->refcnt=%d\n",
1081 NIPQUAD(dest->addr.ip), ntohs(dest->port), 1082 IP_VS_DBG_ADDR(dest->af, &dest->addr),
1082 atomic_read(&dest->refcnt)); 1083 ntohs(dest->port),
1084 atomic_read(&dest->refcnt));
1083 list_add(&dest->n_list, &ip_vs_dest_trash); 1085 list_add(&dest->n_list, &ip_vs_dest_trash);
1084 atomic_inc(&dest->refcnt); 1086 atomic_inc(&dest->refcnt);
1085 } 1087 }
diff --git a/net/ipv4/ipvs/ip_vs_proto_tcp.c b/net/ipv4/ipvs/ip_vs_proto_tcp.c
index 3da2bb05ee74..de8ed73997c7 100644
--- a/net/ipv4/ipvs/ip_vs_proto_tcp.c
+++ b/net/ipv4/ipvs/ip_vs_proto_tcp.c
@@ -490,19 +490,23 @@ set_tcp_state(struct ip_vs_protocol *pp, struct ip_vs_conn *cp,
490 if (new_state != cp->state) { 490 if (new_state != cp->state) {
491 struct ip_vs_dest *dest = cp->dest; 491 struct ip_vs_dest *dest = cp->dest;
492 492
493 IP_VS_DBG(8, "%s %s [%c%c%c%c] %u.%u.%u.%u:%d->" 493 IP_VS_DBG_BUF(8, "%s %s [%c%c%c%c] %s:%d->"
494 "%u.%u.%u.%u:%d state: %s->%s conn->refcnt:%d\n", 494 "%s:%d state: %s->%s conn->refcnt:%d\n",
495 pp->name, 495 pp->name,
496 (state_off==TCP_DIR_OUTPUT)?"output ":"input ", 496 ((state_off == TCP_DIR_OUTPUT) ?
497 th->syn? 'S' : '.', 497 "output " : "input "),
498 th->fin? 'F' : '.', 498 th->syn ? 'S' : '.',
499 th->ack? 'A' : '.', 499 th->fin ? 'F' : '.',
500 th->rst? 'R' : '.', 500 th->ack ? 'A' : '.',
501 NIPQUAD(cp->daddr.ip), ntohs(cp->dport), 501 th->rst ? 'R' : '.',
502 NIPQUAD(cp->caddr.ip), ntohs(cp->cport), 502 IP_VS_DBG_ADDR(cp->af, &cp->daddr),
503 tcp_state_name(cp->state), 503 ntohs(cp->dport),
504 tcp_state_name(new_state), 504 IP_VS_DBG_ADDR(cp->af, &cp->caddr),
505 atomic_read(&cp->refcnt)); 505 ntohs(cp->cport),
506 tcp_state_name(cp->state),
507 tcp_state_name(new_state),
508 atomic_read(&cp->refcnt));
509
506 if (dest) { 510 if (dest) {
507 if (!(cp->flags & IP_VS_CONN_F_INACTIVE) && 511 if (!(cp->flags & IP_VS_CONN_F_INACTIVE) &&
508 (new_state != IP_VS_TCP_S_ESTABLISHED)) { 512 (new_state != IP_VS_TCP_S_ESTABLISHED)) {
@@ -623,12 +627,15 @@ tcp_app_conn_bind(struct ip_vs_conn *cp)
623 break; 627 break;
624 spin_unlock(&tcp_app_lock); 628 spin_unlock(&tcp_app_lock);
625 629
626 IP_VS_DBG(9, "%s: Binding conn %u.%u.%u.%u:%u->" 630 IP_VS_DBG_BUF(9, "%s: Binding conn %s:%u->"
627 "%u.%u.%u.%u:%u to app %s on port %u\n", 631 "%s:%u to app %s on port %u\n",
628 __func__, 632 __func__,
629 NIPQUAD(cp->caddr.ip), ntohs(cp->cport), 633 IP_VS_DBG_ADDR(cp->af, &cp->caddr),
630 NIPQUAD(cp->vaddr.ip), ntohs(cp->vport), 634 ntohs(cp->cport),
631 inc->name, ntohs(inc->port)); 635 IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
636 ntohs(cp->vport),
637 inc->name, ntohs(inc->port));
638
632 cp->app = inc; 639 cp->app = inc;
633 if (inc->init_conn) 640 if (inc->init_conn)
634 result = inc->init_conn(inc, cp); 641 result = inc->init_conn(inc, cp);
diff --git a/net/ipv4/ipvs/ip_vs_proto_udp.c b/net/ipv4/ipvs/ip_vs_proto_udp.c
index fd8bd934cc02..5f2073e41cf6 100644
--- a/net/ipv4/ipvs/ip_vs_proto_udp.c
+++ b/net/ipv4/ipvs/ip_vs_proto_udp.c
@@ -408,12 +408,15 @@ static int udp_app_conn_bind(struct ip_vs_conn *cp)
408 break; 408 break;
409 spin_unlock(&udp_app_lock); 409 spin_unlock(&udp_app_lock);
410 410
411 IP_VS_DBG(9, "%s: Binding conn %u.%u.%u.%u:%u->" 411 IP_VS_DBG_BUF(9, "%s: Binding conn %s:%u->"
412 "%u.%u.%u.%u:%u to app %s on port %u\n", 412 "%s:%u to app %s on port %u\n",
413 __func__, 413 __func__,
414 NIPQUAD(cp->caddr.ip), ntohs(cp->cport), 414 IP_VS_DBG_ADDR(cp->af, &cp->caddr),
415 NIPQUAD(cp->vaddr.ip), ntohs(cp->vport), 415 ntohs(cp->cport),
416 inc->name, ntohs(inc->port)); 416 IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
417 ntohs(cp->vport),
418 inc->name, ntohs(inc->port));
419
417 cp->app = inc; 420 cp->app = inc;
418 if (inc->init_conn) 421 if (inc->init_conn)
419 result = inc->init_conn(inc, cp); 422 result = inc->init_conn(inc, cp);