diff --git a/examples/c-decrypt/c-decrypt.c b/examples/c-decrypt/c-decrypt.c index 1df0974ae..2ec27fba1 100644 --- a/examples/c-decrypt/c-decrypt.c +++ b/examples/c-decrypt/c-decrypt.c @@ -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); + } } } diff --git a/ncrypt.c b/ncrypt.c index 64b4391d0..d1cdd037a 100644 --- a/ncrypt.c +++ b/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; } diff --git a/ncrypt.h b/ncrypt.h index 96db56049..504470f4c 100644 --- a/ncrypt.h +++ b/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;