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

Daniel-Constantin Mierla miconda at gmail.com
Thu Aug 11 10:46:37 CEST 2022


Hello,

I haven't looked in the code to try to figure out the execution paths to
this function and where ends up afterwards, so more for safety: have you
checked that there are no other X/AVPs set at that moment, or if they
are they are restored later?

Usually when setting x/avps lists, the old ones have to be restored in
order to be sure it does not end up in memory leaks (or the old ones
have to be cleaned up).

Cheers,
Daniel

On 09.08.22 16:16, Henning Westerholt wrote:
> Module: kamailio
> Branch: master
> Commit: d6b1c20d3ad94d9136cf247e67b7fc0d32b18d3b
> URL: https://github.com/kamailio/kamailio/commit/d6b1c20d3ad94d9136cf247e67b7fc0d32b18d3b
>
> Author: Henning Westerholt <hw at gilawa.com>
> Committer: Henning Westerholt <hw at gilawa.com>
> Date: 2022-08-09T14:11:59Z
>
> tm: 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
>
> ---
>
> Modified: src/modules/tm/t_fwd.c
>
> ---
>
> Diff:  https://github.com/kamailio/kamailio/commit/d6b1c20d3ad94d9136cf247e67b7fc0d32b18d3b.diff
> Patch: https://github.com/kamailio/kamailio/commit/d6b1c20d3ad94d9136cf247e67b7fc0d32b18d3b.patch
>
> ---
>
> diff --git a/src/modules/tm/t_fwd.c b/src/modules/tm/t_fwd.c
> index fbcf1b3e02..6b26f28f6a 100644
> --- a/src/modules/tm/t_fwd.c
> +++ b/src/modules/tm/t_fwd.c
> @@ -1042,6 +1042,8 @@ int add_uac_dns_fallback(struct cell *t, struct sip_msg* msg,
>  		t->uac[t->nr_of_outgoings].on_branch_failure = old_uac->on_branch_failure;
>  		/* copy branch flags */
>  		t->uac[t->nr_of_outgoings].branch_flags = old_uac->branch_flags;
> +		/* restore X/AVP values from initial transaction */
> +		tm_xdata_swap(t, 0, 0);
>  
>  		if (cfg_get(tm, tm_cfg, reparse_on_dns_failover)){
>  			/* Reuse the old buffer and only replace the via header.
>
>
> _______________________________________________
> Kamailio (SER) - Development Mailing List
> sr-dev at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda




More information about the sr-dev mailing list