diff options
author | David L Stevens <dlstevens@us.ibm.com> | 2007-09-16 19:52:35 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:51:27 -0400 |
commit | 14878f75abd5bf1d38becb405801cd491ee215dc (patch) | |
tree | 872d70add65e1e58ccbbcc4534c7e826bd3fa9ed /net/ipv6/icmp.c | |
parent | 8b14a536701b50559a0d69d5d593323f550db4e9 (diff) |
[IPV6]: Add ICMPMsgStats MIB (RFC 4293) [rev 2]
Background: RFC 4293 deprecates existing individual, named ICMP
type counters to be replaced with the ICMPMsgStatsTable. This table
includes entries for both IPv4 and IPv6, and requires counting of all
ICMP types, whether or not the machine implements the type.
These patches "remove" (but not really) the existing counters, and
replace them with the ICMPMsgStats tables for v4 and v6.
It includes the named counters in the /proc places they were, but gets the
values for them from the new tables. It also counts packets generated
from raw socket output (e.g., OutEchoes, MLD queries, RA's from
radvd, etc).
Changes:
1) create icmpmsg_statistics mib
2) create icmpv6msg_statistics mib
3) modify existing counters to use these
4) modify /proc/net/snmp to add "IcmpMsg" with all ICMP types
listed by number for easy SNMP parsing
5) modify /proc/net/snmp printing for "Icmp" to get the named data
from new counters.
[new to 2nd revision]
6) support per-interface ICMP stats
7) use common macro for per-device stat macros
Signed-off-by: David L Stevens <dlstevens@us.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/icmp.c')
-rw-r--r-- | net/ipv6/icmp.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index 6a6714d154ed..47b8ce232e84 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -69,6 +69,8 @@ | |||
69 | 69 | ||
70 | DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics) __read_mostly; | 70 | DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics) __read_mostly; |
71 | EXPORT_SYMBOL(icmpv6_statistics); | 71 | EXPORT_SYMBOL(icmpv6_statistics); |
72 | DEFINE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics) __read_mostly; | ||
73 | EXPORT_SYMBOL(icmpv6msg_statistics); | ||
72 | 74 | ||
73 | /* | 75 | /* |
74 | * The ICMP socket(s). This is the most convenient way to flow control | 76 | * The ICMP socket(s). This is the most convenient way to flow control |
@@ -456,8 +458,6 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, | |||
456 | } | 458 | } |
457 | err = icmpv6_push_pending_frames(sk, &fl, &tmp_hdr, len + sizeof(struct icmp6hdr)); | 459 | err = icmpv6_push_pending_frames(sk, &fl, &tmp_hdr, len + sizeof(struct icmp6hdr)); |
458 | 460 | ||
459 | if (type >= ICMPV6_DEST_UNREACH && type <= ICMPV6_PARAMPROB) | ||
460 | ICMP6_INC_STATS_OFFSET_BH(idev, ICMP6_MIB_OUTDESTUNREACHS, type - ICMPV6_DEST_UNREACH); | ||
461 | ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTMSGS); | 461 | ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTMSGS); |
462 | 462 | ||
463 | out_put: | 463 | out_put: |
@@ -547,9 +547,6 @@ static void icmpv6_echo_reply(struct sk_buff *skb) | |||
547 | } | 547 | } |
548 | err = icmpv6_push_pending_frames(sk, &fl, &tmp_hdr, skb->len + sizeof(struct icmp6hdr)); | 548 | err = icmpv6_push_pending_frames(sk, &fl, &tmp_hdr, skb->len + sizeof(struct icmp6hdr)); |
549 | 549 | ||
550 | ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTECHOREPLIES); | ||
551 | ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTMSGS); | ||
552 | |||
553 | out_put: | 550 | out_put: |
554 | if (likely(idev != NULL)) | 551 | if (likely(idev != NULL)) |
555 | in6_dev_put(idev); | 552 | in6_dev_put(idev); |
@@ -656,10 +653,7 @@ static int icmpv6_rcv(struct sk_buff **pskb) | |||
656 | 653 | ||
657 | type = hdr->icmp6_type; | 654 | type = hdr->icmp6_type; |
658 | 655 | ||
659 | if (type >= ICMPV6_DEST_UNREACH && type <= ICMPV6_PARAMPROB) | 656 | ICMP6MSGIN_INC_STATS_BH(idev, type); |
660 | ICMP6_INC_STATS_OFFSET_BH(idev, ICMP6_MIB_INDESTUNREACHS, type - ICMPV6_DEST_UNREACH); | ||
661 | else if (type >= ICMPV6_ECHO_REQUEST && type <= NDISC_REDIRECT) | ||
662 | ICMP6_INC_STATS_OFFSET_BH(idev, ICMP6_MIB_INECHOS, type - ICMPV6_ECHO_REQUEST); | ||
663 | 657 | ||
664 | switch (type) { | 658 | switch (type) { |
665 | case ICMPV6_ECHO_REQUEST: | 659 | case ICMPV6_ECHO_REQUEST: |