aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid L Stevens <dlstevens@us.ibm.com>2007-09-16 19:52:35 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:51:27 -0400
commit14878f75abd5bf1d38becb405801cd491ee215dc (patch)
tree872d70add65e1e58ccbbcc4534c7e826bd3fa9ed /net
parent8b14a536701b50559a0d69d5d593323f550db4e9 (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')
-rw-r--r--net/ipv6/addrconf.c7
-rw-r--r--net/ipv6/af_inet6.c5
-rw-r--r--net/ipv6/icmp.c12
-rw-r--r--net/ipv6/ip6_output.c7
-rw-r--r--net/ipv6/mcast.c12
-rw-r--r--net/ipv6/ndisc.c21
-rw-r--r--net/ipv6/proc.c92
7 files changed, 94 insertions, 62 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index a68c626567f2..9c2e94f1c637 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -261,9 +261,15 @@ static int snmp6_alloc_dev(struct inet6_dev *idev)
261 sizeof(struct icmpv6_mib), 261 sizeof(struct icmpv6_mib),
262 __alignof__(struct icmpv6_mib)) < 0) 262 __alignof__(struct icmpv6_mib)) < 0)
263 goto err_icmp; 263 goto err_icmp;
264 if (snmp_mib_init((void **)idev->stats.icmpv6msg,
265 sizeof(struct icmpv6msg_mib),
266 __alignof__(struct icmpv6msg_mib)) < 0)
267 goto err_icmpmsg;
264 268
265 return 0; 269 return 0;
266 270
271err_icmpmsg:
272 snmp_mib_free((void **)idev->stats.icmpv6);
267err_icmp: 273err_icmp:
268 snmp_mib_free((void **)idev->stats.ipv6); 274 snmp_mib_free((void **)idev->stats.ipv6);
269err_ip: 275err_ip:
@@ -272,6 +278,7 @@ err_ip:
272 278
273static int snmp6_free_dev(struct inet6_dev *idev) 279static int snmp6_free_dev(struct inet6_dev *idev)
274{ 280{
281 snmp_mib_free((void **)idev->stats.icmpv6msg);
275 snmp_mib_free((void **)idev->stats.icmpv6); 282 snmp_mib_free((void **)idev->stats.icmpv6);
276 snmp_mib_free((void **)idev->stats.ipv6); 283 snmp_mib_free((void **)idev->stats.ipv6);
277 return 0; 284 return 0;
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index e5c5aad44bb1..bc929381fa46 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -719,6 +719,9 @@ static int __init init_ipv6_mibs(void)
719 if (snmp_mib_init((void **)icmpv6_statistics, sizeof (struct icmpv6_mib), 719 if (snmp_mib_init((void **)icmpv6_statistics, sizeof (struct icmpv6_mib),
720 __alignof__(struct icmpv6_mib)) < 0) 720 __alignof__(struct icmpv6_mib)) < 0)
721 goto err_icmp_mib; 721 goto err_icmp_mib;
722 if (snmp_mib_init((void **)icmpv6msg_statistics,
723 sizeof (struct icmpv6msg_mib), __alignof__(struct icmpv6_mib)) < 0)
724 goto err_icmpmsg_mib;
722 if (snmp_mib_init((void **)udp_stats_in6, sizeof (struct udp_mib), 725 if (snmp_mib_init((void **)udp_stats_in6, sizeof (struct udp_mib),
723 __alignof__(struct udp_mib)) < 0) 726 __alignof__(struct udp_mib)) < 0)
724 goto err_udp_mib; 727 goto err_udp_mib;
@@ -730,6 +733,8 @@ static int __init init_ipv6_mibs(void)
730err_udplite_mib: 733err_udplite_mib:
731 snmp_mib_free((void **)udp_stats_in6); 734 snmp_mib_free((void **)udp_stats_in6);
732err_udp_mib: 735err_udp_mib:
736 snmp_mib_free((void **)icmpv6msg_statistics);
737err_icmpmsg_mib:
733 snmp_mib_free((void **)icmpv6_statistics); 738 snmp_mib_free((void **)icmpv6_statistics);
734err_icmp_mib: 739err_icmp_mib:
735 snmp_mib_free((void **)ipv6_statistics); 740 snmp_mib_free((void **)ipv6_statistics);
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
70DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics) __read_mostly; 70DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics) __read_mostly;
71EXPORT_SYMBOL(icmpv6_statistics); 71EXPORT_SYMBOL(icmpv6_statistics);
72DEFINE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics) __read_mostly;
73EXPORT_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
463out_put: 463out_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
553out_put: 550out_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:
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index e46d4683eab0..011082ed921a 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1399,6 +1399,13 @@ int ip6_push_pending_frames(struct sock *sk)
1399 1399
1400 skb->dst = dst_clone(&rt->u.dst); 1400 skb->dst = dst_clone(&rt->u.dst);
1401 IP6_INC_STATS(rt->rt6i_idev, IPSTATS_MIB_OUTREQUESTS); 1401 IP6_INC_STATS(rt->rt6i_idev, IPSTATS_MIB_OUTREQUESTS);
1402 if (proto == IPPROTO_ICMPV6) {
1403 struct inet6_dev *idev = ip6_dst_idev(skb->dst);
1404
1405 ICMP6MSGOUT_INC_STATS_BH(idev, icmp6_hdr(skb)->icmp6_type);
1406 ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTMSGS);
1407 }
1408
1402 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dst->dev, dst_output); 1409 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dst->dev, dst_output);
1403 if (err) { 1410 if (err) {
1404 if (err > 0) 1411 if (err > 0)
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index e2ab43c989d4..86d908b1caea 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -1479,10 +1479,11 @@ static void mld_sendpack(struct sk_buff *skb)
1479 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dev, 1479 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dev,
1480 mld_dev_queue_xmit); 1480 mld_dev_queue_xmit);
1481 if (!err) { 1481 if (!err) {
1482 ICMP6_INC_STATS(idev,ICMP6_MIB_OUTMSGS); 1482 ICMP6MSGOUT_INC_STATS_BH(idev, ICMPV6_MLD2_REPORT);
1483 IP6_INC_STATS(idev, IPSTATS_MIB_OUTMCASTPKTS); 1483 ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTMSGS);
1484 IP6_INC_STATS_BH(idev, IPSTATS_MIB_OUTMCASTPKTS);
1484 } else 1485 } else
1485 IP6_INC_STATS(idev, IPSTATS_MIB_OUTDISCARDS); 1486 IP6_INC_STATS_BH(idev, IPSTATS_MIB_OUTDISCARDS);
1486 1487
1487 if (likely(idev != NULL)) 1488 if (likely(idev != NULL))
1488 in6_dev_put(idev); 1489 in6_dev_put(idev);
@@ -1822,10 +1823,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
1822 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dev, 1823 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dev,
1823 mld_dev_queue_xmit); 1824 mld_dev_queue_xmit);
1824 if (!err) { 1825 if (!err) {
1825 if (type == ICMPV6_MGM_REDUCTION) 1826 ICMP6MSGOUT_INC_STATS(idev, type);
1826 ICMP6_INC_STATS(idev, ICMP6_MIB_OUTGROUPMEMBREDUCTIONS);
1827 else
1828 ICMP6_INC_STATS(idev, ICMP6_MIB_OUTGROUPMEMBRESPONSES);
1829 ICMP6_INC_STATS(idev, ICMP6_MIB_OUTMSGS); 1827 ICMP6_INC_STATS(idev, ICMP6_MIB_OUTMSGS);
1830 IP6_INC_STATS(idev, IPSTATS_MIB_OUTMCASTPKTS); 1828 IP6_INC_STATS(idev, IPSTATS_MIB_OUTMCASTPKTS);
1831 } else 1829 } else
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index d2d44dc22f19..7ea5a502ca08 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -431,7 +431,7 @@ static void __ndisc_send(struct net_device *dev,
431 struct neighbour *neigh, 431 struct neighbour *neigh,
432 struct in6_addr *daddr, struct in6_addr *saddr, 432 struct in6_addr *daddr, struct in6_addr *saddr,
433 struct icmp6hdr *icmp6h, struct in6_addr *target, 433 struct icmp6hdr *icmp6h, struct in6_addr *target,
434 int llinfo, int icmp6_mib_outnd) 434 int llinfo)
435{ 435{
436 struct flowi fl; 436 struct flowi fl;
437 struct dst_entry *dst; 437 struct dst_entry *dst;
@@ -441,9 +441,11 @@ static void __ndisc_send(struct net_device *dev,
441 struct inet6_dev *idev; 441 struct inet6_dev *idev;
442 int len; 442 int len;
443 int err; 443 int err;
444 u8 *opt; 444 u8 *opt, type;
445
446 type = icmp6h->icmp6_type;
445 447
446 ndisc_flow_init(&fl, icmp6h->icmp6_type, saddr, daddr, 448 ndisc_flow_init(&fl, type, saddr, daddr,
447 dev->ifindex); 449 dev->ifindex);
448 450
449 dst = ndisc_dst_alloc(dev, neigh, daddr, ip6_output); 451 dst = ndisc_dst_alloc(dev, neigh, daddr, ip6_output);
@@ -504,7 +506,7 @@ static void __ndisc_send(struct net_device *dev,
504 506
505 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output); 507 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output);
506 if (!err) { 508 if (!err) {
507 ICMP6_INC_STATS(idev, icmp6_mib_outnd); 509 ICMP6MSGOUT_INC_STATS(idev, type);
508 ICMP6_INC_STATS(idev, ICMP6_MIB_OUTMSGS); 510 ICMP6_INC_STATS(idev, ICMP6_MIB_OUTMSGS);
509 } 511 }
510 512
@@ -542,8 +544,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
542 544
543 __ndisc_send(dev, neigh, daddr, src_addr, 545 __ndisc_send(dev, neigh, daddr, src_addr,
544 &icmp6h, solicited_addr, 546 &icmp6h, solicited_addr,
545 inc_opt ? ND_OPT_TARGET_LL_ADDR : 0, 547 inc_opt ? ND_OPT_TARGET_LL_ADDR : 0);
546 ICMP6_MIB_OUTNEIGHBORADVERTISEMENTS);
547} 548}
548 549
549void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh, 550void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
@@ -564,8 +565,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
564 565
565 __ndisc_send(dev, neigh, daddr, saddr, 566 __ndisc_send(dev, neigh, daddr, saddr,
566 &icmp6h, solicit, 567 &icmp6h, solicit,
567 !ipv6_addr_any(saddr) ? ND_OPT_SOURCE_LL_ADDR : 0, 568 !ipv6_addr_any(saddr) ? ND_OPT_SOURCE_LL_ADDR : 0);
568 ICMP6_MIB_OUTNEIGHBORSOLICITS);
569} 569}
570 570
571void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr, 571void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
@@ -599,8 +599,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
599#endif 599#endif
600 __ndisc_send(dev, NULL, daddr, saddr, 600 __ndisc_send(dev, NULL, daddr, saddr,
601 &icmp6h, NULL, 601 &icmp6h, NULL,
602 send_sllao ? ND_OPT_SOURCE_LL_ADDR : 0, 602 send_sllao ? ND_OPT_SOURCE_LL_ADDR : 0);
603 ICMP6_MIB_OUTROUTERSOLICITS);
604} 603}
605 604
606 605
@@ -1455,7 +1454,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1455 IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS); 1454 IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS);
1456 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, buff, NULL, dst->dev, dst_output); 1455 err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, buff, NULL, dst->dev, dst_output);
1457 if (!err) { 1456 if (!err) {
1458 ICMP6_INC_STATS(idev, ICMP6_MIB_OUTREDIRECTS); 1457 ICMP6MSGOUT_INC_STATS(idev, NDISC_REDIRECT);
1459 ICMP6_INC_STATS(idev, ICMP6_MIB_OUTMSGS); 1458 ICMP6_INC_STATS(idev, ICMP6_MIB_OUTMSGS);
1460 } 1459 }
1461 1460
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index a712a2289484..db945018579e 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -86,47 +86,33 @@ static struct snmp_mib snmp6_ipstats_list[] = {
86}; 86};
87 87
88static struct snmp_mib snmp6_icmp6_list[] = { 88static struct snmp_mib snmp6_icmp6_list[] = {
89/* icmpv6 mib according to RFC 2466 89/* icmpv6 mib according to RFC 2466 */
90
91 Exceptions: {In|Out}AdminProhibs are removed, because I see
92 no good reasons to account them separately
93 of another dest.unreachs.
94 OutErrs is zero identically.
95 OutEchos too.
96 OutRouterAdvertisements too.
97 OutGroupMembQueries too.
98 */
99 SNMP_MIB_ITEM("Icmp6InMsgs", ICMP6_MIB_INMSGS), 90 SNMP_MIB_ITEM("Icmp6InMsgs", ICMP6_MIB_INMSGS),
100 SNMP_MIB_ITEM("Icmp6InErrors", ICMP6_MIB_INERRORS), 91 SNMP_MIB_ITEM("Icmp6InErrors", ICMP6_MIB_INERRORS),
101 SNMP_MIB_ITEM("Icmp6InDestUnreachs", ICMP6_MIB_INDESTUNREACHS),
102 SNMP_MIB_ITEM("Icmp6InPktTooBigs", ICMP6_MIB_INPKTTOOBIGS),
103 SNMP_MIB_ITEM("Icmp6InTimeExcds", ICMP6_MIB_INTIMEEXCDS),
104 SNMP_MIB_ITEM("Icmp6InParmProblems", ICMP6_MIB_INPARMPROBLEMS),
105 SNMP_MIB_ITEM("Icmp6InEchos", ICMP6_MIB_INECHOS),
106 SNMP_MIB_ITEM("Icmp6InEchoReplies", ICMP6_MIB_INECHOREPLIES),
107 SNMP_MIB_ITEM("Icmp6InGroupMembQueries", ICMP6_MIB_INGROUPMEMBQUERIES),
108 SNMP_MIB_ITEM("Icmp6InGroupMembResponses", ICMP6_MIB_INGROUPMEMBRESPONSES),
109 SNMP_MIB_ITEM("Icmp6InGroupMembReductions", ICMP6_MIB_INGROUPMEMBREDUCTIONS),
110 SNMP_MIB_ITEM("Icmp6InRouterSolicits", ICMP6_MIB_INROUTERSOLICITS),
111 SNMP_MIB_ITEM("Icmp6InRouterAdvertisements", ICMP6_MIB_INROUTERADVERTISEMENTS),
112 SNMP_MIB_ITEM("Icmp6InNeighborSolicits", ICMP6_MIB_INNEIGHBORSOLICITS),
113 SNMP_MIB_ITEM("Icmp6InNeighborAdvertisements", ICMP6_MIB_INNEIGHBORADVERTISEMENTS),
114 SNMP_MIB_ITEM("Icmp6InRedirects", ICMP6_MIB_INREDIRECTS),
115 SNMP_MIB_ITEM("Icmp6OutMsgs", ICMP6_MIB_OUTMSGS), 92 SNMP_MIB_ITEM("Icmp6OutMsgs", ICMP6_MIB_OUTMSGS),
116 SNMP_MIB_ITEM("Icmp6OutDestUnreachs", ICMP6_MIB_OUTDESTUNREACHS),
117 SNMP_MIB_ITEM("Icmp6OutPktTooBigs", ICMP6_MIB_OUTPKTTOOBIGS),
118 SNMP_MIB_ITEM("Icmp6OutTimeExcds", ICMP6_MIB_OUTTIMEEXCDS),
119 SNMP_MIB_ITEM("Icmp6OutParmProblems", ICMP6_MIB_OUTPARMPROBLEMS),
120 SNMP_MIB_ITEM("Icmp6OutEchoReplies", ICMP6_MIB_OUTECHOREPLIES),
121 SNMP_MIB_ITEM("Icmp6OutRouterSolicits", ICMP6_MIB_OUTROUTERSOLICITS),
122 SNMP_MIB_ITEM("Icmp6OutNeighborSolicits", ICMP6_MIB_OUTNEIGHBORSOLICITS),
123 SNMP_MIB_ITEM("Icmp6OutNeighborAdvertisements", ICMP6_MIB_OUTNEIGHBORADVERTISEMENTS),
124 SNMP_MIB_ITEM("Icmp6OutRedirects", ICMP6_MIB_OUTREDIRECTS),
125 SNMP_MIB_ITEM("Icmp6OutGroupMembResponses", ICMP6_MIB_OUTGROUPMEMBRESPONSES),
126 SNMP_MIB_ITEM("Icmp6OutGroupMembReductions", ICMP6_MIB_OUTGROUPMEMBREDUCTIONS),
127 SNMP_MIB_SENTINEL 93 SNMP_MIB_SENTINEL
128}; 94};
129 95
96/* RFC 4293 v6 ICMPMsgStatsTable; named items for RFC 2466 compatibility */
97static char *icmp6type2name[256] = {
98 [ICMPV6_DEST_UNREACH] = "DestUnreachs",
99 [ICMPV6_PKT_TOOBIG] = "PktTooBigs",
100 [ICMPV6_TIME_EXCEED] = "TimeExcds",
101 [ICMPV6_PARAMPROB] = "ParmProblems",
102 [ICMPV6_ECHO_REQUEST] = "EchoRequest",
103 [ICMPV6_ECHO_REPLY] = "EchoReplies",
104 [ICMPV6_MGM_QUERY] = "GroupMembQueries",
105 [ICMPV6_MGM_REPORT] = "GroupMembResponses",
106 [ICMPV6_MGM_REDUCTION] = "GroupMembReductions",
107 [ICMPV6_MLD2_REPORT] = "MLDv2Reports",
108 [NDISC_ROUTER_ADVERTISEMENT] = "RouterAdvertisements",
109 [NDISC_ROUTER_SOLICITATION] = "RouterSolicits",
110 [NDISC_NEIGHBOUR_ADVERTISEMENT] = "NeighborAdvertisements",
111 [NDISC_NEIGHBOUR_SOLICITATION] = "NeighborSolicits",
112 [NDISC_REDIRECT] = "NeighborRedirects",
113};
114
115
130static struct snmp_mib snmp6_udp6_list[] = { 116static struct snmp_mib snmp6_udp6_list[] = {
131 SNMP_MIB_ITEM("Udp6InDatagrams", UDP_MIB_INDATAGRAMS), 117 SNMP_MIB_ITEM("Udp6InDatagrams", UDP_MIB_INDATAGRAMS),
132 SNMP_MIB_ITEM("Udp6NoPorts", UDP_MIB_NOPORTS), 118 SNMP_MIB_ITEM("Udp6NoPorts", UDP_MIB_NOPORTS),
@@ -143,6 +129,40 @@ static struct snmp_mib snmp6_udplite6_list[] = {
143 SNMP_MIB_SENTINEL 129 SNMP_MIB_SENTINEL
144}; 130};
145 131
132static void snmp6_seq_show_icmpv6msg(struct seq_file *seq, void **mib)
133{
134 static char name[32];
135 int i;
136
137 /* print by name -- deprecated items */
138 for (i = 0; i < ICMP6MSG_MIB_MAX; i++) {
139 int icmptype;
140 char *p;
141
142 icmptype = i & 0xff;
143 p = icmp6type2name[icmptype];
144 if (!p) /* don't print un-named types here */
145 continue;
146 (void) snprintf(name, sizeof(name)-1, "Icmp6%s%s",
147 i & 0x100 ? "Out" : "In", p);
148 seq_printf(seq, "%-32s\t%lu\n", name,
149 snmp_fold_field(mib, i));
150 }
151
152 /* print by number (nonzero only) - ICMPMsgStat format */
153 for (i = 0; i < ICMP6MSG_MIB_MAX; i++) {
154 unsigned long val;
155
156 val = snmp_fold_field(mib, i);
157 if (!val)
158 continue;
159 (void) snprintf(name, sizeof(name)-1, "Icmp6%sType%u",
160 i & 0x100 ? "Out" : "In", i & 0xff);
161 seq_printf(seq, "%-32s\t%lu\n", name, val);
162 }
163 return;
164}
165
146static inline void 166static inline void
147snmp6_seq_show_item(struct seq_file *seq, void **mib, struct snmp_mib *itemlist) 167snmp6_seq_show_item(struct seq_file *seq, void **mib, struct snmp_mib *itemlist)
148{ 168{
@@ -160,9 +180,11 @@ static int snmp6_seq_show(struct seq_file *seq, void *v)
160 seq_printf(seq, "%-32s\t%u\n", "ifIndex", idev->dev->ifindex); 180 seq_printf(seq, "%-32s\t%u\n", "ifIndex", idev->dev->ifindex);
161 snmp6_seq_show_item(seq, (void **)idev->stats.ipv6, snmp6_ipstats_list); 181 snmp6_seq_show_item(seq, (void **)idev->stats.ipv6, snmp6_ipstats_list);
162 snmp6_seq_show_item(seq, (void **)idev->stats.icmpv6, snmp6_icmp6_list); 182 snmp6_seq_show_item(seq, (void **)idev->stats.icmpv6, snmp6_icmp6_list);
183 snmp6_seq_show_icmpv6msg(seq, (void **)idev->stats.icmpv6msg);
163 } else { 184 } else {
164 snmp6_seq_show_item(seq, (void **)ipv6_statistics, snmp6_ipstats_list); 185 snmp6_seq_show_item(seq, (void **)ipv6_statistics, snmp6_ipstats_list);
165 snmp6_seq_show_item(seq, (void **)icmpv6_statistics, snmp6_icmp6_list); 186 snmp6_seq_show_item(seq, (void **)icmpv6_statistics, snmp6_icmp6_list);
187 snmp6_seq_show_icmpv6msg(seq, (void **)icmpv6msg_statistics);
166 snmp6_seq_show_item(seq, (void **)udp_stats_in6, snmp6_udp6_list); 188 snmp6_seq_show_item(seq, (void **)udp_stats_in6, snmp6_udp6_list);
167 snmp6_seq_show_item(seq, (void **)udplite_stats_in6, snmp6_udplite6_list); 189 snmp6_seq_show_item(seq, (void **)udplite_stats_in6, snmp6_udplite6_list);
168 } 190 }