netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] SNMP: new statistics specified in RFC4293
@ 2007-04-17 11:09 Mitsuru Chinen
  2007-04-17 11:12 ` [PATCH 1/6] SNMP: Add definitions for {In,Out}BcastPkts Mitsuru Chinen
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Mitsuru Chinen @ 2007-04-17 11:09 UTC (permalink / raw)
  To: netdev

Hi all,

Let me post a patch set to net-2.6.22 tree for new IPv4 statistics
specified in the updated RFC (RFC4293). All of them (except broadcast
statistics) are already supported in IPv6 stack. However they are not
supported in IPv4 stack yet.

The patch set consists of following 6 patches:

  [PATCH 1/6] SNMP: Add definitions for {In,Out}BcastPkts
  [PATCH 2/6] [IPV4] SNMP: Support InNoRoutes
  [PATCH 3/6] [IPV4] SNMP: Support InTruncatedPkts
  [PATCH 4/6] [IPV4] SNMP: Support InMcastPkts and InBcastPkts
  [PATCH 5/6] [IPV4] SNMP: Support OutMcastPkts and OutBcastPkts
  [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp

Best Regards,
----
Mitsuru Chinen <mitch@linux.vnet.ibm.com>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/6] SNMP: Add definitions for {In,Out}BcastPkts
  2007-04-17 11:09 [PATCH 0/6] SNMP: new statistics specified in RFC4293 Mitsuru Chinen
@ 2007-04-17 11:12 ` Mitsuru Chinen
  2007-04-30  7:48   ` David Miller
  2007-04-17 11:13 ` [PATCH 2/6] [IPV4] SNMP: Support InNoRoutes Mitsuru Chinen
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Mitsuru Chinen @ 2007-04-17 11:12 UTC (permalink / raw)
  To: netdev; +Cc: Mitsuru Chinen

The updated IP-MIB RFC (RFC4293) specifys new objects, InBcastPkts
and OutBcastPkts. This adds definitions for them.

Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
---
 include/linux/snmp.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 854aa6b..802b3a3 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -40,6 +40,8 @@ enum
 	IPSTATS_MIB_FRAGCREATES,		/* FragCreates */
 	IPSTATS_MIB_INMCASTPKTS,		/* InMcastPkts */
 	IPSTATS_MIB_OUTMCASTPKTS,		/* OutMcastPkts */
+	IPSTATS_MIB_INBCASTPKTS,		/* InBcastPkts */
+	IPSTATS_MIB_OUTBCASTPKTS,		/* OutBcastPkts */
 	__IPSTATS_MIB_MAX
 };
 
-- 
1.4.3.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/6] [IPV4] SNMP: Support InNoRoutes
  2007-04-17 11:09 [PATCH 0/6] SNMP: new statistics specified in RFC4293 Mitsuru Chinen
  2007-04-17 11:12 ` [PATCH 1/6] SNMP: Add definitions for {In,Out}BcastPkts Mitsuru Chinen
@ 2007-04-17 11:13 ` Mitsuru Chinen
  2007-04-30  7:49   ` David Miller
  2007-04-17 11:13 ` [PATCH 3/6] [IPV4] SNMP: Support InTruncatedPkts Mitsuru Chinen
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Mitsuru Chinen @ 2007-04-17 11:13 UTC (permalink / raw)
  To: netdev; +Cc: Mitsuru Chinen

An IP datagram which is being discarded because of no routes in the
forwarding path should be counted as InNoRoutes.

Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
---
 net/ipv4/ip_input.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index 324e7e0..63ab523 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -340,6 +340,8 @@ static inline int ip_rcv_finish(struct s
 		if (unlikely(err)) {
 			if (err == -EHOSTUNREACH)
 				IP_INC_STATS_BH(IPSTATS_MIB_INADDRERRORS);
+			else if (err == -ENETUNREACH)
+				IP_INC_STATS_BH(IPSTATS_MIB_INNOROUTES);
 			goto drop;
 		}
 	}
-- 
1.4.3.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 3/6] [IPV4] SNMP: Support InTruncatedPkts
  2007-04-17 11:09 [PATCH 0/6] SNMP: new statistics specified in RFC4293 Mitsuru Chinen
  2007-04-17 11:12 ` [PATCH 1/6] SNMP: Add definitions for {In,Out}BcastPkts Mitsuru Chinen
  2007-04-17 11:13 ` [PATCH 2/6] [IPV4] SNMP: Support InNoRoutes Mitsuru Chinen
@ 2007-04-17 11:13 ` Mitsuru Chinen
  2007-04-30  7:49   ` David Miller
  2007-04-17 11:13 ` [PATCH 4/6] [IPV4] SNMP: Support InMcastPkts and InBcastPkts Mitsuru Chinen
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Mitsuru Chinen @ 2007-04-17 11:13 UTC (permalink / raw)
  To: netdev; +Cc: Mitsuru Chinen

An IP datagram which is being discarded because the datagram frame
didn't carry enough data should be counted as InTruncatedPkts.

Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
---
 net/ipv4/ip_input.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index 63ab523..c8c455d 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -416,7 +416,10 @@ int ip_rcv(struct sk_buff *skb, struct n
 		goto inhdr_error;
 
 	len = ntohs(iph->tot_len);
-	if (skb->len < len || len < (iph->ihl*4))
+	if (skb->len < len) {
+		IP_INC_STATS_BH(IPSTATS_MIB_INTRUNCATEDPKTS);
+		goto drop;
+	} else if (len < (iph->ihl*4))
 		goto inhdr_error;
 
 	/* Our transport medium may have padded the buffer out. Now we know it
-- 
1.4.3.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 4/6] [IPV4] SNMP: Support InMcastPkts and InBcastPkts
  2007-04-17 11:09 [PATCH 0/6] SNMP: new statistics specified in RFC4293 Mitsuru Chinen
                   ` (2 preceding siblings ...)
  2007-04-17 11:13 ` [PATCH 3/6] [IPV4] SNMP: Support InTruncatedPkts Mitsuru Chinen
@ 2007-04-17 11:13 ` Mitsuru Chinen
  2007-04-30  7:49   ` David Miller
  2007-04-17 11:14 ` [PATCH 5/6] [IPV4] SNMP: Support OutMcastPkts and OutBcastPkts Mitsuru Chinen
  2007-04-17 11:14 ` [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp Mitsuru Chinen
  5 siblings, 1 reply; 20+ messages in thread
From: Mitsuru Chinen @ 2007-04-17 11:13 UTC (permalink / raw)
  To: netdev; +Cc: Mitsuru Chinen

A received IP multicast datagram should be counted as InMcastPkts.
By the same token, a received IP broadcast datagram should be
counted as InBcastPkts.

Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
---
 net/ipv4/ip_input.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index c8c455d..9706939 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -329,6 +329,7 @@ drop:
 static inline int ip_rcv_finish(struct sk_buff *skb)
 {
 	const struct iphdr *iph = ip_hdr(skb);
+	struct rtable *rt;
 
 	/*
 	 *	Initialise the virtual path cache for the packet. It describes
@@ -360,6 +361,12 @@ static inline int ip_rcv_finish(struct s
 	if (iph->ihl > 5 && ip_rcv_options(skb))
 		goto drop;
 
+	rt = (struct rtable*)skb->dst;
+	if (rt->rt_type == RTN_MULTICAST)
+		IP_INC_STATS_BH(IPSTATS_MIB_INMCASTPKTS);
+	else if (rt->rt_type == RTN_BROADCAST)
+		IP_INC_STATS_BH(IPSTATS_MIB_INBCASTPKTS);
+
 	return dst_input(skb);
 
 drop:
-- 
1.4.3.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 5/6] [IPV4] SNMP: Support OutMcastPkts and OutBcastPkts
  2007-04-17 11:09 [PATCH 0/6] SNMP: new statistics specified in RFC4293 Mitsuru Chinen
                   ` (3 preceding siblings ...)
  2007-04-17 11:13 ` [PATCH 4/6] [IPV4] SNMP: Support InMcastPkts and InBcastPkts Mitsuru Chinen
@ 2007-04-17 11:14 ` Mitsuru Chinen
  2007-04-30  7:49   ` David Miller
  2007-04-17 11:14 ` [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp Mitsuru Chinen
  5 siblings, 1 reply; 20+ messages in thread
From: Mitsuru Chinen @ 2007-04-17 11:14 UTC (permalink / raw)
  To: netdev; +Cc: Mitsuru Chinen

A transmitted IP multicast datagram should be counted as OutMcastPkts.
By the same token, a transmitted IP broadcast datagram should be
counted as OutBcastPkts.

Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
---
 net/ipv4/ip_output.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 704bc44..4442185 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -160,9 +160,15 @@ EXPORT_SYMBOL_GPL(ip_build_and_send_pkt)
 static inline int ip_finish_output2(struct sk_buff *skb)
 {
 	struct dst_entry *dst = skb->dst;
+	struct rtable *rt = (struct rtable *)dst;
 	struct net_device *dev = dst->dev;
 	int hh_len = LL_RESERVED_SPACE(dev);
 
+	if (rt->rt_type == RTN_MULTICAST)
+		IP_INC_STATS(IPSTATS_MIB_OUTMCASTPKTS);
+	else if (rt->rt_type == RTN_BROADCAST)
+		IP_INC_STATS(IPSTATS_MIB_OUTBCASTPKTS);
+
 	/* Be paranoid, rather than too clever. */
 	if (unlikely(skb_headroom(skb) < hh_len && dev->hard_header)) {
 		struct sk_buff *skb2;
-- 
1.4.3.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp
  2007-04-17 11:09 [PATCH 0/6] SNMP: new statistics specified in RFC4293 Mitsuru Chinen
                   ` (4 preceding siblings ...)
  2007-04-17 11:14 ` [PATCH 5/6] [IPV4] SNMP: Support OutMcastPkts and OutBcastPkts Mitsuru Chinen
@ 2007-04-17 11:14 ` Mitsuru Chinen
  2007-04-27  7:46   ` Mitsuru Chinen
  5 siblings, 1 reply; 20+ messages in thread
From: Mitsuru Chinen @ 2007-04-17 11:14 UTC (permalink / raw)
  To: netdev; +Cc: Mitsuru Chinen

This displays the statistics specified in the updated IP-MIB RFC
(RFC4293) at /proc/net/snmp. As new statistics are placed as the
last elements, this change wouldn't affect netstat, net-snmp, etc.

Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
---
 net/ipv4/proc.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index ae68a69..cc4c80a 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -119,6 +119,12 @@ static const struct snmp_mib snmp4_ipsta
 	SNMP_MIB_ITEM("FragOKs", IPSTATS_MIB_FRAGOKS),
 	SNMP_MIB_ITEM("FragFails", IPSTATS_MIB_FRAGFAILS),
 	SNMP_MIB_ITEM("FragCreates", IPSTATS_MIB_FRAGCREATES),
+	SNMP_MIB_ITEM("InNoRoutes", IPSTATS_MIB_INNOROUTES),
+	SNMP_MIB_ITEM("InTruncatedPkts", IPSTATS_MIB_INTRUNCATEDPKTS),
+	SNMP_MIB_ITEM("InMcastPkts", IPSTATS_MIB_INMCASTPKTS),
+	SNMP_MIB_ITEM("OutMcastPkts", IPSTATS_MIB_OUTMCASTPKTS),
+	SNMP_MIB_ITEM("InBcastPkts", IPSTATS_MIB_INBCASTPKTS),
+	SNMP_MIB_ITEM("OutBcastPkts", IPSTATS_MIB_OUTBCASTPKTS),
 	SNMP_MIB_SENTINEL
 };
 
-- 
1.4.3.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp
  2007-04-17 11:14 ` [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp Mitsuru Chinen
@ 2007-04-27  7:46   ` Mitsuru Chinen
  2007-04-30  7:50     ` David Miller
  0 siblings, 1 reply; 20+ messages in thread
From: Mitsuru Chinen @ 2007-04-27  7:46 UTC (permalink / raw)
  To: netdev; +Cc: Mitsuru Chinen

On Tue, 17 Apr 2007 20:14:36 +0900
Mitsuru Chinen <mitch@linux.vnet.ibm.com> wrote:

> This displays the statistics specified in the updated IP-MIB RFC
> (RFC4293) at /proc/net/snmp. As new statistics are placed as the
> last elements, this change wouldn't affect netstat, net-snmp, etc.

I'm sorry. I found adding new entries to /proc/net/snmp affects
net-snmp. I'm ashamed of my inadequate investigation.

However the other patches to support new statistics will be useful.
Could you pick up 1st to 5th patches?

Thank you,
----
Mitsuru Chinen <mitch@linux.vnet.ibm.com>


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/6] SNMP: Add definitions for {In,Out}BcastPkts
  2007-04-17 11:12 ` [PATCH 1/6] SNMP: Add definitions for {In,Out}BcastPkts Mitsuru Chinen
@ 2007-04-30  7:48   ` David Miller
  0 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2007-04-30  7:48 UTC (permalink / raw)
  To: mitch; +Cc: netdev

From: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
Date: Tue, 17 Apr 2007 20:12:47 +0900

> The updated IP-MIB RFC (RFC4293) specifys new objects, InBcastPkts
> and OutBcastPkts. This adds definitions for them.
> 
> Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>

Patch applied, thank you.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/6] [IPV4] SNMP: Support InNoRoutes
  2007-04-17 11:13 ` [PATCH 2/6] [IPV4] SNMP: Support InNoRoutes Mitsuru Chinen
@ 2007-04-30  7:49   ` David Miller
  0 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2007-04-30  7:49 UTC (permalink / raw)
  To: mitch; +Cc: netdev

From: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
Date: Tue, 17 Apr 2007 20:13:15 +0900

> An IP datagram which is being discarded because of no routes in the
> forwarding path should be counted as InNoRoutes.
> 
> Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>

Patch applied, thanks.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 3/6] [IPV4] SNMP: Support InTruncatedPkts
  2007-04-17 11:13 ` [PATCH 3/6] [IPV4] SNMP: Support InTruncatedPkts Mitsuru Chinen
@ 2007-04-30  7:49   ` David Miller
  0 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2007-04-30  7:49 UTC (permalink / raw)
  To: mitch; +Cc: netdev

From: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
Date: Tue, 17 Apr 2007 20:13:37 +0900

> An IP datagram which is being discarded because the datagram frame
> didn't carry enough data should be counted as InTruncatedPkts.
> 
> Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 4/6] [IPV4] SNMP: Support InMcastPkts and InBcastPkts
  2007-04-17 11:13 ` [PATCH 4/6] [IPV4] SNMP: Support InMcastPkts and InBcastPkts Mitsuru Chinen
@ 2007-04-30  7:49   ` David Miller
  0 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2007-04-30  7:49 UTC (permalink / raw)
  To: mitch; +Cc: netdev

From: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
Date: Tue, 17 Apr 2007 20:13:56 +0900

> A received IP multicast datagram should be counted as InMcastPkts.
> By the same token, a received IP broadcast datagram should be
> counted as InBcastPkts.
> 
> Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>

Patch applied.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 5/6] [IPV4] SNMP: Support OutMcastPkts and OutBcastPkts
  2007-04-17 11:14 ` [PATCH 5/6] [IPV4] SNMP: Support OutMcastPkts and OutBcastPkts Mitsuru Chinen
@ 2007-04-30  7:49   ` David Miller
  0 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2007-04-30  7:49 UTC (permalink / raw)
  To: mitch; +Cc: netdev

From: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
Date: Tue, 17 Apr 2007 20:14:18 +0900

> A transmitted IP multicast datagram should be counted as OutMcastPkts.
> By the same token, a transmitted IP broadcast datagram should be
> counted as OutBcastPkts.
> 
> Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>

Patch applied, thanks.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp
  2007-04-27  7:46   ` Mitsuru Chinen
@ 2007-04-30  7:50     ` David Miller
  2007-05-02  1:05       ` Mitsuru Chinen
  0 siblings, 1 reply; 20+ messages in thread
From: David Miller @ 2007-04-30  7:50 UTC (permalink / raw)
  To: mitch; +Cc: netdev

From: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
Date: Fri, 27 Apr 2007 16:46:30 +0900

> On Tue, 17 Apr 2007 20:14:36 +0900
> Mitsuru Chinen <mitch@linux.vnet.ibm.com> wrote:
> 
> > This displays the statistics specified in the updated IP-MIB RFC
> > (RFC4293) at /proc/net/snmp. As new statistics are placed as the
> > last elements, this change wouldn't affect netstat, net-snmp, etc.
> 
> I'm sorry. I found adding new entries to /proc/net/snmp affects
> net-snmp. I'm ashamed of my inadequate investigation.
> 
> However the other patches to support new statistics will be useful.
> Could you pick up 1st to 5th patches?

You could display them on a new line of /proc/net/netstat, which
we currently use to display extensions to the TCP snmp variables.

It is just one idea.

Anyways, I applied patches 1-5.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp
  2007-04-30  7:50     ` David Miller
@ 2007-05-02  1:05       ` Mitsuru Chinen
  2007-05-03 10:15         ` David Miller
  0 siblings, 1 reply; 20+ messages in thread
From: Mitsuru Chinen @ 2007-05-02  1:05 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

On Mon, 30 Apr 2007 00:50:14 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:

> From: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
> Date: Fri, 27 Apr 2007 16:46:30 +0900
> 
> > On Tue, 17 Apr 2007 20:14:36 +0900
> > Mitsuru Chinen <mitch@linux.vnet.ibm.com> wrote:
> > 
> > > This displays the statistics specified in the updated IP-MIB RFC
> > > (RFC4293) at /proc/net/snmp. As new statistics are placed as the
> > > last elements, this change wouldn't affect netstat, net-snmp, etc.
> > 
> > I'm sorry. I found adding new entries to /proc/net/snmp affects
> > net-snmp. I'm ashamed of my inadequate investigation.
> > 
> > However the other patches to support new statistics will be useful.
> > Could you pick up 1st to 5th patches?
> 
> You could display them on a new line of /proc/net/netstat, which
> we currently use to display extensions to the TCP snmp variables.
> 
> It is just one idea.

Thanks for your proposal! I created a patch based on your idea.
How about this?


[IPV4] SNMP: Display new statistics at /proc/net/netstat

This displays the statistics specified in the updated IP-MIB RFC
(RFC4293) in /proc/net/netstat. The reason why these are not added
to /proc/net/snmp is that some existing utilities are developed under
the assumption that ipstat items in /proc/net/snmp is unchanged.

Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>


---

 net/ipv4/proc.c |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

7d86d2fc56dee38e18b4c8b3d2dc15d7d27f8a09
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 37ab580..38f24f9 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -88,6 +88,7 @@ static const struct file_operations sock
 };
 
 /* snmp items */
+#define IPSTATS_RFC4293_START 17
 static const struct snmp_mib snmp4_ipstats_list[] = {
 	SNMP_MIB_ITEM("InReceives", IPSTATS_MIB_INRECEIVES),
 	SNMP_MIB_ITEM("InHdrErrors", IPSTATS_MIB_INHDRERRORS),
@@ -106,6 +107,13 @@ static const struct snmp_mib snmp4_ipsta
 	SNMP_MIB_ITEM("FragOKs", IPSTATS_MIB_FRAGOKS),
 	SNMP_MIB_ITEM("FragFails", IPSTATS_MIB_FRAGFAILS),
 	SNMP_MIB_ITEM("FragCreates", IPSTATS_MIB_FRAGCREATES),
+	/* Following RFC4293 items are displayed in /proc/net/netstat */
+	SNMP_MIB_ITEM("InNoRoutes", IPSTATS_MIB_INNOROUTES),
+	SNMP_MIB_ITEM("InTruncatedPkts", IPSTATS_MIB_INTRUNCATEDPKTS),
+	SNMP_MIB_ITEM("InMcastPkts", IPSTATS_MIB_INMCASTPKTS),
+	SNMP_MIB_ITEM("OutMcastPkts", IPSTATS_MIB_OUTMCASTPKTS),
+	SNMP_MIB_ITEM("InBcastPkts", IPSTATS_MIB_INBCASTPKTS),
+	SNMP_MIB_ITEM("OutBcastPkts", IPSTATS_MIB_OUTBCASTPKTS),
 	SNMP_MIB_SENTINEL
 };
 
@@ -245,13 +253,13 @@ static int snmp_seq_show(struct seq_file
 
 	seq_puts(seq, "Ip: Forwarding DefaultTTL");
 
-	for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
+	for (i = 0; i < IPSTATS_RFC4293_START; i++)
 		seq_printf(seq, " %s", snmp4_ipstats_list[i].name);
 
 	seq_printf(seq, "\nIp: %d %d",
 			ipv4_devconf.forwarding ? 1 : 2, sysctl_ip_default_ttl);
 
-	for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
+	for (i = 0; i < IPSTATS_RFC4293_START; i++)
 		seq_printf(seq, " %lu",
 			   snmp_fold_field((void **)ip_statistics,
 					   snmp4_ipstats_list[i].entry));
@@ -338,6 +346,16 @@ static int netstat_seq_show(struct seq_f
 			   snmp_fold_field((void **)net_statistics,
 					   snmp4_net_list[i].entry));
 
+	seq_puts(seq, "\nIpExt:");
+	for (i = IPSTATS_RFC4293_START; snmp4_ipstats_list[i].name != NULL; i++)
+		seq_printf(seq, " %s", snmp4_ipstats_list[i].name);
+
+	seq_puts(seq, "\nIpExt:");
+	for (i = IPSTATS_RFC4293_START; snmp4_ipstats_list[i].name != NULL; i++)
+		seq_printf(seq, " %lu",
+			   snmp_fold_field((void **)ip_statistics,
+					   snmp4_ipstats_list[i].entry));
+
 	seq_putc(seq, '\n');
 	return 0;
 }
-- 
1.3.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp
  2007-05-02  1:05       ` Mitsuru Chinen
@ 2007-05-03 10:15         ` David Miller
  2007-05-07 11:29           ` Mitsuru Chinen
  0 siblings, 1 reply; 20+ messages in thread
From: David Miller @ 2007-05-03 10:15 UTC (permalink / raw)
  To: mitch; +Cc: netdev

From: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
Date: Wed, 2 May 2007 10:05:13 +0900

> [IPV4] SNMP: Display new statistics at /proc/net/netstat
> 
> This displays the statistics specified in the updated IP-MIB RFC
> (RFC4293) in /proc/net/netstat. The reason why these are not added
> to /proc/net/snmp is that some existing utilities are developed under
> the assumption that ipstat items in /proc/net/snmp is unchanged.
> 
> Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>

Magic constant "17" is not the best, somebody will break this
next time this table it touched.

Why not use another sentinel, or something like that, to mark
the entry groups?

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp
  2007-05-03 10:15         ` David Miller
@ 2007-05-07 11:29           ` Mitsuru Chinen
  2007-05-11 16:10             ` Mitsuru Chinen
  0 siblings, 1 reply; 20+ messages in thread
From: Mitsuru Chinen @ 2007-05-07 11:29 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

On Thu, 03 May 2007 03:15:46 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:

> From: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
> Date: Wed, 2 May 2007 10:05:13 +0900
> 
> > [IPV4] SNMP: Display new statistics at /proc/net/netstat
> > 
> > This displays the statistics specified in the updated IP-MIB RFC
> > (RFC4293) in /proc/net/netstat. The reason why these are not added
> > to /proc/net/snmp is that some existing utilities are developed under
> > the assumption that ipstat items in /proc/net/snmp is unchanged.
> > 
> > Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
> 
> Magic constant "17" is not the best, somebody will break this
> next time this table it touched.
> 
> Why not use another sentinel, or something like that, to mark
> the entry groups?

Excuse me, but I can't catch why this magic constant is not good.
When we don't increase the number of entries in /proc/net/snmp,
I think the start number of new entries which is displayed in
/proc/net/netstat would be fixed value.

I came up with an idea in order to reduce the patch size.
But it still has a magic constant which points to the start of
new entries. If such a magic constant is not acceptable, I will
create another patch based on this. It will skip the exiting
entry by for() loop:

| @@ -348,11 +348,13 @@ static int netstat_seq_show(struct seq_f
|                                            snmp4_net_list[i].entry));
|  
|         seq_puts(seq, "\nIpExt:");
| -       for (i = IPSTATS_RFC4293_START; snmp4_ipstats_list[i].name != NULL; i++)
| +       for (i = 0; snmp4_ipstats_list[i].name != NULL; i++);
| +       for (i++; snmp4_ipstats_list[i].name != NULL; i++)
|                 seq_printf(seq, " %s", snmp4_ipstats_list[i].name);


I think it will cost a bit. Is it acceptable?



[IPV4] SNMP: Display new statistics at /proc/net/netstat

This displays the statistics specified in the updated IP-MIB RFC
(RFC4293) in /proc/net/netstat. The reason why these are not displayed
in /proc/net/snmp is some existing utilities are developed under the
assumption that ipstat items in /proc/net/snmp is unchanged.

Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>


---

 net/ipv4/proc.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

bbc05691d2dbd8bce7d6b5ae1c0ba0074ecef5e4
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 37ab580..11dfa96 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -88,6 +88,7 @@ static const struct file_operations sock
 };
 
 /* snmp items */
+#define IPSTATS_RFC4293_START 18
 static const struct snmp_mib snmp4_ipstats_list[] = {
 	SNMP_MIB_ITEM("InReceives", IPSTATS_MIB_INRECEIVES),
 	SNMP_MIB_ITEM("InHdrErrors", IPSTATS_MIB_INHDRERRORS),
@@ -106,6 +107,14 @@ static const struct snmp_mib snmp4_ipsta
 	SNMP_MIB_ITEM("FragOKs", IPSTATS_MIB_FRAGOKS),
 	SNMP_MIB_ITEM("FragFails", IPSTATS_MIB_FRAGFAILS),
 	SNMP_MIB_ITEM("FragCreates", IPSTATS_MIB_FRAGCREATES),
+	SNMP_MIB_SENTINEL,
+	/* Following RFC4293 items are displayed in /proc/net/netstat */
+	SNMP_MIB_ITEM("InNoRoutes", IPSTATS_MIB_INNOROUTES),
+	SNMP_MIB_ITEM("InTruncatedPkts", IPSTATS_MIB_INTRUNCATEDPKTS),
+	SNMP_MIB_ITEM("InMcastPkts", IPSTATS_MIB_INMCASTPKTS),
+	SNMP_MIB_ITEM("OutMcastPkts", IPSTATS_MIB_OUTMCASTPKTS),
+	SNMP_MIB_ITEM("InBcastPkts", IPSTATS_MIB_INBCASTPKTS),
+	SNMP_MIB_ITEM("OutBcastPkts", IPSTATS_MIB_OUTBCASTPKTS),
 	SNMP_MIB_SENTINEL
 };
 
@@ -338,6 +347,16 @@ static int netstat_seq_show(struct seq_f
 			   snmp_fold_field((void **)net_statistics,
 					   snmp4_net_list[i].entry));
 
+	seq_puts(seq, "\nIpExt:");
+	for (i = IPSTATS_RFC4293_START; snmp4_ipstats_list[i].name != NULL; i++)
+		seq_printf(seq, " %s", snmp4_ipstats_list[i].name);
+
+	seq_puts(seq, "\nIpExt:");
+	for (i = IPSTATS_RFC4293_START; snmp4_ipstats_list[i].name != NULL; i++)
+		seq_printf(seq, " %lu",
+			   snmp_fold_field((void **)ip_statistics,
+					   snmp4_ipstats_list[i].entry));
+
 	seq_putc(seq, '\n');
 	return 0;
 }
-- 
1.3.3


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp
  2007-05-07 11:29           ` Mitsuru Chinen
@ 2007-05-11 16:10             ` Mitsuru Chinen
  2007-05-11 16:19               ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 1 reply; 20+ messages in thread
From: Mitsuru Chinen @ 2007-05-11 16:10 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

On Mon, 7 May 2007 20:29:05 +0900
Mitsuru Chinen <mitch@linux.vnet.ibm.com> wrote:

> On Thu, 03 May 2007 03:15:46 -0700 (PDT)
> David Miller <davem@davemloft.net> wrote:
> 
> > From: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
> > Date: Wed, 2 May 2007 10:05:13 +0900
> > 
> > > [IPV4] SNMP: Display new statistics at /proc/net/netstat
> > > 
> > > This displays the statistics specified in the updated IP-MIB RFC
> > > (RFC4293) in /proc/net/netstat. The reason why these are not added
> > > to /proc/net/snmp is that some existing utilities are developed under
> > > the assumption that ipstat items in /proc/net/snmp is unchanged.
> > > 
> > > Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
> > 
> > Magic constant "17" is not the best, somebody will break this
> > next time this table it touched.
> > 
> > Why not use another sentinel, or something like that, to mark
> > the entry groups?
> 
> Excuse me, but I can't catch why this magic constant is not good.
> When we don't increase the number of entries in /proc/net/snmp,
> I think the start number of new entries which is displayed in
> /proc/net/netstat would be fixed value.

Thanks to Yoshifuji-san and USAGI guys, I'm able to remove
magic constant totally. How about this?


[IPV4] SNMP: Display new statistics at /proc/net/netstat

This displays the statistics specified in the updated IP-MIB RFC
(RFC4293) in /proc/net/netstat. The reason why these are not displayed
in /proc/net/snmp is that some existing utilities are developed under
the assumption which ipstat items in /proc/net/snmp is unchanged.

Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>


---

 net/ipv4/proc.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

fc11ca885424125a2add36ab6ff29aa8e4302d4b
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 37ab580..cdbc6c1 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -109,6 +109,17 @@ static const struct snmp_mib snmp4_ipsta
 	SNMP_MIB_SENTINEL
 };
 
+/* Following RFC4293 items are displayed in /proc/net/netstat */
+static const struct snmp_mib snmp4_ipextstats_list[] = {
+	SNMP_MIB_ITEM("InNoRoutes", IPSTATS_MIB_INNOROUTES),
+	SNMP_MIB_ITEM("InTruncatedPkts", IPSTATS_MIB_INTRUNCATEDPKTS),
+	SNMP_MIB_ITEM("InMcastPkts", IPSTATS_MIB_INMCASTPKTS),
+	SNMP_MIB_ITEM("OutMcastPkts", IPSTATS_MIB_OUTMCASTPKTS),
+	SNMP_MIB_ITEM("InBcastPkts", IPSTATS_MIB_INBCASTPKTS),
+	SNMP_MIB_ITEM("OutBcastPkts", IPSTATS_MIB_OUTBCASTPKTS),
+	SNMP_MIB_SENTINEL
+};
+
 static const struct snmp_mib snmp4_icmp_list[] = {
 	SNMP_MIB_ITEM("InMsgs", ICMP_MIB_INMSGS),
 	SNMP_MIB_ITEM("InErrors", ICMP_MIB_INERRORS),
@@ -338,6 +349,16 @@ static int netstat_seq_show(struct seq_f
 			   snmp_fold_field((void **)net_statistics,
 					   snmp4_net_list[i].entry));
 
+	seq_puts(seq, "\nIpExt:");
+	for (i = 0; snmp4_ipextstats_list[i].name != NULL; i++)
+		seq_printf(seq, " %s", snmp4_ipextstats_list[i].name);
+
+	seq_puts(seq, "\nIpExt:");
+	for (i = 0; snmp4_ipextstats_list[i].name != NULL; i++)
+		seq_printf(seq, " %lu",
+			   snmp_fold_field((void **)ip_statistics,
+					   snmp4_ipextstats_list[i].entry));
+
 	seq_putc(seq, '\n');
 	return 0;
 }
-- 
1.3.3



^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp
  2007-05-11 16:10             ` Mitsuru Chinen
@ 2007-05-11 16:19               ` YOSHIFUJI Hideaki / 吉藤英明
  2007-05-14 10:07                 ` David Miller
  0 siblings, 1 reply; 20+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2007-05-11 16:19 UTC (permalink / raw)
  To: mitch, davem; +Cc: netdev, yoshfuji

In article <20070512011004.e2e3fc7b.mitch@linux.vnet.ibm.com> (at Sat, 12 May 2007 01:10:04 +0900), Mitsuru Chinen <mitch@linux.vnet.ibm.com> says:

> [IPV4] SNMP: Display new statistics at /proc/net/netstat
> 
> This displays the statistics specified in the updated IP-MIB RFC
> (RFC4293) in /proc/net/netstat. The reason why these are not displayed
> in /proc/net/snmp is that some existing utilities are developed under
> the assumption which ipstat items in /proc/net/snmp is unchanged.
> 
> Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

--yoshfuji

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp
  2007-05-11 16:19               ` YOSHIFUJI Hideaki / 吉藤英明
@ 2007-05-14 10:07                 ` David Miller
  0 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2007-05-14 10:07 UTC (permalink / raw)
  To: yoshfuji; +Cc: mitch, netdev

From: YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>
Date: Sat, 12 May 2007 01:19:49 +0900 (JST)

> In article <20070512011004.e2e3fc7b.mitch@linux.vnet.ibm.com> (at Sat, 12 May 2007 01:10:04 +0900), Mitsuru Chinen <mitch@linux.vnet.ibm.com> says:
> 
> > [IPV4] SNMP: Display new statistics at /proc/net/netstat
> > 
> > This displays the statistics specified in the updated IP-MIB RFC
> > (RFC4293) in /proc/net/netstat. The reason why these are not displayed
> > in /proc/net/snmp is that some existing utilities are developed under
> > the assumption which ipstat items in /proc/net/snmp is unchanged.
> > 
> > Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

Patch applied, thanks everyone.

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2007-05-14 10:07 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-17 11:09 [PATCH 0/6] SNMP: new statistics specified in RFC4293 Mitsuru Chinen
2007-04-17 11:12 ` [PATCH 1/6] SNMP: Add definitions for {In,Out}BcastPkts Mitsuru Chinen
2007-04-30  7:48   ` David Miller
2007-04-17 11:13 ` [PATCH 2/6] [IPV4] SNMP: Support InNoRoutes Mitsuru Chinen
2007-04-30  7:49   ` David Miller
2007-04-17 11:13 ` [PATCH 3/6] [IPV4] SNMP: Support InTruncatedPkts Mitsuru Chinen
2007-04-30  7:49   ` David Miller
2007-04-17 11:13 ` [PATCH 4/6] [IPV4] SNMP: Support InMcastPkts and InBcastPkts Mitsuru Chinen
2007-04-30  7:49   ` David Miller
2007-04-17 11:14 ` [PATCH 5/6] [IPV4] SNMP: Support OutMcastPkts and OutBcastPkts Mitsuru Chinen
2007-04-30  7:49   ` David Miller
2007-04-17 11:14 ` [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp Mitsuru Chinen
2007-04-27  7:46   ` Mitsuru Chinen
2007-04-30  7:50     ` David Miller
2007-05-02  1:05       ` Mitsuru Chinen
2007-05-03 10:15         ` David Miller
2007-05-07 11:29           ` Mitsuru Chinen
2007-05-11 16:10             ` Mitsuru Chinen
2007-05-11 16:19               ` YOSHIFUJI Hideaki / 吉藤英明
2007-05-14 10:07                 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).