aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ndisc.c
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/ipv6/ndisc.c
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/ipv6/ndisc.c')
-rw-r--r--net/ipv6/ndisc.c21
1 files changed, 10 insertions, 11 deletions
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