[sr-dev] git:master:399b34c6: tm: backup and restore X/AVP values from initial transaction in DNS failover processing

Henning Westerholt hw at gilawa.com
Fri Aug 19 15:29:03 CEST 2022


Module: kamailio
Branch: master
Commit: 399b34c6bd4e5cbfcf4dcb699755c393229fcb99
URL: https://github.com/kamailio/kamailio/commit/399b34c6bd4e5cbfcf4dcb699755c393229fcb99

Author: Henning Westerholt <hw at gilawa.com>
Committer: Henning Westerholt <hw at gilawa.com>
Date: 2022-08-19T13:17:46Z

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

---

Modified: src/modules/tm/timer.c

---

Diff:  https://github.com/kamailio/kamailio/commit/399b34c6bd4e5cbfcf4dcb699755c393229fcb99.diff
Patch: https://github.com/kamailio/kamailio/commit/399b34c6bd4e5cbfcf4dcb699755c393229fcb99.patch

---

diff --git a/src/modules/tm/timer.c b/src/modules/tm/timer.c
index a662920cab..4c821ba871 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




More information about the sr-dev mailing list