From 343f452c15e0c25b779e637137ada4fb92d01012 Mon Sep 17 00:00:00 2001 From: Liviu Chircu Date: Mon, 3 Feb 2025 17:35:36 +0200 Subject: [PATCH] usrloc cluster: Include rec.kv_storage in AoR replication Addresses the following mid-registrar errors: ERROR:mid_registrar:unregister_record: 'from' key not found, skipping De-REGISTER ERROR:mid_registrar:mid_reg_aor_event: failed to unregister contact Many thanks to Denys Pozniak for reporting and helping with testing! --- modules/usrloc/ul_cluster.c | 14 +++++++++++++- modules/usrloc/ul_cluster.h | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/modules/usrloc/ul_cluster.c b/modules/usrloc/ul_cluster.c index a2b7c57bcc..d32de07e8a 100644 --- a/modules/usrloc/ul_cluster.c +++ b/modules/usrloc/ul_cluster.c @@ -69,10 +69,16 @@ int ul_init_cluster(void) static inline void bin_push_urecord(bin_packet_t *packet, urecord_t *r) { + str st; + bin_push_str(packet, r->domain); bin_push_str(packet, &r->aor); bin_push_int(packet, r->label); bin_push_int(packet, r->next_clabel); + + st = store_serialize(r->kv_storage); + bin_push_str(packet, &st); + store_free_buffer(&st); } void replicate_urecord_insert(urecord_t *r) @@ -420,10 +426,11 @@ void replicate_ucontact_delete(urecord_t *r, ucontact_t *c, */ static int receive_urecord_insert(bin_packet_t *packet) { - str d, aor; + str d, aor, kv_str; urecord_t *r; udomain_t *domain; int sl; + short pkg_ver = get_bin_pkg_version(packet); bin_pop_str(packet, &d); bin_pop_str(packet, &aor); @@ -454,6 +461,11 @@ static int receive_urecord_insert(bin_packet_t *packet) if (domain->table[sl].next_label <= r->label) domain->table[sl].next_label = r->label + 1; + if (pkg_ver >= UL_BIN_V5) { + bin_pop_str(packet, &kv_str); + r->kv_storage = store_deserialize(&kv_str); + } + out: unlock_udomain(domain, &aor); diff --git a/modules/usrloc/ul_cluster.h b/modules/usrloc/ul_cluster.h index 43e7b482ca..8caf2c51a9 100644 --- a/modules/usrloc/ul_cluster.h +++ b/modules/usrloc/ul_cluster.h @@ -41,7 +41,8 @@ #define UL_BIN_V2 2 #define UL_BIN_V3 3 // added "cmatch" (default: CT_MATCH_CONTACT_CALLID) #define UL_BIN_V4 4 // changed 'ct.cflags' from int bitmask to string repr -#define UL_BIN_VERSION UL_BIN_V4 +#define UL_BIN_V5 5 // added 'r.kv_storage' to AoR INSERT packets +#define UL_BIN_VERSION UL_BIN_V5 extern int location_cluster; extern struct clusterer_binds clusterer_api;