diff options
author | Dimitri Staessens <dmarc-noreply@freelists.org> | 2025-07-13 07:42:58 +0200 |
---|---|---|
committer | Sander Vrijders <sander@ouroboros.rocks> | 2025-07-16 08:34:17 +0200 |
commit | 2e505c2dc7a7e849fe7a327f9cbdfc587477a3d1 (patch) | |
tree | c303098450a9a361d3d16738a78cbfdc452326f6 /src/ipcpd/unicast/dir | |
parent | 589e273a446cdcec7e9c5e3a85256b7b8554e4f0 (diff) | |
download | ouroboros-2e505c2dc7a7e849fe7a327f9cbdfc587477a3d1.tar.gz ouroboros-2e505c2dc7a7e849fe7a327f9cbdfc587477a3d1.zip |
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 <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/ipcpd/unicast/dir')
-rw-r--r-- | src/ipcpd/unicast/dir/dht.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/ipcpd/unicast/dir/dht.c b/src/ipcpd/unicast/dir/dht.c index 95c5f19a..483570e8 100644 --- a/src/ipcpd/unicast/dir/dht.c +++ b/src/ipcpd/unicast/dir/dht.c @@ -439,6 +439,12 @@ static void cancel_req_destroy(void * o) static void kad_req_destroy(struct kad_req * req) { + struct timespec t; + struct timespec intv = TIMESPEC_INIT_S(20); + + clock_gettime(PTHREAD_COND_CLOCK, &t); + ts_add(&t, &intv, &t); + assert(req); pthread_mutex_lock(&req->lock); @@ -464,7 +470,7 @@ static void kad_req_destroy(struct kad_req * req) pthread_cleanup_push(cancel_req_destroy, req); while (req->state != REQ_NULL && req->state != REQ_DONE) - pthread_cond_wait(&req->cond, &req->lock); + pthread_cond_timedwait(&req->cond, &req->lock, &t); pthread_cleanup_pop(true); } @@ -497,7 +503,7 @@ static int kad_req_wait(struct kad_req * req, case REQ_DESTROY: ret = -1; req->state = REQ_NULL; - pthread_cond_signal(&req->cond); + pthread_cond_broadcast(&req->cond); break; case REQ_PENDING: /* ETIMEDOUT */ case REQ_RESPONSE: @@ -518,7 +524,7 @@ static void kad_req_respond(struct kad_req * req) pthread_mutex_lock(&req->lock); req->state = REQ_RESPONSE; - pthread_cond_signal(&req->cond); + pthread_cond_broadcast(&req->cond); pthread_mutex_unlock(&req->lock); } @@ -886,10 +892,9 @@ static void lookup_update(struct dht * dht, struct contact * d; d = list_last_entry(&lu->contacts, struct contact, next); + list_add_tail(&c->next, p); list_del(&d->next); - assert(lu->contacts.prv != &d->next); contact_destroy(d); - list_add_tail(&c->next, p); mod = true; } } |