tcp: md5: add LINUX_MIB_TCPMD5FAILURE counter
authorEric Dumazet <edumazet@google.com>
Wed, 24 Aug 2016 16:01:23 +0000 (09:01 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 25 Aug 2016 23:43:11 +0000 (16:43 -0700)
Adds SNMP counter for drops caused by MD5 mismatches.

The current syslog might help, but a counter is more precise and helps
monitoring.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/uapi/linux/snmp.h
net/ipv4/proc.c
net/ipv4/tcp_ipv4.c
net/ipv6/tcp_ipv6.c

index 25a9ad8bcef1240915f2553a8acade447186d869..e7a31f8306903f53bc5881ae4c271f85cad2e361 100644 (file)
@@ -235,6 +235,7 @@ enum
        LINUX_MIB_TCPSPURIOUSRTOS,              /* TCPSpuriousRTOs */
        LINUX_MIB_TCPMD5NOTFOUND,               /* TCPMD5NotFound */
        LINUX_MIB_TCPMD5UNEXPECTED,             /* TCPMD5Unexpected */
+       LINUX_MIB_TCPMD5FAILURE,                /* TCPMD5Failure */
        LINUX_MIB_SACKSHIFTED,
        LINUX_MIB_SACKMERGED,
        LINUX_MIB_SACKSHIFTFALLBACK,
index 9f665b63a927202b9aaf2b6b3d42205058a2ae59..1ed015e4bc792acdd520a5df95ffac33ebefc4db 100644 (file)
@@ -257,6 +257,7 @@ static const struct snmp_mib snmp4_net_list[] = {
        SNMP_MIB_ITEM("TCPSpuriousRTOs", LINUX_MIB_TCPSPURIOUSRTOS),
        SNMP_MIB_ITEM("TCPMD5NotFound", LINUX_MIB_TCPMD5NOTFOUND),
        SNMP_MIB_ITEM("TCPMD5Unexpected", LINUX_MIB_TCPMD5UNEXPECTED),
+       SNMP_MIB_ITEM("TCPMD5Failure", LINUX_MIB_TCPMD5FAILURE),
        SNMP_MIB_ITEM("TCPSackShifted", LINUX_MIB_SACKSHIFTED),
        SNMP_MIB_ITEM("TCPSackMerged", LINUX_MIB_SACKMERGED),
        SNMP_MIB_ITEM("TCPSackShiftFallback", LINUX_MIB_SACKSHIFTFALLBACK),
index 436d978c6c3955dfa9a55f86b1412624ba2ed9fa..ad41e8ecf796bba1bd6d9ed155ca4a57ced96844 100644 (file)
@@ -1169,6 +1169,7 @@ static bool tcp_v4_inbound_md5_hash(const struct sock *sk,
                                      NULL, skb);
 
        if (genhash || memcmp(hash_location, newhash, 16) != 0) {
+               NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMD5FAILURE);
                net_info_ratelimited("MD5 Hash failed for (%pI4, %d)->(%pI4, %d)%s\n",
                                     &iph->saddr, ntohs(th->source),
                                     &iph->daddr, ntohs(th->dest),
index ac0ed7bda4067a2630cc1cbb546ced3f3ded4c2c..e4f55683af314438da8a09473927213a140e6e5c 100644 (file)
@@ -671,6 +671,7 @@ static bool tcp_v6_inbound_md5_hash(const struct sock *sk,
                                      NULL, skb);
 
        if (genhash || memcmp(hash_location, newhash, 16) != 0) {
+               NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMD5FAILURE);
                net_info_ratelimited("MD5 Hash %s for [%pI6c]:%u->[%pI6c]:%u\n",
                                     genhash ? "failed" : "mismatch",
                                     &ip6h->saddr, ntohs(th->source),