tcp: add tracepoint for checksum errors
Add a tracepoint for capturing TCP segments with a bad checksum. This makes it easy to identify sources of bad frames in the fleet (e.g. machines with faulty NICs). It should also help tools like IOvisor's tcpdrop.py which are used today to get detailed information about such packets. We don't have a socket in many cases so we must open code the address extraction based just on the skb. v2: add missing export for ipv6=m Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
7466b60a3c
commit
709c031423
@@ -1731,6 +1731,7 @@ discard:
|
||||
return 0;
|
||||
|
||||
csum_err:
|
||||
trace_tcp_bad_csum(skb);
|
||||
TCP_INC_STATS(sock_net(sk), TCP_MIB_CSUMERRORS);
|
||||
TCP_INC_STATS(sock_net(sk), TCP_MIB_INERRS);
|
||||
goto discard;
|
||||
@@ -1801,6 +1802,7 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb)
|
||||
|
||||
if (unlikely(tcp_checksum_complete(skb))) {
|
||||
bh_unlock_sock(sk);
|
||||
trace_tcp_bad_csum(skb);
|
||||
__TCP_INC_STATS(sock_net(sk), TCP_MIB_CSUMERRORS);
|
||||
__TCP_INC_STATS(sock_net(sk), TCP_MIB_INERRS);
|
||||
return true;
|
||||
@@ -2098,6 +2100,7 @@ no_tcp_socket:
|
||||
|
||||
if (tcp_checksum_complete(skb)) {
|
||||
csum_error:
|
||||
trace_tcp_bad_csum(skb);
|
||||
__TCP_INC_STATS(net, TCP_MIB_CSUMERRORS);
|
||||
bad_packet:
|
||||
__TCP_INC_STATS(net, TCP_MIB_INERRS);
|
||||
|
||||
Reference in New Issue
Block a user