From 7574057e242ba9af182a57958003693f23dca3a3 Mon Sep 17 00:00:00 2001 From: dirkbro Date: Wed, 3 Dec 2025 11:31:40 +0100 Subject: [PATCH] b2b_logic: fix duplicate out_sdp serialization When packing B2B entities for cluster replication in b2bl_entity_pack(), the out_sdp field is currently serialized twice: // Around line 133 (packing) if (event_type == B2B_EVENT_CREATE) { ... bin_push_str(storage, &entity->hdrs); bin_push_str(storage, &entity->out_sdp); // First time bin_push_str(storage, &entity->dlginfo->callid); bin_push_str(storage, &entity->dlginfo->fromtag); bin_push_str(storage, &entity->dlginfo->totag); } bin_push_str(storage, &entity->out_sdp); // Second time - remove this However, in receive_entity_create(), out_sdp is deserialized only once, with the expected sequence being: // Around line 344 (unpacking) bin_pop_str(storage, &hdrs); bin_pop_str(storage, &sdp); ... bin_pop_str(storage, &dlginfo.callid); bin_pop_str(storage, &dlginfo.fromtag); bin_pop_str(storage, &dlginfo.totag); Because the pack side writes out_sdp twice but the unpack side reads it only once, the binary stream becomes misaligned and all subsequent fields are read from the wrong offset. In clustered deployments this corrupts the reconstructed entity, including entity->no, which leads to errors such as: ERROR:b2b_logic:receive_entity_create: Bad entity bridge no [21349] for tuple [549.0] --- modules/b2b_logic/entity_storage.c | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/b2b_logic/entity_storage.c b/modules/b2b_logic/entity_storage.c index 59a19bdb4b0..963ef9235e4 100644 --- a/modules/b2b_logic/entity_storage.c +++ b/modules/b2b_logic/entity_storage.c @@ -138,7 +138,6 @@ static void pack_entity(b2bl_tuple_t* tuple, enum b2b_entity_type entity_type, bin_push_str(storage, &entity->from_uri); bin_push_str(storage, &entity->from_dname); bin_push_str(storage, &entity->hdrs); - bin_push_str(storage, &entity->out_sdp); bin_push_str(storage, &entity->dlginfo->callid); bin_push_str(storage, &entity->dlginfo->fromtag);