[sr-dev] git:master:45948fc9: tm: proper location of last rr for strict routing on local requests

Daniel-Constantin Mierla miconda at gmail.com
Thu Jul 20 09:32:09 CEST 2017


Module: kamailio
Branch: master
Commit: 45948fc933f99e6a960b835069b7e29d1ea788be
URL: https://github.com/kamailio/kamailio/commit/45948fc933f99e6a960b835069b7e29d1ea788be

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-20T09:31:49+02:00

tm: proper location of last rr for strict routing on local requests

---

Modified: src/modules/tm/t_fwd.c
Modified: src/modules/tm/t_msgbuilder.c

---

Diff:  https://github.com/kamailio/kamailio/commit/45948fc933f99e6a960b835069b7e29d1ea788be.diff
Patch: https://github.com/kamailio/kamailio/commit/45948fc933f99e6a960b835069b7e29d1ea788be.patch

---

diff --git a/src/modules/tm/t_fwd.c b/src/modules/tm/t_fwd.c
index ac55e3a4f8..df9eef4f49 100644
--- a/src/modules/tm/t_fwd.c
+++ b/src/modules/tm/t_fwd.c
@@ -1190,7 +1190,7 @@ static struct cancel_reason* cancel_reason_pack(short cause, void* data,
 		} else if (cause == CANCEL_REAS_PACKED_HDRS &&
 				!(t->flags & T_NO_E2E_CANCEL_REASON) && data) {
 			txt = (str*) data;
-			reason_len = txt?txt->len:0;
+			reason_len = txt->len;
 		} else if (unlikely(cause < CANCEL_REAS_MIN)) {
 			LM_CRIT("unhandled reason cause %d\n", cause);
 			goto error;
diff --git a/src/modules/tm/t_msgbuilder.c b/src/modules/tm/t_msgbuilder.c
index 3d634540e6..3bd76b32fe 100644
--- a/src/modules/tm/t_msgbuilder.c
+++ b/src/modules/tm/t_msgbuilder.c
@@ -1004,7 +1004,7 @@ static int eval_uac_routing(sip_msg_t *rpl, const struct retr_buf *inv_rb,
 			/* find ptr to last route body that contains the (possibly) old
 			 * remote target
 			 */
-			for (t = rtset, prev_t = t; t->next; prev_t = t, t = t->next)
+			for (t = rtset, prev_t = NULL; t->next; prev_t = t, t = t->next)
 				;
 			if ((t->ptr->len == contact->len) &&
 					(memcmp(t->ptr->nameaddr.name.s, contact->s,
@@ -1022,7 +1022,7 @@ static int eval_uac_routing(sip_msg_t *rpl, const struct retr_buf *inv_rb,
 				if (! (t = pkg_malloc(chklen))) {
 					ERR("out of pkg memory (%d required)\n", (int)chklen);
 					/* last element was freed, unlink it */
-					if(prev_t == rtset) {
+					if(prev_t == NULL) {
 						/* there is only one elem in route set: the remote target */
 						rtset = NULL;
 					} else {
@@ -1036,7 +1036,7 @@ static int eval_uac_routing(sip_msg_t *rpl, const struct retr_buf *inv_rb,
 				((rr_t *)&t[1])->nameaddr.name = *contact;
 				((rr_t *)&t[1])->len = contact->len;
 				/* chain the new route elem in set */
-				if (prev_t == rtset)
+				if (prev_t == NULL)
 					/* there is only one elem in route set: the remote target */
 					rtset = t;
 				else




More information about the sr-dev mailing list