summaryrefslogtreecommitdiff
path: root/src/irmd/main.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2026-05-01 23:41:49 +0200
committerSander Vrijders <sander@ouroboros.rocks>2026-05-20 08:17:05 +0200
commit2ddcad3989cd8d2314453ed31ff43e122118663f (patch)
tree201cbde8ccb850021ab54d1331a7c8ec3558793c /src/irmd/main.c
parent44ca111c2b9cf45491edc99062f89c89060525ae (diff)
downloadouroboros-2ddcad3989cd8d2314453ed31ff43e122118663f.tar.gz
ouroboros-2ddcad3989cd8d2314453ed31ff43e122118663f.zip
irmd: Drop replayed flow alloc requests
A duplicating link could deliver the same alloc request twice. OAP detected the replay but still replied over the wire, so the requester saw a second flow_alloc_reply on an already-allocated flow and reg_respond_alloc tripped its PENDING-state assertion. Add EREPLAY so the OAP server can signal replays distinctly; flow_accept drops them silently. As a safety net, reg_respond_alloc warn-drops late replies instead of asserting. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/irmd/main.c')
-rw-r--r--src/irmd/main.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c
index a85a9bf0..5a6245e0 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -910,6 +910,10 @@ static int flow_accept(struct flow_info * flow,
flow->uid = reg_get_proc_uid(flow->n_pid);
err = oap_srv_process(&info, req_hdr, &resp_hdr, data, sk);
+ if (err == -EREPLAY) {
+ log_warn("Dropping replayed alloc request for %s.", name);
+ goto fail_replay;
+ }
if (err < 0) {
log_err("OAP processing failed for %s.", name);
goto fail_oap;
@@ -938,6 +942,9 @@ static int flow_accept(struct flow_info * flow,
fail_oap:
if (!reg_flow_is_direct(flow->id))
ipcp_flow_alloc_resp(flow, err, resp_hdr);
+ fail_replay:
+ freebuf(req_hdr);
+ freebuf(resp_hdr);
fail_wait:
reg_destroy_flow(flow->id);
fail_flow: