Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: Julian Anastasov <ja@ssi.bg>
Cc: lvs-devel@vger.kernel.org, netdev@vger.kernel.org,
	netfilter@vger.kernel.org, netfilter-devel@vger.kernel.org,
	Jan Engelhardt <jengelh@medozas.de>,
	Stephen Hemminger <shemminger@vyatta.com>,
	Wensong Zhang <wensong@linux-vs.org>,
	Patrick McHardy <kaber@trash.net>
Subject: Re: [patch v2 08/12] [PATCH 08/12] IPVS: Add persistence engine data to /proc/net/ip_vs_conn
Date: Sat, 2 Oct 2010 10:58:57 +0900	[thread overview]
Message-ID: <20101002015857.GF2235@verge.net.au> (raw)
In-Reply-To: <alpine.LFD.2.00.1010020048030.2462@ja.ssi.bg>

On Sat, Oct 02, 2010 at 12:50:09AM +0300, Julian Anastasov wrote:
> 
> 	Hello,
> 
> On Fri, 1 Oct 2010, Simon Horman wrote:
> 
> >Index: lvs-test-2.6/net/netfilter/ipvs/ip_vs_conn.c
> >===================================================================
> >--- lvs-test-2.6.orig/net/netfilter/ipvs/ip_vs_conn.c	2010-10-01 22:27:17.000000000 +0900
> >+++ lvs-test-2.6/net/netfilter/ipvs/ip_vs_conn.c	2010-10-01 22:27:32.000000000 +0900
> >@@ -938,30 +938,44 @@ static int ip_vs_conn_seq_show(struct se
> >
> >	if (v == SEQ_START_TOKEN)
> >		seq_puts(seq,
> >-   "Pro FromIP   FPrt ToIP     TPrt DestIP   DPrt State       Expires\n");
> >+   "Pro FromIP   FPrt ToIP     TPrt DestIP   DPrt State       Expires PEName PEData\n");
> >	else {
> >		const struct ip_vs_conn *cp = v;
> >+		char pe_data[IP_VS_PENAME_MAXLEN + IP_VS_PEDATA_MAXLEN + 3];
> >+		size_t len = 0;
> >+
> 
> 	Add check for cp->dest, it is optional:

Done.

> >+		if (cp->dest->svc->pe && cp->dest->svc->pe->show_pe_data) {
> >+			pe_data[0] = ' ';
> >+			len = strlen(cp->dest->svc->pe->name);
> >+			memcpy(pe_data + 1, cp->dest->svc->pe->name, len);
> >+			pe_data[len + 1] = ' ';
> >+			len += 2;
> >+			len += cp->dest->svc->pe->show_pe_data(cp,
> >+							       pe_data + len);
> >+		}
> >+		pe_data[len] = '\0';
> 

I will repost the entire series a little later.
For reference here is the updated patch.

From bee0c73040b632723ff7a058f61a79063b18e882 Mon Sep 17 00:00:00 2001
From: Simon Horman <horms@verge.net.au>
Date: Sun, 22 Aug 2010 21:37:53 +0900
Subject: [patch v2.1 08/12] IPVS: Add persistence engine data to /proc/net/ip_vs_conn

This shouldn't break compatibility with userspace as the new data
is at the end of the line.

I have confirmed that this doesn't break ipvsadm, the main (only?)
user-space user of this data.

Signed-off-by: Simon Horman <horms@verge.net.au>

---

* Jan Engelhardt suggested using netlink to do this, but it seems like
  overkill to me. I'm willing to be convinced otherwise.

v2
* Trivial rediff

v2.1
* As suggested by Julian Anastasov
  - ip_vs_conn_seq_show(): cp->dest is optional
    so test for its presence accordingly
  - Re-diff for addition of inverse parameter to ip_vs_conn_hashkey_param()

Index: lvs-test-2.6/include/net/ip_vs.h
===================================================================
--- lvs-test-2.6.orig/include/net/ip_vs.h	2010-10-02 10:55:43.000000000 +0900
+++ lvs-test-2.6/include/net/ip_vs.h	2010-10-02 10:55:49.000000000 +0900
@@ -572,6 +572,7 @@ struct ip_vs_pe {
 			 struct ip_vs_conn *ct);
 	u32 (*hashkey_raw)(const struct ip_vs_conn_param *p, u32 initval,
 			   bool inverse);
+	int (*show_pe_data)(const struct ip_vs_conn *cp, char *buf);
 };
 
 /*
Index: lvs-test-2.6/net/netfilter/ipvs/ip_vs_conn.c
===================================================================
--- lvs-test-2.6.orig/net/netfilter/ipvs/ip_vs_conn.c	2010-10-02 10:55:43.000000000 +0900
+++ lvs-test-2.6/net/netfilter/ipvs/ip_vs_conn.c	2010-10-02 10:57:00.000000000 +0900
@@ -950,30 +950,45 @@ static int ip_vs_conn_seq_show(struct se
 
 	if (v == SEQ_START_TOKEN)
 		seq_puts(seq,
-   "Pro FromIP   FPrt ToIP     TPrt DestIP   DPrt State       Expires\n");
+   "Pro FromIP   FPrt ToIP     TPrt DestIP   DPrt State       Expires PEName PEData\n");
 	else {
 		const struct ip_vs_conn *cp = v;
+		char pe_data[IP_VS_PENAME_MAXLEN + IP_VS_PEDATA_MAXLEN + 3];
+		size_t len = 0;
+
+		if (cp->dest && cp->dest->svc->pe &&
+		    cp->dest->svc->pe->show_pe_data) {
+			pe_data[0] = ' ';
+			len = strlen(cp->dest->svc->pe->name);
+			memcpy(pe_data + 1, cp->dest->svc->pe->name, len);
+			pe_data[len + 1] = ' ';
+			len += 2;
+			len += cp->dest->svc->pe->show_pe_data(cp,
+							       pe_data + len);
+		}
+		pe_data[len] = '\0';
 
 #ifdef CONFIG_IP_VS_IPV6
 		if (cp->af == AF_INET6)
-			seq_printf(seq, "%-3s %pI6 %04X %pI6 %04X %pI6 %04X %-11s %7lu\n",
+			seq_printf(seq, "%-3s %pI6 %04X %pI6 %04X "
+				"%pI6 %04X %-11s %7lu%s\n",
 				ip_vs_proto_name(cp->protocol),
 				&cp->caddr.in6, ntohs(cp->cport),
 				&cp->vaddr.in6, ntohs(cp->vport),
 				&cp->daddr.in6, ntohs(cp->dport),
 				ip_vs_state_name(cp->protocol, cp->state),
-				(cp->timer.expires-jiffies)/HZ);
+				(cp->timer.expires-jiffies)/HZ, pe_data);
 		else
 #endif
 			seq_printf(seq,
 				"%-3s %08X %04X %08X %04X"
-				" %08X %04X %-11s %7lu\n",
+				" %08X %04X %-11s %7lu%s\n",
 				ip_vs_proto_name(cp->protocol),
 				ntohl(cp->caddr.ip), ntohs(cp->cport),
 				ntohl(cp->vaddr.ip), ntohs(cp->vport),
 				ntohl(cp->daddr.ip), ntohs(cp->dport),
 				ip_vs_state_name(cp->protocol, cp->state),
-				(cp->timer.expires-jiffies)/HZ);
+				(cp->timer.expires-jiffies)/HZ, pe_data);
 	}
 	return 0;
 }

  reply	other threads:[~2010-10-02  1:58 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-01 14:35 [patch v2 00/12] IPVS: SIP Persistence Engine Simon Horman
2010-10-01 14:35 ` [patch v2 01/12] [PATCH 01/12] netfilter: nf_conntrack_sip: Allow ct_sip_get_header() to be called with a null ct argument Simon Horman
2010-10-01 14:35 ` [patch v2 02/12] [PATCH 02/12] netfilter: nf_conntrack_sip: Add callid parser Simon Horman
2010-10-01 14:35 ` [patch v2 03/12] [PATCH 03/12] IPVS: compact ip_vs_sched_persist() Simon Horman
2010-10-01 22:35   ` Julian Anastasov
2010-10-02  2:20     ` Simon Horman
2010-10-02  7:56       ` Julian Anastasov
2010-10-02  8:08         ` Simon Horman
2010-10-04 22:36           ` Julian Anastasov
2010-10-01 14:35 ` [patch v2 04/12] [PATCH 04/12] IPVS: Add struct ip_vs_conn_param Simon Horman
2010-10-01 20:58   ` Julian Anastasov
2010-10-02  1:13     ` Simon Horman
2010-10-02  1:15       ` Simon Horman
2010-10-01 14:35 ` [patch v2 05/12] [PATCH 05/12] IPVS: Allow null argument to ip_vs_scheduler_put() Simon Horman
2010-10-01 14:35 ` [patch v2 06/12] [PATCH 06/12] IPVS: ip_vs_{un,}bind_scheduler NULL arguments Simon Horman
2010-10-01 14:35 ` [patch v2 07/12] [PATCH 07/12] IPVS: Add struct ip_vs_pe Simon Horman
2010-10-01 21:45   ` Julian Anastasov
2010-10-02  1:55     ` Simon Horman
2010-10-01 14:35 ` [patch v2 08/12] [PATCH 08/12] IPVS: Add persistence engine data to /proc/net/ip_vs_conn Simon Horman
2010-10-01 21:50   ` Julian Anastasov
2010-10-02  1:58     ` Simon Horman [this message]
2010-10-01 14:35 ` [patch v2 09/12] [PATCH 09/12] IPVS: management of persistence engine modules Simon Horman
2010-10-01 14:35 ` [patch v2 10/12] [PATCH 10/12] IPVS: Allow configuration of persistence engines Simon Horman
2010-10-01 14:35 ` [patch v2 11/12] [PATCH 11/12] IPVS: Fallback if persistence engine fails Simon Horman
2010-10-01 14:35 ` [patch v2 12/12] [PATCH 12/12] IPVS: sip persistence engine Simon Horman
2010-10-01 15:09 ` [patch v2 00/12] IPVS: SIP Persistence Engine Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101002015857.GF2235@verge.net.au \
    --to=horms@verge.net.au \
    --cc=ja@ssi.bg \
    --cc=jengelh@medozas.de \
    --cc=kaber@trash.net \
    --cc=lvs-devel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=netfilter@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    --cc=wensong@linux-vs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox