diff options
author | Eric Dumazet <edumazet@google.com> | 2013-04-29 04:39:56 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-04-29 15:14:03 -0400 |
commit | 6a5dc9e598fe90160fee7de098fa319665f5253e (patch) | |
tree | 7f2c2130e3dec81aea01e997cec7e87744f02694 /net/ipv6/udp.c | |
parent | f233a976ad15c3b8c54c0157f3c41d23f7514279 (diff) |
net: Add MIB counters for checksum errors
Add MIB counters for checksum errors in IP layer,
and TCP/UDP/ICMP layers, to help diagnose problems.
$ nstat -a | grep Csum
IcmpInCsumErrors 72 0.0
TcpInCsumErrors 382 0.0
UdpInCsumErrors 463221 0.0
Icmp6InCsumErrors 75 0.0
Udp6InCsumErrors 173442 0.0
IpExtInCsumErrors 10884 0.0
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/udp.c')
-rw-r--r-- | net/ipv6/udp.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index da6019b63730..d4defdd44937 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -483,12 +483,17 @@ out: | |||
483 | csum_copy_err: | 483 | csum_copy_err: |
484 | slow = lock_sock_fast(sk); | 484 | slow = lock_sock_fast(sk); |
485 | if (!skb_kill_datagram(sk, skb, flags)) { | 485 | if (!skb_kill_datagram(sk, skb, flags)) { |
486 | if (is_udp4) | 486 | if (is_udp4) { |
487 | UDP_INC_STATS_USER(sock_net(sk), | ||
488 | UDP_MIB_CSUMERRORS, is_udplite); | ||
487 | UDP_INC_STATS_USER(sock_net(sk), | 489 | UDP_INC_STATS_USER(sock_net(sk), |
488 | UDP_MIB_INERRORS, is_udplite); | 490 | UDP_MIB_INERRORS, is_udplite); |
489 | else | 491 | } else { |
492 | UDP6_INC_STATS_USER(sock_net(sk), | ||
493 | UDP_MIB_CSUMERRORS, is_udplite); | ||
490 | UDP6_INC_STATS_USER(sock_net(sk), | 494 | UDP6_INC_STATS_USER(sock_net(sk), |
491 | UDP_MIB_INERRORS, is_udplite); | 495 | UDP_MIB_INERRORS, is_udplite); |
496 | } | ||
492 | } | 497 | } |
493 | unlock_sock_fast(sk, slow); | 498 | unlock_sock_fast(sk, slow); |
494 | 499 | ||
@@ -637,7 +642,7 @@ int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
637 | 642 | ||
638 | if (rcu_access_pointer(sk->sk_filter)) { | 643 | if (rcu_access_pointer(sk->sk_filter)) { |
639 | if (udp_lib_checksum_complete(skb)) | 644 | if (udp_lib_checksum_complete(skb)) |
640 | goto drop; | 645 | goto csum_error; |
641 | } | 646 | } |
642 | 647 | ||
643 | if (sk_rcvqueues_full(sk, skb, sk->sk_rcvbuf)) | 648 | if (sk_rcvqueues_full(sk, skb, sk->sk_rcvbuf)) |
@@ -656,6 +661,8 @@ int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) | |||
656 | bh_unlock_sock(sk); | 661 | bh_unlock_sock(sk); |
657 | 662 | ||
658 | return rc; | 663 | return rc; |
664 | csum_error: | ||
665 | UDP6_INC_STATS_BH(sock_net(sk), UDP_MIB_CSUMERRORS, is_udplite); | ||
659 | drop: | 666 | drop: |
660 | UDP6_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, is_udplite); | 667 | UDP6_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, is_udplite); |
661 | atomic_inc(&sk->sk_drops); | 668 | atomic_inc(&sk->sk_drops); |
@@ -817,7 +824,7 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, | |||
817 | } | 824 | } |
818 | 825 | ||
819 | if (udp6_csum_init(skb, uh, proto)) | 826 | if (udp6_csum_init(skb, uh, proto)) |
820 | goto discard; | 827 | goto csum_error; |
821 | 828 | ||
822 | /* | 829 | /* |
823 | * Multicast receive code | 830 | * Multicast receive code |
@@ -850,7 +857,7 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, | |||
850 | goto discard; | 857 | goto discard; |
851 | 858 | ||
852 | if (udp_lib_checksum_complete(skb)) | 859 | if (udp_lib_checksum_complete(skb)) |
853 | goto discard; | 860 | goto csum_error; |
854 | 861 | ||
855 | UDP6_INC_STATS_BH(net, UDP_MIB_NOPORTS, proto == IPPROTO_UDPLITE); | 862 | UDP6_INC_STATS_BH(net, UDP_MIB_NOPORTS, proto == IPPROTO_UDPLITE); |
856 | icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH, 0); | 863 | icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH, 0); |
@@ -867,7 +874,9 @@ short_packet: | |||
867 | skb->len, | 874 | skb->len, |
868 | daddr, | 875 | daddr, |
869 | ntohs(uh->dest)); | 876 | ntohs(uh->dest)); |
870 | 877 | goto discard; | |
878 | csum_error: | ||
879 | UDP6_INC_STATS_BH(net, UDP_MIB_CSUMERRORS, proto == IPPROTO_UDPLITE); | ||
871 | discard: | 880 | discard: |
872 | UDP6_INC_STATS_BH(net, UDP_MIB_INERRORS, proto == IPPROTO_UDPLITE); | 881 | UDP6_INC_STATS_BH(net, UDP_MIB_INERRORS, proto == IPPROTO_UDPLITE); |
873 | kfree_skb(skb); | 882 | kfree_skb(skb); |