mirror of
https://github.com/outbackdingo/nDPId.git
synced 2026-01-27 10:19:45 +00:00
Added some stats printing to c-decrypt
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
@@ -132,6 +132,21 @@ int udp_server(struct ncrypt * const nc)
|
||||
if ((msgs_recvd % 25) == 0)
|
||||
{
|
||||
printf("*** Messages received: %zu ***\n", msgs_recvd);
|
||||
struct peer * current_peer;
|
||||
struct peer * ctmp;
|
||||
HASH_ITER(hh, nc->peers, current_peer, ctmp)
|
||||
{
|
||||
printf(
|
||||
"*** Peer: %8X | Cryptions: %5zu | Crypto Errors: %2zu | IV Mismatches: %2zu | Send Errors: "
|
||||
"%2zu | "
|
||||
"Partial Writes: %2zu ***\n",
|
||||
current_peer->hash_key,
|
||||
current_peer->cryptions,
|
||||
current_peer->crypto_errors,
|
||||
current_peer->iv_mismatches,
|
||||
current_peer->send_errors,
|
||||
current_peer->partial_writes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
2
ncrypt.c
2
ncrypt.c
@@ -554,6 +554,7 @@ int ncrypt_dgram_send(struct ncrypt * const nc, int fd, char const * const plain
|
||||
retval++;
|
||||
continue;
|
||||
}
|
||||
current_peer->cryptions++;
|
||||
|
||||
memcpy(encrypted.iv, current_peer->iv, NCRYPT_AES_IVLEN);
|
||||
ssize_t bytes_written = sendto(fd,
|
||||
@@ -629,6 +630,7 @@ int ncrypt_dgram_recv(struct ncrypt * const nc, int fd, char * const plaintext,
|
||||
{
|
||||
return -6;
|
||||
}
|
||||
peer->cryptions++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
2
ncrypt.h
2
ncrypt.h
@@ -24,10 +24,10 @@ struct peer
|
||||
nDPIsrvd_hashkey hash_key;
|
||||
struct nDPIsrvd_address address;
|
||||
unsigned char iv[NCRYPT_AES_IVLEN];
|
||||
size_t cryptions;
|
||||
size_t crypto_errors;
|
||||
size_t iv_mismatches;
|
||||
size_t send_errors;
|
||||
size_t recv_errors;
|
||||
size_t partial_writes;
|
||||
struct aes aes;
|
||||
UT_hash_handle hh;
|
||||
|
||||
Reference in New Issue
Block a user