diff mbox series

[v5] ipvs: adjust the debug info in function set_tcp_state

Message ID 20200928024938.97121-1-bigclouds@163.com
State Accepted
Delegated to: Pablo Neira
Headers show
Series [v5] ipvs: adjust the debug info in function set_tcp_state | expand

Commit Message

longguang.yue Sept. 28, 2020, 2:49 a.m. UTC
Outputting client,virtual,dst addresses info when tcp state changes,
which makes the connection debug more clear

Signed-off-by: longguang.yue <bigclouds@163.com>
---
 net/netfilter/ipvs/ip_vs_proto_tcp.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

yue longguang Sept. 29, 2020, 2:15 a.m. UTC | #1
I sincerely apologize for the trouble which takes up much of your
time. If the last patch does not work , would you please fix it?
thanks

On Mon, Sep 28, 2020 at 10:51 AM longguang.yue <bigclouds@163.com> wrote:
>
> Outputting client,virtual,dst addresses info when tcp state changes,
> which makes the connection debug more clear
>
> Signed-off-by: longguang.yue <bigclouds@163.com>
> ---
>  net/netfilter/ipvs/ip_vs_proto_tcp.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/net/netfilter/ipvs/ip_vs_proto_tcp.c b/net/netfilter/ipvs/ip_vs_proto_tcp.c
> index dc2e7da2742a..7da51390cea6 100644
> --- a/net/netfilter/ipvs/ip_vs_proto_tcp.c
> +++ b/net/netfilter/ipvs/ip_vs_proto_tcp.c
> @@ -539,8 +539,8 @@ set_tcp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
>         if (new_state != cp->state) {
>                 struct ip_vs_dest *dest = cp->dest;
>
> -               IP_VS_DBG_BUF(8, "%s %s [%c%c%c%c] %s:%d->"
> -                             "%s:%d state: %s->%s conn->refcnt:%d\n",
> +               IP_VS_DBG_BUF(8, "%s %s [%c%c%c%c] c:%s:%d v:%s:%d "
> +                             "d:%s:%d state: %s->%s conn->refcnt:%d\n",
>                               pd->pp->name,
>                               ((state_off == TCP_DIR_OUTPUT) ?
>                                "output " : "input "),
> @@ -548,10 +548,12 @@ set_tcp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
>                               th->fin ? 'F' : '.',
>                               th->ack ? 'A' : '.',
>                               th->rst ? 'R' : '.',
> -                             IP_VS_DBG_ADDR(cp->daf, &cp->daddr),
> -                             ntohs(cp->dport),
>                               IP_VS_DBG_ADDR(cp->af, &cp->caddr),
>                               ntohs(cp->cport),
> +                             IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
> +                             ntohs(cp->vport),
> +                             IP_VS_DBG_ADDR(cp->daf, &cp->daddr),
> +                             ntohs(cp->dport),
>                               tcp_state_name(cp->state),
>                               tcp_state_name(new_state),
>                               refcount_read(&cp->refcnt));
> --
> 2.20.1 (Apple Git-117)
>
Julian Anastasov Sept. 30, 2020, 5:08 a.m. UTC | #2
Hello,

On Mon, 28 Sep 2020, longguang.yue wrote:

> Outputting client,virtual,dst addresses info when tcp state changes,
> which makes the connection debug more clear
> 
> Signed-off-by: longguang.yue <bigclouds@163.com>

	OK, v5 can be used instead of fixing v4.

Acked-by: Julian Anastasov <ja@ssi.bg>

> ---

	longguang.yue, at this place after --- you can add info
for changes between versions, eg:
v5: fix indentation

	Use this for other patches, so that we know what is
changed between versions.

>  net/netfilter/ipvs/ip_vs_proto_tcp.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/net/netfilter/ipvs/ip_vs_proto_tcp.c b/net/netfilter/ipvs/ip_vs_proto_tcp.c
> index dc2e7da2742a..7da51390cea6 100644
> --- a/net/netfilter/ipvs/ip_vs_proto_tcp.c
> +++ b/net/netfilter/ipvs/ip_vs_proto_tcp.c
> @@ -539,8 +539,8 @@ set_tcp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
>  	if (new_state != cp->state) {
>  		struct ip_vs_dest *dest = cp->dest;
>  
> -		IP_VS_DBG_BUF(8, "%s %s [%c%c%c%c] %s:%d->"
> -			      "%s:%d state: %s->%s conn->refcnt:%d\n",
> +		IP_VS_DBG_BUF(8, "%s %s [%c%c%c%c] c:%s:%d v:%s:%d "
> +			      "d:%s:%d state: %s->%s conn->refcnt:%d\n",
>  			      pd->pp->name,
>  			      ((state_off == TCP_DIR_OUTPUT) ?
>  			       "output " : "input "),
> @@ -548,10 +548,12 @@ set_tcp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
>  			      th->fin ? 'F' : '.',
>  			      th->ack ? 'A' : '.',
>  			      th->rst ? 'R' : '.',
> -			      IP_VS_DBG_ADDR(cp->daf, &cp->daddr),
> -			      ntohs(cp->dport),
>  			      IP_VS_DBG_ADDR(cp->af, &cp->caddr),
>  			      ntohs(cp->cport),
> +			      IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
> +			      ntohs(cp->vport),
> +			      IP_VS_DBG_ADDR(cp->daf, &cp->daddr),
> +			      ntohs(cp->dport),
>  			      tcp_state_name(cp->state),
>  			      tcp_state_name(new_state),
>  			      refcount_read(&cp->refcnt));
> -- 
> 2.20.1 (Apple Git-117)

Regards

--
Julian Anastasov <ja@ssi.bg>
yue longguang Sept. 30, 2020, 5:39 a.m. UTC | #3
It's  done.


On Wed, Sep 30, 2020 at 1:08 PM Julian Anastasov <ja@ssi.bg> wrote:
>
>
>         Hello,
>
> On Mon, 28 Sep 2020, longguang.yue wrote:
>
> > Outputting client,virtual,dst addresses info when tcp state changes,
> > which makes the connection debug more clear
> >
> > Signed-off-by: longguang.yue <bigclouds@163.com>
>
>         OK, v5 can be used instead of fixing v4.
>
> Acked-by: Julian Anastasov <ja@ssi.bg>
>
> > ---
>     Changelogs:
>       v5: fix indentation
>       v4: fix checkpatch
>       v3: fix checkpatch
>       v2: IP_VS_DBG_BUF outputs src,virtual,dst of ip_vs_conn
>       v1: fix the inverse of src and dst address
>
>         longguang.yue, at this place after --- you can add info
> for changes between versions, eg:
> v5: fix indentation
>
>         Use this for other patches, so that we know what is
> changed between versions.
>
> >  net/netfilter/ipvs/ip_vs_proto_tcp.c | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/net/netfilter/ipvs/ip_vs_proto_tcp.c b/net/netfilter/ipvs/ip_vs_proto_tcp.c
> > index dc2e7da2742a..7da51390cea6 100644
> > --- a/net/netfilter/ipvs/ip_vs_proto_tcp.c
> > +++ b/net/netfilter/ipvs/ip_vs_proto_tcp.c
> > @@ -539,8 +539,8 @@ set_tcp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
> >       if (new_state != cp->state) {
> >               struct ip_vs_dest *dest = cp->dest;
> >
> > -             IP_VS_DBG_BUF(8, "%s %s [%c%c%c%c] %s:%d->"
> > -                           "%s:%d state: %s->%s conn->refcnt:%d\n",
> > +             IP_VS_DBG_BUF(8, "%s %s [%c%c%c%c] c:%s:%d v:%s:%d "
> > +                           "d:%s:%d state: %s->%s conn->refcnt:%d\n",
> >                             pd->pp->name,
> >                             ((state_off == TCP_DIR_OUTPUT) ?
> >                              "output " : "input "),
> > @@ -548,10 +548,12 @@ set_tcp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
> >                             th->fin ? 'F' : '.',
> >                             th->ack ? 'A' : '.',
> >                             th->rst ? 'R' : '.',
> > -                           IP_VS_DBG_ADDR(cp->daf, &cp->daddr),
> > -                           ntohs(cp->dport),
> >                             IP_VS_DBG_ADDR(cp->af, &cp->caddr),
> >                             ntohs(cp->cport),
> > +                           IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
> > +                           ntohs(cp->vport),
> > +                           IP_VS_DBG_ADDR(cp->daf, &cp->daddr),
> > +                           ntohs(cp->dport),
> >                             tcp_state_name(cp->state),
> >                             tcp_state_name(new_state),
> >                             refcount_read(&cp->refcnt));
> > --
> > 2.20.1 (Apple Git-117)
>
> Regards
>
> --
> Julian Anastasov <ja@ssi.bg>
>
Pablo Neira Ayuso Oct. 20, 2020, 3:22 p.m. UTC | #4
On Wed, Sep 30, 2020 at 08:08:02AM +0300, Julian Anastasov wrote:
> 
> 	Hello,
> 
> On Mon, 28 Sep 2020, longguang.yue wrote:
> 
> > Outputting client,virtual,dst addresses info when tcp state changes,
> > which makes the connection debug more clear
> > 
> > Signed-off-by: longguang.yue <bigclouds@163.com>
> 
> 	OK, v5 can be used instead of fixing v4.
> 
> Acked-by: Julian Anastasov <ja@ssi.bg>

Applied, thanks.
diff mbox series

Patch

diff --git a/net/netfilter/ipvs/ip_vs_proto_tcp.c b/net/netfilter/ipvs/ip_vs_proto_tcp.c
index dc2e7da2742a..7da51390cea6 100644
--- a/net/netfilter/ipvs/ip_vs_proto_tcp.c
+++ b/net/netfilter/ipvs/ip_vs_proto_tcp.c
@@ -539,8 +539,8 @@  set_tcp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
 	if (new_state != cp->state) {
 		struct ip_vs_dest *dest = cp->dest;
 
-		IP_VS_DBG_BUF(8, "%s %s [%c%c%c%c] %s:%d->"
-			      "%s:%d state: %s->%s conn->refcnt:%d\n",
+		IP_VS_DBG_BUF(8, "%s %s [%c%c%c%c] c:%s:%d v:%s:%d "
+			      "d:%s:%d state: %s->%s conn->refcnt:%d\n",
 			      pd->pp->name,
 			      ((state_off == TCP_DIR_OUTPUT) ?
 			       "output " : "input "),
@@ -548,10 +548,12 @@  set_tcp_state(struct ip_vs_proto_data *pd, struct ip_vs_conn *cp,
 			      th->fin ? 'F' : '.',
 			      th->ack ? 'A' : '.',
 			      th->rst ? 'R' : '.',
-			      IP_VS_DBG_ADDR(cp->daf, &cp->daddr),
-			      ntohs(cp->dport),
 			      IP_VS_DBG_ADDR(cp->af, &cp->caddr),
 			      ntohs(cp->cport),
+			      IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
+			      ntohs(cp->vport),
+			      IP_VS_DBG_ADDR(cp->daf, &cp->daddr),
+			      ntohs(cp->dport),
 			      tcp_state_name(cp->state),
 			      tcp_state_name(new_state),
 			      refcount_read(&cp->refcnt));