[PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp

2007-04-17 Thread 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 <[EMAIL PROTECTED]>
---
 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

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp

2007-05-01 Thread Mitsuru Chinen
On Mon, 30 Apr 2007 00:50:14 -0700 (PDT)
David Miller <[EMAIL PROTECTED]> wrote:

> From: Mitsuru Chinen <[EMAIL PROTECTED]>
> Date: Fri, 27 Apr 2007 16:46:30 +0900
> 
> > On Tue, 17 Apr 2007 20:14:36 +0900
> > Mitsuru Chinen <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>


---

 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

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp

2007-05-03 Thread David Miller
From: Mitsuru Chinen <[EMAIL PROTECTED]>
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 <[EMAIL PROTECTED]>

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?
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp

2007-05-07 Thread Mitsuru Chinen
On Thu, 03 May 2007 03:15:46 -0700 (PDT)
David Miller <[EMAIL PROTECTED]> wrote:

> From: Mitsuru Chinen <[EMAIL PROTECTED]>
> 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 <[EMAIL PROTECTED]>
> 
> 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 <[EMAIL PROTECTED]>


---

 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

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp

2007-05-11 Thread Mitsuru Chinen
On Mon, 7 May 2007 20:29:05 +0900
Mitsuru Chinen <[EMAIL PROTECTED]> wrote:

> On Thu, 03 May 2007 03:15:46 -0700 (PDT)
> David Miller <[EMAIL PROTECTED]> wrote:
> 
> > From: Mitsuru Chinen <[EMAIL PROTECTED]>
> > 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 <[EMAIL PROTECTED]>
> > 
> > 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 <[EMAIL PROTECTED]>


---

 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


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp

2007-05-11 Thread YOSHIFUJI Hideaki / 吉藤英明
In article <[EMAIL PROTECTED]> (at Sat, 12 May 2007 01:10:04 +0900), Mitsuru 
Chinen <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>
Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>

--yoshfuji
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp

2007-05-14 Thread David Miller
From: YOSHIFUJI Hideaki / 吉藤英明 <[EMAIL PROTECTED]>
Date: Sat, 12 May 2007 01:19:49 +0900 (JST)

> In article <[EMAIL PROTECTED]> (at Sat, 12 May 2007 01:10:04 +0900), Mitsuru 
> Chinen <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>
> Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>

Patch applied, thanks everyone.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp

2007-04-27 Thread Mitsuru Chinen
On Tue, 17 Apr 2007 20:14:36 +0900
Mitsuru Chinen <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 6/6] [IPV4] SNMP: Display new statistics at /proc/net/snmp

2007-04-30 Thread David Miller
From: Mitsuru Chinen <[EMAIL PROTECTED]>
Date: Fri, 27 Apr 2007 16:46:30 +0900

> On Tue, 17 Apr 2007 20:14:36 +0900
> Mitsuru Chinen <[EMAIL PROTECTED]> 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.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html