Commit cfc78c5a authored by Julius Volz's avatar Julius Volz Committed by Simon Horman

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: default avatarJulius Volz <juliusv@google.com>
Signed-off-by: default avatarSimon Horman <horms@verge.net.au>
parent 09571c7a
...@@ -680,24 +680,32 @@ static inline void ip_vs_control_del(struct ip_vs_conn *cp) ...@@ -680,24 +680,32 @@ static inline void ip_vs_control_del(struct ip_vs_conn *cp)
{ {
struct ip_vs_conn *ctl_cp = cp->control; struct ip_vs_conn *ctl_cp = cp->control;
if (!ctl_cp) { if (!ctl_cp) {
IP_VS_ERR("request control DEL for uncontrolled: " IP_VS_ERR_BUF("request control DEL for uncontrolled: "
"%d.%d.%d.%d:%d to %d.%d.%d.%d:%d\n", "%s:%d to %s:%d\n",
NIPQUAD(cp->caddr),ntohs(cp->cport), IP_VS_DBG_ADDR(cp->af, &cp->caddr),
NIPQUAD(cp->vaddr),ntohs(cp->vport)); ntohs(cp->cport),
IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
ntohs(cp->vport));
return; return;
} }
IP_VS_DBG(7, "DELeting control for: " IP_VS_DBG_BUF(7, "DELeting control for: "
"cp.dst=%d.%d.%d.%d:%d ctl_cp.dst=%d.%d.%d.%d:%d\n", "cp.dst=%s:%d ctl_cp.dst=%s:%d\n",
NIPQUAD(cp->caddr),ntohs(cp->cport), IP_VS_DBG_ADDR(cp->af, &cp->caddr),
NIPQUAD(ctl_cp->caddr),ntohs(ctl_cp->cport)); ntohs(cp->cport),
IP_VS_DBG_ADDR(cp->af, &ctl_cp->caddr),
ntohs(ctl_cp->cport));
cp->control = NULL; cp->control = NULL;
if (atomic_read(&ctl_cp->n_control) == 0) { if (atomic_read(&ctl_cp->n_control) == 0) {
IP_VS_ERR("BUG control DEL with n=0 : " IP_VS_ERR_BUF("BUG control DEL with n=0 : "
"%d.%d.%d.%d:%d to %d.%d.%d.%d:%d\n", "%s:%d to %s:%d\n",
NIPQUAD(cp->caddr),ntohs(cp->cport), IP_VS_DBG_ADDR(cp->af, &cp->caddr),
NIPQUAD(cp->vaddr),ntohs(cp->vport)); ntohs(cp->cport),
IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
ntohs(cp->vport));
return; return;
} }
atomic_dec(&ctl_cp->n_control); atomic_dec(&ctl_cp->n_control);
...@@ -707,17 +715,22 @@ static inline void ...@@ -707,17 +715,22 @@ static inline void
ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp) ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp)
{ {
if (cp->control) { if (cp->control) {
IP_VS_ERR("request control ADD for already controlled: " IP_VS_ERR_BUF("request control ADD for already controlled: "
"%d.%d.%d.%d:%d to %d.%d.%d.%d:%d\n", "%s:%d to %s:%d\n",
NIPQUAD(cp->caddr),ntohs(cp->cport), IP_VS_DBG_ADDR(cp->af, &cp->caddr),
NIPQUAD(cp->vaddr),ntohs(cp->vport)); ntohs(cp->cport),
IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
ntohs(cp->vport));
ip_vs_control_del(cp); ip_vs_control_del(cp);
} }
IP_VS_DBG(7, "ADDing control for: " IP_VS_DBG_BUF(7, "ADDing control for: "
"cp.dst=%d.%d.%d.%d:%d ctl_cp.dst=%d.%d.%d.%d:%d\n", "cp.dst=%s:%d ctl_cp.dst=%s:%d\n",
NIPQUAD(cp->caddr),ntohs(cp->cport), IP_VS_DBG_ADDR(cp->af, &cp->caddr),
NIPQUAD(ctl_cp->caddr),ntohs(ctl_cp->cport)); ntohs(cp->cport),
IP_VS_DBG_ADDR(cp->af, &ctl_cp->caddr),
ntohs(ctl_cp->cport));
cp->control = ctl_cp; cp->control = ctl_cp;
atomic_inc(&ctl_cp->n_control); atomic_inc(&ctl_cp->n_control);
......
...@@ -449,16 +449,16 @@ ip_vs_bind_dest(struct ip_vs_conn *cp, struct ip_vs_dest *dest) ...@@ -449,16 +449,16 @@ ip_vs_bind_dest(struct ip_vs_conn *cp, struct ip_vs_dest *dest)
cp->flags |= atomic_read(&dest->conn_flags); cp->flags |= atomic_read(&dest->conn_flags);
cp->dest = dest; cp->dest = dest;
IP_VS_DBG(7, "Bind-dest %s c:%u.%u.%u.%u:%d v:%u.%u.%u.%u:%d " IP_VS_DBG_BUF(7, "Bind-dest %s c:%s:%d v:%s:%d "
"d:%u.%u.%u.%u:%d fwd:%c s:%u conn->flags:%X conn->refcnt:%d " "d:%s:%d fwd:%c s:%u conn->flags:%X conn->refcnt:%d "
"dest->refcnt:%d\n", "dest->refcnt:%d\n",
ip_vs_proto_name(cp->protocol), ip_vs_proto_name(cp->protocol),
NIPQUAD(cp->caddr.ip), ntohs(cp->cport), IP_VS_DBG_ADDR(cp->af, &cp->caddr), ntohs(cp->cport),
NIPQUAD(cp->vaddr.ip), ntohs(cp->vport), IP_VS_DBG_ADDR(cp->af, &cp->vaddr), ntohs(cp->vport),
NIPQUAD(cp->daddr.ip), ntohs(cp->dport), IP_VS_DBG_ADDR(cp->af, &cp->daddr), ntohs(cp->dport),
ip_vs_fwd_tag(cp), cp->state, ip_vs_fwd_tag(cp), cp->state,
cp->flags, atomic_read(&cp->refcnt), cp->flags, atomic_read(&cp->refcnt),
atomic_read(&dest->refcnt)); atomic_read(&dest->refcnt));
/* Update the connection counters */ /* Update the connection counters */
if (!(cp->flags & IP_VS_CONN_F_TEMPLATE)) { 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,16 +512,16 @@ static inline void ip_vs_unbind_dest(struct ip_vs_conn *cp)
if (!dest) if (!dest)
return; return;
IP_VS_DBG(7, "Unbind-dest %s c:%u.%u.%u.%u:%d v:%u.%u.%u.%u:%d " IP_VS_DBG_BUF(7, "Unbind-dest %s c:%s:%d v:%s:%d "
"d:%u.%u.%u.%u:%d fwd:%c s:%u conn->flags:%X conn->refcnt:%d " "d:%s:%d fwd:%c s:%u conn->flags:%X conn->refcnt:%d "
"dest->refcnt:%d\n", "dest->refcnt:%d\n",
ip_vs_proto_name(cp->protocol), ip_vs_proto_name(cp->protocol),
NIPQUAD(cp->caddr.ip), ntohs(cp->cport), IP_VS_DBG_ADDR(cp->af, &cp->caddr), ntohs(cp->cport),
NIPQUAD(cp->vaddr.ip), ntohs(cp->vport), IP_VS_DBG_ADDR(cp->af, &cp->vaddr), ntohs(cp->vport),
NIPQUAD(cp->daddr.ip), ntohs(cp->dport), IP_VS_DBG_ADDR(cp->af, &cp->daddr), ntohs(cp->dport),
ip_vs_fwd_tag(cp), cp->state, ip_vs_fwd_tag(cp), cp->state,
cp->flags, atomic_read(&cp->refcnt), cp->flags, atomic_read(&cp->refcnt),
atomic_read(&dest->refcnt)); atomic_read(&dest->refcnt));
/* Update the connection counters */ /* Update the connection counters */
if (!(cp->flags & IP_VS_CONN_F_TEMPLATE)) { if (!(cp->flags & IP_VS_CONN_F_TEMPLATE)) {
...@@ -574,13 +574,16 @@ int ip_vs_check_template(struct ip_vs_conn *ct) ...@@ -574,13 +574,16 @@ int ip_vs_check_template(struct ip_vs_conn *ct)
!(dest->flags & IP_VS_DEST_F_AVAILABLE) || !(dest->flags & IP_VS_DEST_F_AVAILABLE) ||
(sysctl_ip_vs_expire_quiescent_template && (sysctl_ip_vs_expire_quiescent_template &&
(atomic_read(&dest->weight) == 0))) { (atomic_read(&dest->weight) == 0))) {
IP_VS_DBG(9, "check_template: dest not available for " IP_VS_DBG_BUF(9, "check_template: dest not available for "
"protocol %s s:%u.%u.%u.%u:%d v:%u.%u.%u.%u:%d " "protocol %s s:%s:%d v:%s:%d "
"-> d:%u.%u.%u.%u:%d\n", "-> d:%s:%d\n",
ip_vs_proto_name(ct->protocol), ip_vs_proto_name(ct->protocol),
NIPQUAD(ct->caddr.ip), ntohs(ct->cport), IP_VS_DBG_ADDR(ct->af, &ct->caddr),
NIPQUAD(ct->vaddr.ip), ntohs(ct->vport), ntohs(ct->cport),
NIPQUAD(ct->daddr.ip), ntohs(ct->dport)); IP_VS_DBG_ADDR(ct->af, &ct->vaddr),
ntohs(ct->vport),
IP_VS_DBG_ADDR(ct->af, &ct->daddr),
ntohs(ct->dport));
/* /*
* Invalidate the connection template * Invalidate the connection template
......
...@@ -924,13 +924,14 @@ ip_vs_add_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest) ...@@ -924,13 +924,14 @@ ip_vs_add_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest)
dest = ip_vs_trash_get_dest(svc, &daddr, dport); dest = ip_vs_trash_get_dest(svc, &daddr, dport);
if (dest != NULL) { if (dest != NULL) {
IP_VS_DBG(3, "Get destination %u.%u.%u.%u:%u from trash, " IP_VS_DBG_BUF(3, "Get destination %s:%u from trash, "
"dest->refcnt=%d, service %u/%u.%u.%u.%u:%u\n", "dest->refcnt=%d, service %u/%s:%u\n",
NIPQUAD(daddr), ntohs(dport), IP_VS_DBG_ADDR(svc->af, &daddr), ntohs(dport),
atomic_read(&dest->refcnt), atomic_read(&dest->refcnt),
dest->vfwmark, dest->vfwmark,
NIPQUAD(dest->vaddr.ip), IP_VS_DBG_ADDR(svc->af, &dest->vaddr),
ntohs(dest->vport)); ntohs(dest->vport));
__ip_vs_update_dest(svc, dest, udest); __ip_vs_update_dest(svc, dest, udest);
/* /*
...@@ -1076,10 +1077,11 @@ static void __ip_vs_del_dest(struct ip_vs_dest *dest) ...@@ -1076,10 +1077,11 @@ static void __ip_vs_del_dest(struct ip_vs_dest *dest)
atomic_dec(&dest->svc->refcnt); atomic_dec(&dest->svc->refcnt);
kfree(dest); kfree(dest);
} else { } else {
IP_VS_DBG(3, "Moving dest %u.%u.%u.%u:%u into trash, " IP_VS_DBG_BUF(3, "Moving dest %s:%u into trash, "
"dest->refcnt=%d\n", "dest->refcnt=%d\n",
NIPQUAD(dest->addr.ip), ntohs(dest->port), IP_VS_DBG_ADDR(dest->af, &dest->addr),
atomic_read(&dest->refcnt)); ntohs(dest->port),
atomic_read(&dest->refcnt));
list_add(&dest->n_list, &ip_vs_dest_trash); list_add(&dest->n_list, &ip_vs_dest_trash);
atomic_inc(&dest->refcnt); atomic_inc(&dest->refcnt);
} }
......
...@@ -490,19 +490,23 @@ set_tcp_state(struct ip_vs_protocol *pp, struct ip_vs_conn *cp, ...@@ -490,19 +490,23 @@ set_tcp_state(struct ip_vs_protocol *pp, struct ip_vs_conn *cp,
if (new_state != cp->state) { if (new_state != cp->state) {
struct ip_vs_dest *dest = cp->dest; struct ip_vs_dest *dest = cp->dest;
IP_VS_DBG(8, "%s %s [%c%c%c%c] %u.%u.%u.%u:%d->" IP_VS_DBG_BUF(8, "%s %s [%c%c%c%c] %s:%d->"
"%u.%u.%u.%u:%d state: %s->%s conn->refcnt:%d\n", "%s:%d state: %s->%s conn->refcnt:%d\n",
pp->name, pp->name,
(state_off==TCP_DIR_OUTPUT)?"output ":"input ", ((state_off == TCP_DIR_OUTPUT) ?
th->syn? 'S' : '.', "output " : "input "),
th->fin? 'F' : '.', th->syn ? 'S' : '.',
th->ack? 'A' : '.', th->fin ? 'F' : '.',
th->rst? 'R' : '.', th->ack ? 'A' : '.',
NIPQUAD(cp->daddr.ip), ntohs(cp->dport), th->rst ? 'R' : '.',
NIPQUAD(cp->caddr.ip), ntohs(cp->cport), IP_VS_DBG_ADDR(cp->af, &cp->daddr),
tcp_state_name(cp->state), ntohs(cp->dport),
tcp_state_name(new_state), IP_VS_DBG_ADDR(cp->af, &cp->caddr),
atomic_read(&cp->refcnt)); ntohs(cp->cport),
tcp_state_name(cp->state),
tcp_state_name(new_state),
atomic_read(&cp->refcnt));
if (dest) { if (dest) {
if (!(cp->flags & IP_VS_CONN_F_INACTIVE) && if (!(cp->flags & IP_VS_CONN_F_INACTIVE) &&
(new_state != IP_VS_TCP_S_ESTABLISHED)) { (new_state != IP_VS_TCP_S_ESTABLISHED)) {
...@@ -623,12 +627,15 @@ tcp_app_conn_bind(struct ip_vs_conn *cp) ...@@ -623,12 +627,15 @@ tcp_app_conn_bind(struct ip_vs_conn *cp)
break; break;
spin_unlock(&tcp_app_lock); spin_unlock(&tcp_app_lock);
IP_VS_DBG(9, "%s: Binding conn %u.%u.%u.%u:%u->" IP_VS_DBG_BUF(9, "%s: Binding conn %s:%u->"
"%u.%u.%u.%u:%u to app %s on port %u\n", "%s:%u to app %s on port %u\n",
__func__, __func__,
NIPQUAD(cp->caddr.ip), ntohs(cp->cport), IP_VS_DBG_ADDR(cp->af, &cp->caddr),
NIPQUAD(cp->vaddr.ip), ntohs(cp->vport), ntohs(cp->cport),
inc->name, ntohs(inc->port)); IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
ntohs(cp->vport),
inc->name, ntohs(inc->port));
cp->app = inc; cp->app = inc;
if (inc->init_conn) if (inc->init_conn)
result = inc->init_conn(inc, cp); result = inc->init_conn(inc, cp);
......
...@@ -408,12 +408,15 @@ static int udp_app_conn_bind(struct ip_vs_conn *cp) ...@@ -408,12 +408,15 @@ static int udp_app_conn_bind(struct ip_vs_conn *cp)
break; break;
spin_unlock(&udp_app_lock); spin_unlock(&udp_app_lock);
IP_VS_DBG(9, "%s: Binding conn %u.%u.%u.%u:%u->" IP_VS_DBG_BUF(9, "%s: Binding conn %s:%u->"
"%u.%u.%u.%u:%u to app %s on port %u\n", "%s:%u to app %s on port %u\n",
__func__, __func__,
NIPQUAD(cp->caddr.ip), ntohs(cp->cport), IP_VS_DBG_ADDR(cp->af, &cp->caddr),
NIPQUAD(cp->vaddr.ip), ntohs(cp->vport), ntohs(cp->cport),
inc->name, ntohs(inc->port)); IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
ntohs(cp->vport),
inc->name, ntohs(inc->port));
cp->app = inc; cp->app = inc;
if (inc->init_conn) if (inc->init_conn)
result = inc->init_conn(inc, cp); result = inc->init_conn(inc, cp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment