Module: kamailio Branch: 5.6 Commit: 2b5b3a7fb5a26dc467a60e5e70c8b3515f57bc85 URL: https://github.com/kamailio/kamailio/commit/2b5b3a7fb5a26dc467a60e5e70c8b351...
Author: Henning Westerholt hw@gilawa.com Committer: Henning Westerholt hw@gilawa.com Date: 2022-11-29T10:30:36Z
tm: backup and restore X/AVP values from initial transaction in DNS failover processing
- restore X/AVP values from initial transaction in DNS failover processing - the X/AVP context gets lost, so we need to re-create it from the transaction - otherwise modules that depends on the X/AVPs, e.g. topology hiding will not work - tested with one load-balancer and two proxy servers - previous fix d6b1c20d3ad94 was reverted, we now properly backup and restore
(cherry picked from commit 399b34c6bd4e5cbfcf4dcb699755c393229fcb99)
---
Modified: src/modules/tm/timer.c
---
Diff: https://github.com/kamailio/kamailio/commit/2b5b3a7fb5a26dc467a60e5e70c8b351... Patch: https://github.com/kamailio/kamailio/commit/2b5b3a7fb5a26dc467a60e5e70c8b351...
---
diff --git a/src/modules/tm/timer.c b/src/modules/tm/timer.c index a662920cab3..4c821ba871f 100644 --- a/src/modules/tm/timer.c +++ b/src/modules/tm/timer.c @@ -360,6 +360,7 @@ inline static void final_response_handler( int branch_ret; int prev_branch; ticks_t now; + tm_xlinks_t backup_xd; #endif
#ifdef EXTRA_DEBUG @@ -450,11 +451,15 @@ inline static void final_response_handler( branch_ret = add_uac_dns_fallback( t, t->uas.request, &t->uac[r_buf->branch], 0); prev_branch = -1; + /* restore X/AVP values from initial transaction */ + tm_xdata_swap(t, &backup_xd, 0); while((branch_ret >= 0) && (branch_ret != prev_branch)) { prev_branch = branch_ret; branch_ret = t_send_branch(t, branch_ret, t->uas.request, 0, 0); } + /* restore X/AVP values from backup data */ + tm_xdata_swap(t, &backup_xd, 1); } } #endif