Sniffer Statistics

Addded two more statistics, cache hits and cache inserts.
This commit is contained in:
John Safranek
2019-07-17 16:08:23 -07:00
parent 4292936efc
commit 0e1073f622
2 changed files with 9 additions and 1 deletions

View File

@ -2125,6 +2125,7 @@ static int ProcessServerHello(int msgSz, const byte* input, int* sslBytes,
Trace(SERVER_DID_RESUMPTION_STR); Trace(SERVER_DID_RESUMPTION_STR);
#ifdef WOLFSSL_SNIFFER_STATS #ifdef WOLFSSL_SNIFFER_STATS
INC_STAT(SnifferStats.sslResumedConns); INC_STAT(SnifferStats.sslResumedConns);
INC_STAT(SnifferStats.sslResumptionValid);
#endif #endif
if (SetCipherSpecs(session->sslServer) != 0) { if (SetCipherSpecs(session->sslServer) != 0) {
SetError(BAD_CIPHER_SPEC_STR, error, session, FATAL_ERROR_STATE); 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 (ret == 0 && session->flags.cached == 0) {
if (session->sslServer->options.haveSessionId) { if (session->sslServer->options.haveSessionId) {
WOLFSSL_SESSION* sess = GetSession(session->sslServer, NULL, 0); WOLFSSL_SESSION* sess = GetSession(session->sslServer, NULL, 0);
if (sess == NULL) if (sess == NULL) {
AddSession(session->sslServer); /* don't re add */ AddSession(session->sslServer); /* don't re add */
#ifdef WOLFSSL_SNIFFER_STATS
INC_STAT(SnifferStats.sslResumptionInserts);
#endif
}
session->flags.cached = 1; session->flags.cached = 1;
} }
} }

View File

@ -152,6 +152,9 @@ typedef struct SSLStats
unsigned long int sslDecryptedPackets; unsigned long int sslDecryptedPackets;
unsigned long int sslKeyMatches; unsigned long int sslKeyMatches;
unsigned long int sslEncryptedConns; unsigned long int sslEncryptedConns;
unsigned long int sslResumptionValid;
unsigned long int sslResumptionInserts;
} SSLStats; } SSLStats;