Commit 5c5ec668 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

net/tls: add TlsDecryptError stat

Add a statistic for TLS record decryption errors.

Since devices are supposed to pass records as-is when they
encounter errors this statistic will count bad records in
both pure software and inline crypto configurations.
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b32fd3cc
...@@ -233,3 +233,6 @@ TLS implementation exposes the following per-namespace statistics ...@@ -233,3 +233,6 @@ TLS implementation exposes the following per-namespace statistics
- ``TlsTxDevice``, ``TlsRxDevice`` - - ``TlsTxDevice``, ``TlsRxDevice`` -
number of TX and RX sessions opened with NIC cryptography number of TX and RX sessions opened with NIC cryptography
- ``TlsDecryptError`` -
record decryption failed (e.g. due to incorrect authentication tag)
...@@ -335,6 +335,7 @@ enum ...@@ -335,6 +335,7 @@ enum
LINUX_MIB_TLSRXSW, /* TlsRxSw */ LINUX_MIB_TLSRXSW, /* TlsRxSw */
LINUX_MIB_TLSTXDEVICE, /* TlsTxDevice */ LINUX_MIB_TLSTXDEVICE, /* TlsTxDevice */
LINUX_MIB_TLSRXDEVICE, /* TlsRxDevice */ LINUX_MIB_TLSRXDEVICE, /* TlsRxDevice */
LINUX_MIB_TLSDECRYPTERROR, /* TlsDecryptError */
__LINUX_MIB_TLSMAX __LINUX_MIB_TLSMAX
}; };
......
...@@ -15,6 +15,7 @@ static const struct snmp_mib tls_mib_list[] = { ...@@ -15,6 +15,7 @@ static const struct snmp_mib tls_mib_list[] = {
SNMP_MIB_ITEM("TlsRxSw", LINUX_MIB_TLSRXSW), SNMP_MIB_ITEM("TlsRxSw", LINUX_MIB_TLSRXSW),
SNMP_MIB_ITEM("TlsTxDevice", LINUX_MIB_TLSTXDEVICE), SNMP_MIB_ITEM("TlsTxDevice", LINUX_MIB_TLSTXDEVICE),
SNMP_MIB_ITEM("TlsRxDevice", LINUX_MIB_TLSRXDEVICE), SNMP_MIB_ITEM("TlsRxDevice", LINUX_MIB_TLSRXDEVICE),
SNMP_MIB_ITEM("TlsDecryptError", LINUX_MIB_TLSDECRYPTERROR),
SNMP_MIB_SENTINEL SNMP_MIB_SENTINEL
}; };
......
...@@ -168,6 +168,9 @@ static void tls_decrypt_done(struct crypto_async_request *req, int err) ...@@ -168,6 +168,9 @@ static void tls_decrypt_done(struct crypto_async_request *req, int err)
/* Propagate if there was an err */ /* Propagate if there was an err */
if (err) { if (err) {
if (err == -EBADMSG)
TLS_INC_STATS(sock_net(skb->sk),
LINUX_MIB_TLSDECRYPTERROR);
ctx->async_wait.err = err; ctx->async_wait.err = err;
tls_err_abort(skb->sk, err); tls_err_abort(skb->sk, err);
} else { } else {
...@@ -253,6 +256,8 @@ static int tls_do_decryption(struct sock *sk, ...@@ -253,6 +256,8 @@ static int tls_do_decryption(struct sock *sk,
return ret; return ret;
ret = crypto_wait_req(ret, &ctx->async_wait); ret = crypto_wait_req(ret, &ctx->async_wait);
} else if (ret == -EBADMSG) {
TLS_INC_STATS(sock_net(sk), LINUX_MIB_TLSDECRYPTERROR);
} }
if (async) if (async)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment