Skip to contentSkip to conversation

SNMP: new statistics specified in RFC4293

PATCH Applied Mitsuru Chinen 3 participants 20 messages Apr 17, 2007 – May 14, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover SNMP: new statistics specified in RFC4293

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 <[email protected]>

#1 lore raw

PATCH 1/6 SNMP: Add definitions for {In,Out}BcastPkts

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

---
 include/linux/snmp.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
include/linux/snmp.h +2 -0
index 854aa6b..802b3a3 100644
@@ -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
 };
 
Signature · 1 line
1.4.3.4
maintainer
#2 lore raw

Re: [PATCH 1/6] SNMP: Add definitions for {In,Out}BcastPkts

From: Mitsuru Chinen <[email protected]>
Date: Tue, 17 Apr 2007 20:12:47 +0900

Quoted 4 lines

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

Patch applied, thank you.

#3 lore raw

PATCH 2/6 SNMP: Support InNoRoutes

In reply to Mitsuru Chinen

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

---
 net/ipv4/ip_input.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
net/ipv4/ip_input.c +2 -0
index 324e7e0..63ab523 100644
@@ -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;
 		}
 	}
Signature · 1 line
1.4.3.4
maintainer
#4 lore raw

Re: [PATCH 2/6] [IPV4] SNMP: Support InNoRoutes

From: Mitsuru Chinen <[email protected]>
Date: Tue, 17 Apr 2007 20:13:15 +0900

Quoted 4 lines

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

Patch applied, thanks.

#5 lore raw

PATCH 3/6 SNMP: Support InTruncatedPkts

In reply to Mitsuru Chinen

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

---
 net/ipv4/ip_input.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
net/ipv4/ip_input.c +4 -1
index 63ab523..c8c455d 100644
@@ -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
Signature · 1 line
1.4.3.4
maintainer Applied
#6 lore raw

Re: [PATCH 3/6] [IPV4] SNMP: Support InTruncatedPkts

From: Mitsuru Chinen <[email protected]>
Date: Tue, 17 Apr 2007 20:13:37 +0900

Quoted 4 lines

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

Applied, thanks.

#7 lore raw

PATCH 4/6 SNMP: Support InMcastPkts and InBcastPkts

In reply to 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.

---
 net/ipv4/ip_input.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
net/ipv4/ip_input.c +7 -0
index c8c455d..9706939 100644
@@ -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:
Signature · 1 line
1.4.3.4
maintainer
#8 lore raw

Re: [PATCH 4/6] [IPV4] SNMP: Support InMcastPkts and InBcastPkts

From: Mitsuru Chinen <[email protected]>
Date: Tue, 17 Apr 2007 20:13:56 +0900

Quoted 5 lines

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

Patch applied.

#9 lore raw

PATCH 5/6 SNMP: Support OutMcastPkts and OutBcastPkts

In reply to 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.

---
 net/ipv4/ip_output.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
net/ipv4/ip_output.c +6 -0
index 704bc44..4442185 100644
@@ -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;
Signature · 1 line
1.4.3.4
maintainer
#10 lore raw

Re: [PATCH 5/6] [IPV4] SNMP: Support OutMcastPkts and OutBcastPkts

From: Mitsuru Chinen <[email protected]>
Date: Tue, 17 Apr 2007 20:14:18 +0900

Quoted 5 lines

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

Patch applied, thanks.

#11 lore raw

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

In reply to 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.

---
 net/ipv4/proc.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
net/ipv4/proc.c +6 -0
index ae68a69..cc4c80a 100644
@@ -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
 };
 
Signature · 1 line
1.4.3.4
#12 lore raw

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

Quoted 3 lines · On Tue, 17 Apr 2007 20:14:36 +0900 Mitsuru Chinen <[email protected]>…

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]>

maintainer
#13 lore raw

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

From: Mitsuru Chinen <[email protected]>
Date: Fri, 27 Apr 2007 16:46:30 +0900

Quoted 7 lines
Quoted 3 lines · On Tue, 17 Apr 2007 20:14:36 +0900 Mitsuru Chinen <[email protected]>…

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.

Quoted 5 lines

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.

#14 lore raw

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

Quoted 13 lines · On Mon, 30 Apr 2007 00:50:14 -0700 (PDT) David Miller <[email protected]>…

From: Mitsuru Chinen <[email protected]>
Date: Fri, 27 Apr 2007 16:46:30 +0900

Quoted 10 lines
Quoted 3 lines · On Tue, 17 Apr 2007 20:14:36 +0900 Mitsuru Chinen <[email protected]>…

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.

Quoted 7 lines
Quoted 2 lines

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.

---

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

7d86d2fc56dee38e18b4c8b3d2dc15d7d27f8a09

net/ipv4/proc.c +20 -2
index 37ab580..38f24f9 100644
@@ -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;
 }
Signature · 1 line
1.3.3
maintainer
#15 lore raw

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

From: Mitsuru Chinen <[email protected]>
Date: Wed, 2 May 2007 10:05:13 +0900

Quoted 8 lines

[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.

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?

#16 lore raw

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

Quoted 10 lines · On Thu, 03 May 2007 03:15:46 -0700 (PDT) David Miller <[email protected]>…

From: Mitsuru Chinen <[email protected]>
Date: Wed, 2 May 2007 10:05:13 +0900

Quoted 7 lines

[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.

Quoted 7 lines
Quoted 1 line

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.

---

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

bbc05691d2dbd8bce7d6b5ae1c0ba0074ecef5e4

net/ipv4/proc.c +19 -0
index 37ab580..11dfa96 100644
@@ -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;
 }
Signature · 1 line
1.3.3
#17 lore raw

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

Quoted 18 lines · On Mon, 7 May 2007 20:29:05 +0900 Mitsuru Chinen <[email protected]>…
Quoted 15 lines · On Thu, 03 May 2007 03:15:46 -0700 (PDT) David Miller <[email protected]>…

From: Mitsuru Chinen <[email protected]>
Date: Wed, 2 May 2007 10:05:13 +0900

Quoted 8 lines

[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.

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

Quoted 7 lines
Quoted 2 lines

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.

---

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

fc11ca885424125a2add36ab6ff29aa8e4302d4b

net/ipv4/proc.c +21 -0
index 37ab580..cdbc6c1 100644
@@ -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;
 }
Signature · 1 line
1.3.3
#18 lore raw

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

In article <[email protected]> (at Sat, 12 May 2007 01:10:04 +0900), Mitsuru Chinen <[email protected]> says:

Quoted 8 lines

[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.

--yoshfuji

maintainer
#19 lore raw

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

From: YOSHIFUJI Hideaki / 吉藤英明 <[email protected]>
Date: Sat, 12 May 2007 01:19:49 +0900 (JST)

Quoted 11 lines

In article <[email protected]> (at Sat, 12 May 2007 01:10:04 +0900), Mitsuru Chinen <[email protected]> says:

Quoted 8 lines

[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.

Patch applied, thanks everyone.