From 2e505c2dc7a7e849fe7a327f9cbdfc587477a3d1 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sun, 13 Jul 2025 07:42:58 +0200 Subject: irmd: Initial Flow Allocation Protocol Header This adds the initial version for the flow allocation protocol header between IRMd instances. This is a step towards flow authentication. The header supports secure and authenticated flow allocation, supporting certificate-based authentication and ephemeral key exchange for end-to-end encryption. id: 128-bit identifier for the entity. timestamp: 64-bit timestamp (replay protection). certificate: Certificate for authentication. public key: ECDHE public key for key exchange. data: Application data. signature: Signature for integrity/authenticity. Authentication and encryption require OpenSSL to be installed. The IRMd compares the allocation request delay with the MPL of the Layer over which the flow allocation was sent. MPL is now reported by the Layer in ms instead of seconds. Time functions revised for consistency and adds some tests. The TPM can now print thread running times in Debug builds (TPM_DEBUG_REPORT_INTERVAL) and abort processes with hung threads (TPM_DEBUG_ABORT_TIMEOUT). Long running threads waiting for input should call tpm_wait_work() to avoid trigger a process abort. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/tools/operf/operf_client.c | 6 +++--- src/tools/operf/operf_server.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/tools/operf') diff --git a/src/tools/operf/operf_client.c b/src/tools/operf/operf_client.c index 63f98299..7060ce5b 100644 --- a/src/tools/operf/operf_client.c +++ b/src/tools/operf/operf_client.c @@ -133,7 +133,7 @@ void * writer(void * o) clock_gettime(CLOCK_REALTIME, &start); clock_gettime(CLOCK_REALTIME, &now); - while (!stop && ts_diff_ms(&start, &now) < client.duration) { + while (!stop && ts_diff_ms(&now, &start) > client.duration) { if (!client.flood) { clock_gettime(CLOCK_REALTIME, &now); ts_add(&now, &intv, &end); @@ -230,10 +230,10 @@ int client_main(void) printf("%ld received, ", client.rcvd); printf("%ld%% packet loss, ", client.sent == 0 ? 0 : 100 - ((100 * client.rcvd) / client.sent)); - printf("time: %.3f ms, ", ts_diff_us(&tic, &toc) / 1000.0); + printf("time: %.3f ms, ", ts_diff_us(&toc, &tic) / 1000.0); printf("bandwidth: %.3lf Mb/s.\n", (client.rcvd * client.size * 8) - / (double) ts_diff_us(&tic, &toc)); + / (double) ts_diff_us(&toc, &tic)); } flow_dealloc(fd); diff --git a/src/tools/operf/operf_server.c b/src/tools/operf/operf_server.c index d11f3486..a611f79c 100644 --- a/src/tools/operf/operf_server.c +++ b/src/tools/operf/operf_server.c @@ -66,7 +66,7 @@ void * cleaner_thread(void * o) pthread_mutex_lock(&server.lock); for (i = 0; i < OPERF_MAX_FLOWS; ++i) if (fset_has(server.flows, i) && - ts_diff_ms(&server.times[i], &now) + ts_diff_ms(&now, &server.times[i]) > server.timeout) { printf("Flow %d timed out.\n", i); fset_del(server.flows, i); -- cgit v1.2.3