Skip to content

Commit

Permalink
udp: Fix the SNMP counter of UDP_MIB_INERRORS
Browse files Browse the repository at this point in the history
UDP packets received in udpv6_recvmsg() are not only IPv6 UDP packets, but
also have IPv4 UDP packets, so when do the counter of UDP_MIB_INERRORS in
udpv6_recvmsg(), we should check whether the packet is a IPv6 UDP packet
or a IPv4 UDP packet.

Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Wei Yongjun authored and David S. Miller committed Nov 3, 2008
1 parent f26ba17 commit 0856f93
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions net/ipv6/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,14 @@ int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk,

csum_copy_err:
lock_sock(sk);
if (!skb_kill_datagram(sk, skb, flags))
UDP6_INC_STATS_USER(sock_net(sk), UDP_MIB_INERRORS, is_udplite);
if (!skb_kill_datagram(sk, skb, flags)) {
if (is_udp4)
UDP_INC_STATS_USER(sock_net(sk),
UDP_MIB_INERRORS, is_udplite);
else
UDP6_INC_STATS_USER(sock_net(sk),
UDP_MIB_INERRORS, is_udplite);
}
release_sock(sk);

if (flags & MSG_DONTWAIT)
Expand Down

0 comments on commit 0856f93

Please sign in to comment.