diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2007-04-13 19:18:02 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-04-13 19:18:02 -0400 |
commit | 612f09e8495ba656032f89147ab999ef2be9c360 (patch) | |
tree | 16a0cb310eb6812383f57d3425ceeba6b34f9f52 | |
parent | 661697f728d75302e1f661a58db2fcba71d5cbc9 (diff) |
[IPV6] SNMP: Fix {In,Out}NoRoutes statistics.
A packet which is being discarded because of no routes in the
forwarding path should not be counted as OutNoRoutes but as
InNoRoutes.
Additionally, on this occasion, a packet whose destinaion is
not valid should be counted as InAddrErrors separately.
Based on patch from Mitsuru Chinen <mitch@linux.vnet.ibm.com>.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv6/route.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index ad9b285692ba..aebb4e2d5ae3 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -1766,13 +1766,22 @@ int ipv6_route_ioctl(unsigned int cmd, void __user *arg) | |||
1766 | * Drop the packet on the floor | 1766 | * Drop the packet on the floor |
1767 | */ | 1767 | */ |
1768 | 1768 | ||
1769 | static inline int ip6_pkt_drop(struct sk_buff *skb, int code) | 1769 | static inline int ip6_pkt_drop(struct sk_buff *skb, int code, |
1770 | { | 1770 | int ipstats_mib_noroutes) |
1771 | int type = ipv6_addr_type(&skb->nh.ipv6h->daddr); | 1771 | { |
1772 | if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) | 1772 | int type; |
1773 | IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INADDRERRORS); | 1773 | switch (ipstats_mib_noroutes) { |
1774 | 1774 | case IPSTATS_MIB_INNOROUTES: | |
1775 | IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_OUTNOROUTES); | 1775 | type = ipv6_addr_type(&skb->nh.ipv6h->daddr); |
1776 | if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) { | ||
1777 | IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INADDRERRORS); | ||
1778 | break; | ||
1779 | } | ||
1780 | /* FALLTHROUGH */ | ||
1781 | case IPSTATS_MIB_OUTNOROUTES: | ||
1782 | IP6_INC_STATS(ip6_dst_idev(skb->dst), ipstats_mib_noroutes); | ||
1783 | break; | ||
1784 | } | ||
1776 | icmpv6_send(skb, ICMPV6_DEST_UNREACH, code, 0, skb->dev); | 1785 | icmpv6_send(skb, ICMPV6_DEST_UNREACH, code, 0, skb->dev); |
1777 | kfree_skb(skb); | 1786 | kfree_skb(skb); |
1778 | return 0; | 1787 | return 0; |
@@ -1780,26 +1789,26 @@ static inline int ip6_pkt_drop(struct sk_buff *skb, int code) | |||
1780 | 1789 | ||
1781 | static int ip6_pkt_discard(struct sk_buff *skb) | 1790 | static int ip6_pkt_discard(struct sk_buff *skb) |
1782 | { | 1791 | { |
1783 | return ip6_pkt_drop(skb, ICMPV6_NOROUTE); | 1792 | return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_INNOROUTES); |
1784 | } | 1793 | } |
1785 | 1794 | ||
1786 | static int ip6_pkt_discard_out(struct sk_buff *skb) | 1795 | static int ip6_pkt_discard_out(struct sk_buff *skb) |
1787 | { | 1796 | { |
1788 | skb->dev = skb->dst->dev; | 1797 | skb->dev = skb->dst->dev; |
1789 | return ip6_pkt_discard(skb); | 1798 | return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_OUTNOROUTES); |
1790 | } | 1799 | } |
1791 | 1800 | ||
1792 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | 1801 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES |
1793 | 1802 | ||
1794 | static int ip6_pkt_prohibit(struct sk_buff *skb) | 1803 | static int ip6_pkt_prohibit(struct sk_buff *skb) |
1795 | { | 1804 | { |
1796 | return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED); | 1805 | return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_INNOROUTES); |
1797 | } | 1806 | } |
1798 | 1807 | ||
1799 | static int ip6_pkt_prohibit_out(struct sk_buff *skb) | 1808 | static int ip6_pkt_prohibit_out(struct sk_buff *skb) |
1800 | { | 1809 | { |
1801 | skb->dev = skb->dst->dev; | 1810 | skb->dev = skb->dst->dev; |
1802 | return ip6_pkt_prohibit(skb); | 1811 | return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES); |
1803 | } | 1812 | } |
1804 | 1813 | ||
1805 | static int ip6_pkt_blk_hole(struct sk_buff *skb) | 1814 | static int ip6_pkt_blk_hole(struct sk_buff *skb) |