diff options
author | Neil Horman <nhorman@tuxdriver.com> | 2009-04-27 05:45:02 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-04-27 05:45:02 -0400 |
commit | edf391ff17232f097d72441c9ad467bcb3b5db18 (patch) | |
tree | 3d1566e92aff168be842f6033695d234b6597180 /net/ipv6 | |
parent | 06bd12c3b861f8ca9e1215428b19dc0026c6268f (diff) |
snmp: add missing counters for RFC 4293
The IP MIB (RFC 4293) defines stats for InOctets, OutOctets, InMcastOctets and
OutMcastOctets:
http://tools.ietf.org/html/rfc4293
But it seems we don't track those in any way that easy to separate from other
protocols. This patch adds those missing counters to the stats file. Tested
successfully by me
With help from Eric Dumazet.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/ip6_input.c | 7 | ||||
-rw-r--r-- | net/ipv6/ip6_output.c | 9 | ||||
-rw-r--r-- | net/ipv6/mcast.c | 19 | ||||
-rw-r--r-- | net/ipv6/ndisc.c | 4 | ||||
-rw-r--r-- | net/ipv6/proc.c | 10 | ||||
-rw-r--r-- | net/ipv6/raw.c | 2 |
6 files changed, 32 insertions, 19 deletions
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index 8f04bd9da274..bc1a920c34a1 100644 --- a/net/ipv6/ip6_input.c +++ b/net/ipv6/ip6_input.c | |||
@@ -70,7 +70,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
70 | 70 | ||
71 | idev = __in6_dev_get(skb->dev); | 71 | idev = __in6_dev_get(skb->dev); |
72 | 72 | ||
73 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_INRECEIVES); | 73 | IP6_UPD_PO_STATS_BH(net, idev, IPSTATS_MIB_IN, skb->len); |
74 | 74 | ||
75 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL || | 75 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL || |
76 | !idev || unlikely(idev->cnf.disable_ipv6)) { | 76 | !idev || unlikely(idev->cnf.disable_ipv6)) { |
@@ -242,8 +242,9 @@ int ip6_mc_input(struct sk_buff *skb) | |||
242 | struct ipv6hdr *hdr; | 242 | struct ipv6hdr *hdr; |
243 | int deliver; | 243 | int deliver; |
244 | 244 | ||
245 | IP6_INC_STATS_BH(dev_net(skb->dst->dev), | 245 | IP6_UPD_PO_STATS_BH(dev_net(skb->dst->dev), |
246 | ip6_dst_idev(skb->dst), IPSTATS_MIB_INMCASTPKTS); | 246 | ip6_dst_idev(skb->dst), IPSTATS_MIB_INMCAST, |
247 | skb->len); | ||
247 | 248 | ||
248 | hdr = ipv6_hdr(skb); | 249 | hdr = ipv6_hdr(skb); |
249 | deliver = ipv6_chk_mcast_addr(skb->dev, &hdr->daddr, NULL); | 250 | deliver = ipv6_chk_mcast_addr(skb->dev, &hdr->daddr, NULL); |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 9fb49c3b518a..735a2bf4b5f1 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -159,7 +159,8 @@ static int ip6_output2(struct sk_buff *skb) | |||
159 | } | 159 | } |
160 | } | 160 | } |
161 | 161 | ||
162 | IP6_INC_STATS(dev_net(dev), idev, IPSTATS_MIB_OUTMCASTPKTS); | 162 | IP6_UPD_PO_STATS(dev_net(dev), idev, IPSTATS_MIB_OUTMCAST, |
163 | skb->len); | ||
163 | } | 164 | } |
164 | 165 | ||
165 | return NF_HOOK(PF_INET6, NF_INET_POST_ROUTING, skb, NULL, skb->dev, | 166 | return NF_HOOK(PF_INET6, NF_INET_POST_ROUTING, skb, NULL, skb->dev, |
@@ -275,8 +276,8 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, | |||
275 | 276 | ||
276 | mtu = dst_mtu(dst); | 277 | mtu = dst_mtu(dst); |
277 | if ((skb->len <= mtu) || skb->local_df || skb_is_gso(skb)) { | 278 | if ((skb->len <= mtu) || skb->local_df || skb_is_gso(skb)) { |
278 | IP6_INC_STATS(net, ip6_dst_idev(skb->dst), | 279 | IP6_UPD_PO_STATS(net, ip6_dst_idev(skb->dst), |
279 | IPSTATS_MIB_OUTREQUESTS); | 280 | IPSTATS_MIB_OUT, skb->len); |
280 | return NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev, | 281 | return NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev, |
281 | dst_output); | 282 | dst_output); |
282 | } | 283 | } |
@@ -1516,7 +1517,7 @@ int ip6_push_pending_frames(struct sock *sk) | |||
1516 | skb->mark = sk->sk_mark; | 1517 | skb->mark = sk->sk_mark; |
1517 | 1518 | ||
1518 | skb->dst = dst_clone(&rt->u.dst); | 1519 | skb->dst = dst_clone(&rt->u.dst); |
1519 | IP6_INC_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUTREQUESTS); | 1520 | IP6_UPD_PO_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUT, skb->len); |
1520 | if (proto == IPPROTO_ICMPV6) { | 1521 | if (proto == IPPROTO_ICMPV6) { |
1521 | struct inet6_dev *idev = ip6_dst_idev(skb->dst); | 1522 | struct inet6_dev *idev = ip6_dst_idev(skb->dst); |
1522 | 1523 | ||
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index a51fb33e6864..4b48819a5b8d 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -1449,7 +1449,8 @@ static void mld_sendpack(struct sk_buff *skb) | |||
1449 | int err; | 1449 | int err; |
1450 | struct flowi fl; | 1450 | struct flowi fl; |
1451 | 1451 | ||
1452 | IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTREQUESTS); | 1452 | IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUT, skb->len); |
1453 | |||
1453 | payload_len = (skb->tail - skb->network_header) - sizeof(*pip6); | 1454 | payload_len = (skb->tail - skb->network_header) - sizeof(*pip6); |
1454 | mldlen = skb->tail - skb->transport_header; | 1455 | mldlen = skb->tail - skb->transport_header; |
1455 | pip6->payload_len = htons(payload_len); | 1456 | pip6->payload_len = htons(payload_len); |
@@ -1473,13 +1474,15 @@ static void mld_sendpack(struct sk_buff *skb) | |||
1473 | if (err) | 1474 | if (err) |
1474 | goto err_out; | 1475 | goto err_out; |
1475 | 1476 | ||
1477 | payload_len = skb->len; | ||
1478 | |||
1476 | err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, skb->dev, | 1479 | err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, skb->dev, |
1477 | dst_output); | 1480 | dst_output); |
1478 | out: | 1481 | out: |
1479 | if (!err) { | 1482 | if (!err) { |
1480 | ICMP6MSGOUT_INC_STATS_BH(net, idev, ICMPV6_MLD2_REPORT); | 1483 | ICMP6MSGOUT_INC_STATS_BH(net, idev, ICMPV6_MLD2_REPORT); |
1481 | ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS); | 1484 | ICMP6_INC_STATS_BH(net, idev, ICMP6_MIB_OUTMSGS); |
1482 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_OUTMCASTPKTS); | 1485 | IP6_UPD_PO_STATS_BH(net, idev, IPSTATS_MIB_OUTMCAST, payload_len); |
1483 | } else | 1486 | } else |
1484 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_OUTDISCARDS); | 1487 | IP6_INC_STATS_BH(net, idev, IPSTATS_MIB_OUTDISCARDS); |
1485 | 1488 | ||
@@ -1773,10 +1776,6 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) | |||
1773 | IPV6_TLV_PADN, 0 }; | 1776 | IPV6_TLV_PADN, 0 }; |
1774 | struct flowi fl; | 1777 | struct flowi fl; |
1775 | 1778 | ||
1776 | rcu_read_lock(); | ||
1777 | IP6_INC_STATS(net, __in6_dev_get(dev), | ||
1778 | IPSTATS_MIB_OUTREQUESTS); | ||
1779 | rcu_read_unlock(); | ||
1780 | if (type == ICMPV6_MGM_REDUCTION) | 1779 | if (type == ICMPV6_MGM_REDUCTION) |
1781 | snd_addr = &in6addr_linklocal_allrouters; | 1780 | snd_addr = &in6addr_linklocal_allrouters; |
1782 | else | 1781 | else |
@@ -1786,6 +1785,11 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) | |||
1786 | payload_len = len + sizeof(ra); | 1785 | payload_len = len + sizeof(ra); |
1787 | full_len = sizeof(struct ipv6hdr) + payload_len; | 1786 | full_len = sizeof(struct ipv6hdr) + payload_len; |
1788 | 1787 | ||
1788 | rcu_read_lock(); | ||
1789 | IP6_UPD_PO_STATS(net, __in6_dev_get(dev), | ||
1790 | IPSTATS_MIB_OUT, full_len); | ||
1791 | rcu_read_unlock(); | ||
1792 | |||
1789 | skb = sock_alloc_send_skb(sk, LL_ALLOCATED_SPACE(dev) + full_len, 1, &err); | 1793 | skb = sock_alloc_send_skb(sk, LL_ALLOCATED_SPACE(dev) + full_len, 1, &err); |
1790 | 1794 | ||
1791 | if (skb == NULL) { | 1795 | if (skb == NULL) { |
@@ -1838,13 +1842,14 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) | |||
1838 | if (err) | 1842 | if (err) |
1839 | goto err_out; | 1843 | goto err_out; |
1840 | 1844 | ||
1845 | |||
1841 | err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, skb->dev, | 1846 | err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, skb->dev, |
1842 | dst_output); | 1847 | dst_output); |
1843 | out: | 1848 | out: |
1844 | if (!err) { | 1849 | if (!err) { |
1845 | ICMP6MSGOUT_INC_STATS(net, idev, type); | 1850 | ICMP6MSGOUT_INC_STATS(net, idev, type); |
1846 | ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS); | 1851 | ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS); |
1847 | IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTMCASTPKTS); | 1852 | IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUTMCAST, full_len); |
1848 | } else | 1853 | } else |
1849 | IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS); | 1854 | IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS); |
1850 | 1855 | ||
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 9f061d1adbc2..ab65cc51b00e 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -533,7 +533,7 @@ void ndisc_send_skb(struct sk_buff *skb, | |||
533 | skb->dst = dst; | 533 | skb->dst = dst; |
534 | 534 | ||
535 | idev = in6_dev_get(dst->dev); | 535 | idev = in6_dev_get(dst->dev); |
536 | IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTREQUESTS); | 536 | IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUT, skb->len); |
537 | 537 | ||
538 | err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev, | 538 | err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev, |
539 | dst_output); | 539 | dst_output); |
@@ -1613,7 +1613,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, | |||
1613 | 1613 | ||
1614 | buff->dst = dst; | 1614 | buff->dst = dst; |
1615 | idev = in6_dev_get(dst->dev); | 1615 | idev = in6_dev_get(dst->dev); |
1616 | IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTREQUESTS); | 1616 | IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUT, skb->len); |
1617 | err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, buff, NULL, dst->dev, | 1617 | err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, buff, NULL, dst->dev, |
1618 | dst_output); | 1618 | dst_output); |
1619 | if (!err) { | 1619 | if (!err) { |
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c index 97c17fdd6f75..590ddefb7ffc 100644 --- a/net/ipv6/proc.c +++ b/net/ipv6/proc.c | |||
@@ -61,7 +61,7 @@ static const struct file_operations sockstat6_seq_fops = { | |||
61 | 61 | ||
62 | static struct snmp_mib snmp6_ipstats_list[] = { | 62 | static struct snmp_mib snmp6_ipstats_list[] = { |
63 | /* ipv6 mib according to RFC 2465 */ | 63 | /* ipv6 mib according to RFC 2465 */ |
64 | SNMP_MIB_ITEM("Ip6InReceives", IPSTATS_MIB_INRECEIVES), | 64 | SNMP_MIB_ITEM("Ip6InReceives", IPSTATS_MIB_INPKTS), |
65 | SNMP_MIB_ITEM("Ip6InHdrErrors", IPSTATS_MIB_INHDRERRORS), | 65 | SNMP_MIB_ITEM("Ip6InHdrErrors", IPSTATS_MIB_INHDRERRORS), |
66 | SNMP_MIB_ITEM("Ip6InTooBigErrors", IPSTATS_MIB_INTOOBIGERRORS), | 66 | SNMP_MIB_ITEM("Ip6InTooBigErrors", IPSTATS_MIB_INTOOBIGERRORS), |
67 | SNMP_MIB_ITEM("Ip6InNoRoutes", IPSTATS_MIB_INNOROUTES), | 67 | SNMP_MIB_ITEM("Ip6InNoRoutes", IPSTATS_MIB_INNOROUTES), |
@@ -71,7 +71,7 @@ static struct snmp_mib snmp6_ipstats_list[] = { | |||
71 | SNMP_MIB_ITEM("Ip6InDiscards", IPSTATS_MIB_INDISCARDS), | 71 | SNMP_MIB_ITEM("Ip6InDiscards", IPSTATS_MIB_INDISCARDS), |
72 | SNMP_MIB_ITEM("Ip6InDelivers", IPSTATS_MIB_INDELIVERS), | 72 | SNMP_MIB_ITEM("Ip6InDelivers", IPSTATS_MIB_INDELIVERS), |
73 | SNMP_MIB_ITEM("Ip6OutForwDatagrams", IPSTATS_MIB_OUTFORWDATAGRAMS), | 73 | SNMP_MIB_ITEM("Ip6OutForwDatagrams", IPSTATS_MIB_OUTFORWDATAGRAMS), |
74 | SNMP_MIB_ITEM("Ip6OutRequests", IPSTATS_MIB_OUTREQUESTS), | 74 | SNMP_MIB_ITEM("Ip6OutRequests", IPSTATS_MIB_OUTPKTS), |
75 | SNMP_MIB_ITEM("Ip6OutDiscards", IPSTATS_MIB_OUTDISCARDS), | 75 | SNMP_MIB_ITEM("Ip6OutDiscards", IPSTATS_MIB_OUTDISCARDS), |
76 | SNMP_MIB_ITEM("Ip6OutNoRoutes", IPSTATS_MIB_OUTNOROUTES), | 76 | SNMP_MIB_ITEM("Ip6OutNoRoutes", IPSTATS_MIB_OUTNOROUTES), |
77 | SNMP_MIB_ITEM("Ip6ReasmTimeout", IPSTATS_MIB_REASMTIMEOUT), | 77 | SNMP_MIB_ITEM("Ip6ReasmTimeout", IPSTATS_MIB_REASMTIMEOUT), |
@@ -83,6 +83,12 @@ static struct snmp_mib snmp6_ipstats_list[] = { | |||
83 | SNMP_MIB_ITEM("Ip6FragCreates", IPSTATS_MIB_FRAGCREATES), | 83 | SNMP_MIB_ITEM("Ip6FragCreates", IPSTATS_MIB_FRAGCREATES), |
84 | SNMP_MIB_ITEM("Ip6InMcastPkts", IPSTATS_MIB_INMCASTPKTS), | 84 | SNMP_MIB_ITEM("Ip6InMcastPkts", IPSTATS_MIB_INMCASTPKTS), |
85 | SNMP_MIB_ITEM("Ip6OutMcastPkts", IPSTATS_MIB_OUTMCASTPKTS), | 85 | SNMP_MIB_ITEM("Ip6OutMcastPkts", IPSTATS_MIB_OUTMCASTPKTS), |
86 | SNMP_MIB_ITEM("Ip6InOctets", IPSTATS_MIB_INOCTETS), | ||
87 | SNMP_MIB_ITEM("Ip6OutOctets", IPSTATS_MIB_OUTOCTETS), | ||
88 | SNMP_MIB_ITEM("Ip6InMcastOctets", IPSTATS_MIB_INMCASTOCTETS), | ||
89 | SNMP_MIB_ITEM("Ip6OutMcastOctets", IPSTATS_MIB_OUTMCASTOCTETS), | ||
90 | SNMP_MIB_ITEM("Ip6InBcastOctets", IPSTATS_MIB_INBCASTOCTETS), | ||
91 | SNMP_MIB_ITEM("Ip6OutBcastOctets", IPSTATS_MIB_OUTBCASTOCTETS), | ||
86 | SNMP_MIB_SENTINEL | 92 | SNMP_MIB_SENTINEL |
87 | }; | 93 | }; |
88 | 94 | ||
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 61f6827e5906..e99307fba0b1 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -638,7 +638,7 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length, | |||
638 | if (err) | 638 | if (err) |
639 | goto error_fault; | 639 | goto error_fault; |
640 | 640 | ||
641 | IP6_INC_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUTREQUESTS); | 641 | IP6_UPD_PO_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUT, skb->len); |
642 | err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, rt->u.dst.dev, | 642 | err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, rt->u.dst.dev, |
643 | dst_output); | 643 | dst_output); |
644 | if (err > 0) | 644 | if (err > 0) |