Module: sip-router
Branch: 3.1
Commit: 2ce5ff9c1718cc14e34cc6e19a85a30edf3d3e49
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=2ce5ff9…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Nov 24 15:30:15 2011 +0100
textops(k): free only pkg body lumps for set_body()
- if set_body() is used in failure_route, it should not destroy
completely the lumps cloned in tm, just ignore them and free the ones
added in failure_route before execution of itself
- reported by Brandon Armstead, FS#181
(cherry picked from commit c22a3ec7366ad1a3cc0b5e8229fbabe2c179cca1)
(cherry picked from commit ec8535487fd06e5de7b5efa218f764a6e850b42b)
---
modules_k/textops/textops.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/modules_k/textops/textops.c b/modules_k/textops/textops.c
index 9198f77..e02f441 100644
--- a/modules_k/textops/textops.c
+++ b/modules_k/textops/textops.c
@@ -1198,7 +1198,7 @@ static int set_body_f(struct sip_msg* msg, char* p1, char* p2)
return -1;
}
- free_lump_list(msg->body_lumps);
+ del_nonshm_lump( &(msg->body_lumps) );
msg->body_lumps = NULL;
if (msg->content_length)
Module: sip-router
Branch: 3.1
Commit: 12bf863b63b6ad66f958c350393bc90b9e63c586
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=12bf863…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Nov 24 12:56:28 2011 +0100
core: save and restore branch_iterator in print_dset
- safe usage in branch_route where branch_interator is used to add the
new brnaches, but some variables can change it if used in config
branch_route
- closes FS#182, reported by Pawel Sternal
(cherry picked from commit c5f101dfac9a50f428e3452893c402d8b1e0400b)
(cherry picked from commit d44956c4f3d5fb98bc2af42d8718a420d624d259)
---
dset.c | 21 ++++++++++++++++++++-
dset.h | 8 ++++++--
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/dset.c b/dset.c
index 1e5c9e7..f4223dc 100644
--- a/dset.c
+++ b/dset.c
@@ -191,11 +191,21 @@ void init_branch_iterator(void)
branch_iterator = 0;
}
+/**
+ * return the value of current branch iterator
+ */
int get_branch_iterator(void)
{
return branch_iterator;
}
+/**
+ * set the value of current branch interator
+ */
+void set_branch_iterator(int n)
+{
+ branch_iterator = n;
+}
/** \brief Get a branch from the destination set
@@ -371,6 +381,7 @@ char* print_dset(struct sip_msg* msg, int* len)
qvalue_t q;
str uri;
char* p, *qbuf;
+ int crt_branch;
static char dset[MAX_REDIRECTION_LEN];
if (msg->new_uri.s) {
@@ -384,6 +395,9 @@ char* print_dset(struct sip_msg* msg, int* len)
*len = 0;
}
+ /* backup current branch index to restore it later */
+ crt_branch = get_branch_iterator();
+
init_branch_iterator();
while ((uri.s = next_branch(&uri.len, &q, 0, 0, 0, 0))) {
cnt++;
@@ -399,7 +413,7 @@ char* print_dset(struct sip_msg* msg, int* len)
if (*len + 1 > MAX_REDIRECTION_LEN) {
LOG(L_ERR, "ERROR: redirection buffer length exceed\n");
- return 0;
+ goto error;
}
memcpy(dset, CONTACT, CONTACT_LEN);
@@ -450,7 +464,12 @@ char* print_dset(struct sip_msg* msg, int* len)
}
memcpy(p, CRLF " ", CRLF_LEN + 1);
+ set_branch_iterator(crt_branch);
return dset;
+
+error:
+ set_branch_iterator(crt_branch);
+ return 0;
}
diff --git a/dset.h b/dset.h
index 6f9f067..dfc3083 100644
--- a/dset.h
+++ b/dset.h
@@ -107,15 +107,19 @@ static inline int ser_append_branch(struct sip_msg* msg,
/*! \brief
- * Iterate through the list of transaction branches
+ * Init the index to iterate through the list of transaction branches
*/
void init_branch_iterator(void);
/*! \brief
- * Return branch iterator position
+ * Return branch iterator position
*/
int get_branch_iterator(void);
+/*! \brief
+ * Set branch iterator position
+ */
+void set_branch_iterator(int n);
/*! \brief Get the next branch in the current transaction.
* @return pointer to the uri of the next branch (which the length written in
Module: sip-router
Branch: 3.1
Commit: 0880578372053b2196d7d4ef21f3ef924b5bd2c7
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0880578…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Nov 17 23:14:32 2011 +0100
tm: free path if set first time in a branch route
(cherry picked from commit 7b612d999e061d05b60054e7749052d0abdf514c)
(cherry picked from commit 609b0aa86624416828c0c117e0cfdbeb7643bcb8)
---
modules/tm/t_fwd.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/modules/tm/t_fwd.c b/modules/tm/t_fwd.c
index aea7598..b874c9b 100644
--- a/modules/tm/t_fwd.c
+++ b/modules/tm/t_fwd.c
@@ -377,6 +377,10 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
ignored) */
next_hop=&i_req->dst_uri;
}
+ /* no path vector initially, but now is set after branch route and
+ * callbacks execution */
+ if(i_req->path_vec.s!=0 && free_path==0)
+ free_path=1;
}else{
/* no branch route and no TMCB_REQUEST_FWDED callback => set
msg uri and path to the new values (if needed) */