mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
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>
This commit is contained in:
parent
f233a976ad
commit
6a5dc9e598
12 changed files with 72 additions and 28 deletions
|
@ -1866,6 +1866,7 @@ discard:
|
|||
return 0;
|
||||
|
||||
csum_err:
|
||||
TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_CSUMERRORS);
|
||||
TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_INERRS);
|
||||
goto discard;
|
||||
}
|
||||
|
@ -1985,7 +1986,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
|
|||
* provided case of th->doff==0 is eliminated.
|
||||
* So, we defer the checks. */
|
||||
if (!skb_csum_unnecessary(skb) && tcp_v4_checksum_init(skb))
|
||||
goto bad_packet;
|
||||
goto csum_error;
|
||||
|
||||
th = tcp_hdr(skb);
|
||||
iph = ip_hdr(skb);
|
||||
|
@ -2051,6 +2052,8 @@ no_tcp_socket:
|
|||
goto discard_it;
|
||||
|
||||
if (skb->len < (th->doff << 2) || tcp_checksum_complete(skb)) {
|
||||
csum_error:
|
||||
TCP_INC_STATS_BH(net, TCP_MIB_CSUMERRORS);
|
||||
bad_packet:
|
||||
TCP_INC_STATS_BH(net, TCP_MIB_INERRS);
|
||||
} else {
|
||||
|
@ -2072,10 +2075,13 @@ do_time_wait:
|
|||
goto discard_it;
|
||||
}
|
||||
|
||||
if (skb->len < (th->doff << 2) || tcp_checksum_complete(skb)) {
|
||||
TCP_INC_STATS_BH(net, TCP_MIB_INERRS);
|
||||
if (skb->len < (th->doff << 2)) {
|
||||
inet_twsk_put(inet_twsk(sk));
|
||||
goto discard_it;
|
||||
goto bad_packet;
|
||||
}
|
||||
if (tcp_checksum_complete(skb)) {
|
||||
inet_twsk_put(inet_twsk(sk));
|
||||
goto csum_error;
|
||||
}
|
||||
switch (tcp_timewait_state_process(inet_twsk(sk), skb, th)) {
|
||||
case TCP_TW_SYN: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue