소스 검색

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)
Henning Westerholt 3 년 전
부모
커밋
2b5b3a7fb5
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      src/modules/tm/timer.c

+ 5 - 0
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