From 0e1073f622c52c10f859b812506e807bd8ad1bfb Mon Sep 17 00:00:00 2001 From: John Safranek Date: Wed, 17 Jul 2019 16:08:23 -0700 Subject: [PATCH] Sniffer Statistics Addded two more statistics, cache hits and cache inserts. --- src/sniffer.c | 7 ++++++- wolfssl/sniffer.h | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/sniffer.c b/src/sniffer.c index 52c9dfc07..1f2c44479 100644 --- a/src/sniffer.c +++ b/src/sniffer.c @@ -2125,6 +2125,7 @@ static int ProcessServerHello(int msgSz, const byte* input, int* sslBytes, Trace(SERVER_DID_RESUMPTION_STR); #ifdef WOLFSSL_SNIFFER_STATS INC_STAT(SnifferStats.sslResumedConns); + INC_STAT(SnifferStats.sslResumptionValid); #endif if (SetCipherSpecs(session->sslServer) != 0) { SetError(BAD_CIPHER_SPEC_STR, error, session, FATAL_ERROR_STATE); @@ -2464,8 +2465,12 @@ static int ProcessFinished(const byte* input, int size, int* sslBytes, if (ret == 0 && session->flags.cached == 0) { if (session->sslServer->options.haveSessionId) { WOLFSSL_SESSION* sess = GetSession(session->sslServer, NULL, 0); - if (sess == NULL) + if (sess == NULL) { AddSession(session->sslServer); /* don't re add */ +#ifdef WOLFSSL_SNIFFER_STATS + INC_STAT(SnifferStats.sslResumptionInserts); +#endif + } session->flags.cached = 1; } } diff --git a/wolfssl/sniffer.h b/wolfssl/sniffer.h index bf2306e11..fedab6c06 100644 --- a/wolfssl/sniffer.h +++ b/wolfssl/sniffer.h @@ -152,6 +152,9 @@ typedef struct SSLStats unsigned long int sslDecryptedPackets; unsigned long int sslKeyMatches; unsigned long int sslEncryptedConns; + + unsigned long int sslResumptionValid; + unsigned long int sslResumptionInserts; } SSLStats;