Browse code

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

Henning Westerholt authored on 19/08/2022 13:17:46
Showing 1 changed files
... ...
@@ -360,6 +360,7 @@ inline static void final_response_handler(
360 360
 	int branch_ret;
361 361
 	int prev_branch;
362 362
 	ticks_t now;
363
+	tm_xlinks_t backup_xd;
363 364
 #endif
364 365
 
365 366
 #ifdef EXTRA_DEBUG
... ...
@@ -450,11 +451,15 @@ inline static void final_response_handler(
450 451
 				branch_ret = add_uac_dns_fallback(
451 452
 						t, t->uas.request, &t->uac[r_buf->branch], 0);
452 453
 				prev_branch = -1;
454
+				/* restore X/AVP values from initial transaction */
455
+				tm_xdata_swap(t, &backup_xd, 0);
453 456
 				while((branch_ret >= 0) && (branch_ret != prev_branch)) {
454 457
 					prev_branch = branch_ret;
455 458
 					branch_ret =
456 459
 							t_send_branch(t, branch_ret, t->uas.request, 0, 0);
457 460
 				}
461
+				/* restore X/AVP values from backup data */
462
+				tm_xdata_swap(t, &backup_xd, 1);
458 463
 			}
459 464
 		}
460 465
 #endif