[Pkg-voip-commits] [kamailio] 02/05: add upstream fixes from 4.3 branch
Victor Seva
vseva at moszumanska.debian.org
Wed Mar 16 15:01:06 UTC 2016
This is an automated email from the git hooks/post-receive script.
vseva pushed a commit to branch master
in repository kamailio.
commit 9d9559ad850af6b26e45b5a00f3a69a92fdf7834
Author: Victor Seva <vseva at debian.org>
Date: Wed Mar 16 11:48:14 2016 +0100
add upstream fixes from 4.3 branch
---
debian/patches/series | 3 +
.../0001-usrloc-improve-TCP-close-on-expire.patch | 30 ++++++
...k-before-linking-var-to-the-entry-in-slot.patch | 79 ++++++++++++++
...ppend-to-rr-string-var-to-avoid-double-fr.patch | 120 +++++++++++++++++++++
4 files changed, 232 insertions(+)
diff --git a/debian/patches/series b/debian/patches/series
index bd738c2..52b614f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,6 @@
+upstream/0001-usrloc-improve-TCP-close-on-expire.patch
+upstream/0002-tsilo-lock-before-linking-var-to-the-entry-in-slot.patch
+upstream/0003-uac-reset-append-to-rr-string-var-to-avoid-double-fr.patch
no_lib64_on_64_bits.patch
no_INSTALL_file.patch
fix_export.patch
diff --git a/debian/patches/upstream/0001-usrloc-improve-TCP-close-on-expire.patch b/debian/patches/upstream/0001-usrloc-improve-TCP-close-on-expire.patch
new file mode 100644
index 0000000..07f7c20
--- /dev/null
+++ b/debian/patches/upstream/0001-usrloc-improve-TCP-close-on-expire.patch
@@ -0,0 +1,30 @@
+From 1c7154d832eeb51db790b84a850c5f6338619ce6 Mon Sep 17 00:00:00 2001
+From: Camille Oudot <camille.oudot at orange.com>
+Date: Thu, 10 Mar 2016 11:24:05 +0100
+Subject: [PATCH 1/3] usrloc: improve TCP close on expire
+
+this prevents the dramatic `F_TCPCONN connection marked as bad` message from
+appearing in the logs when usrloc force-closes a TCP connection
+
+(cherry picked from commit 22b3311f39c7b98ef0c36d2edd7d224e4269e43f)
+---
+ modules/usrloc/urecord.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/modules/usrloc/urecord.c b/modules/usrloc/urecord.c
+index 414a958..4b685dc 100644
+--- a/modules/usrloc/urecord.c
++++ b/modules/usrloc/urecord.c
+@@ -251,6 +251,9 @@ static inline int close_connection(int conid) {
+ msg[0] = (long)con;
+ msg[1] = CONN_EOF;
+
++ con->send_flags.f |= SND_F_CON_CLOSE;
++ con->flags |= F_CONN_FORCE_EOF;
++
+ n = send_all(unix_tcp_sock, msg, sizeof(msg));
+ if (unlikely(n <= 0)){
+ LM_ERR("failed to send close request: %s (%d)\n", strerror(errno), errno);
+--
+2.7.0
+
diff --git a/debian/patches/upstream/0002-tsilo-lock-before-linking-var-to-the-entry-in-slot.patch b/debian/patches/upstream/0002-tsilo-lock-before-linking-var-to-the-entry-in-slot.patch
new file mode 100644
index 0000000..32e21d6
--- /dev/null
+++ b/debian/patches/upstream/0002-tsilo-lock-before-linking-var-to-the-entry-in-slot.patch
@@ -0,0 +1,79 @@
+From b839aa8630ec34b312d743175f87496f6e920352 Mon Sep 17 00:00:00 2001
+From: Daniel-Constantin Mierla <miconda at gmail.com>
+Date: Mon, 14 Mar 2016 11:39:55 +0100
+Subject: [PATCH 2/3] tsilo: lock before linking var to the entry in slot
+
+- entry points to the address of first entry, which can be updated
+ before aquiring the lock
+
+(cherry picked from commit 8ae2713477027a229ae4ee7045557151e467aff3)
+(cherry picked from commit 84d73b950f3ec13fe5f5345a4440d0909e30fff4)
+---
+ modules/tsilo/ts_rpc.c | 17 ++++++++++-------
+ 1 file changed, 10 insertions(+), 7 deletions(-)
+
+diff --git a/modules/tsilo/ts_rpc.c b/modules/tsilo/ts_rpc.c
+index 20783f4..7a3b659 100644
+--- a/modules/tsilo/ts_rpc.c
++++ b/modules/tsilo/ts_rpc.c
+@@ -45,6 +45,9 @@ static inline int rpc_dump_transaction(rpc_t* rpc, void* ctx, void *ih, ts_trans
+ {
+ void* vh;
+
++ if(t==NULL)
++ return -1;
++
+ if(rpc->struct_add(ih, "{", "Transaction", &vh)<0)
+ {
+ rpc->fault(ctx, 500, "Internal error creating transaction struct");
+@@ -73,9 +76,9 @@ static inline int rpc_dump_transaction(rpc_t* rpc, void* ctx, void *ih, ts_trans
+ */
+ static void rpc_tsilo_dump(rpc_t *rpc, void *c)
+ {
+- ts_transaction_t* trans;
+- struct ts_urecord* record;
+- struct ts_entry* entry;
++ ts_transaction_t* trans = NULL;
++ struct ts_urecord* record = NULL;
++ struct ts_entry* entry = NULL;
+
+ str brief = {0, 0};
+
+@@ -115,8 +118,8 @@ static void rpc_tsilo_dump(rpc_t *rpc, void *c)
+
+ /* add the entries per hash */
+ for(i=0,n=0,max=0,ntrans=0; i<t_table->size; i++) {
++ lock_entry(&t_table->entries[i]);
+ entry = &t_table->entries[i];
+- lock_entry(entry);
+
+ n += entry->n;
+ if(max<entry->n)
+@@ -130,7 +133,7 @@ static void rpc_tsilo_dump(rpc_t *rpc, void *c)
+ "Hash", record->rurihash,
+ "Transactions", &ih)<0)
+ {
+- unlock_entry(entry);
++ unlock_entry(&t_table->entries[i]);
+ rpc->fault(c, 500, "Internal error creating ruri struct");
+ return;
+ }
+@@ -139,13 +142,13 @@ static void rpc_tsilo_dump(rpc_t *rpc, void *c)
+ ntrans += 1;
+ if (short_dump==0) {
+ if (rpc_dump_transaction(rpc, c, ih, trans) == -1) {
+- unlock_entry(entry);
++ unlock_entry(&t_table->entries[i]);
+ return;
+ }
+ }
+ }
+ }
+- unlock_entry(entry);
++ unlock_entry(&t_table->entries[i]);
+ }
+
+ /* extra attributes node */
+--
+2.7.0
+
diff --git a/debian/patches/upstream/0003-uac-reset-append-to-rr-string-var-to-avoid-double-fr.patch b/debian/patches/upstream/0003-uac-reset-append-to-rr-string-var-to-avoid-double-fr.patch
new file mode 100644
index 0000000..716265b
--- /dev/null
+++ b/debian/patches/upstream/0003-uac-reset-append-to-rr-string-var-to-avoid-double-fr.patch
@@ -0,0 +1,120 @@
+From 00a45d2c86fe73a94d5816a43d4448f9be266ec0 Mon Sep 17 00:00:00 2001
+From: Daniel-Constantin Mierla <miconda at gmail.com>
+Date: Mon, 14 Mar 2016 14:37:01 +0100
+Subject: [PATCH 3/3] uac: reset append to rr string var to avoid double free
+ in case of error
+
+- reported by Fred Posner, GH #543
+
+(cherry picked from commit 6a362f032bdf5cf73dd3960e88bfb06dfb72bb85)
+(cherry picked from commit 734531b733a1983a718594b568f956f676d3ace3)
+---
+ modules/uac/replace.c | 28 ++++++++++++++--------------
+ 1 file changed, 14 insertions(+), 14 deletions(-)
+
+diff --git a/modules/uac/replace.c b/modules/uac/replace.c
+index f0bd471..3899355 100644
+--- a/modules/uac/replace.c
++++ b/modules/uac/replace.c
+@@ -182,8 +182,7 @@ static inline int decode_uri( str *src , str *dst)
+
+
+ static inline struct lump* get_display_anchor(struct sip_msg *msg,
+- struct hdr_field *hdr, struct to_body *body, str
+- *dsp)
++ struct hdr_field *hdr, struct to_body *body, str *dsp)
+ {
+ struct lump* l;
+ char *p1;
+@@ -237,7 +236,7 @@ static inline struct lump* get_display_anchor(struct sip_msg *msg,
+ * replace uri and/or display name in FROM / TO header
+ */
+ int replace_uri( struct sip_msg *msg, str *display, str *uri,
+- struct hdr_field *hdr, str *rr_param, str* restore_avp, int check_from)
++ struct hdr_field *hdr, str *rr_param, str* restore_avp, int check_from)
+ {
+ static char buf_s[MAX_URI_SIZE];
+ struct to_body *body;
+@@ -323,9 +322,9 @@ int replace_uri( struct sip_msg *msg, str *display, str *uri,
+ LM_ERR("no more pkg mem\n");
+ goto error;
+ }
+- memcpy( buf.s, display->s, display->len);
+- buf.len = display->len;
+- if (l==0 && (l=get_display_anchor(msg,hdr,body,&buf))==0)
++ memcpy( buf.s, display->s, display->len);
++ buf.len = display->len;
++ if (l==0 && (l=get_display_anchor(msg,hdr,body,&buf))==0)
+ {
+ LM_ERR("failed to insert anchor\n");
+ goto error;
+@@ -427,7 +426,7 @@ int replace_uri( struct sip_msg *msg, str *display, str *uri,
+ buf.s = buf_s;
+ if ( body->uri.len>uri->len ) {
+ if (body->uri.len>MAX_URI_SIZE) {
+- LM_ERR("old %.*s uri too long\n",hdr->name.len,hdr->name.s);
++ LM_ERR("old %.*s uri too long\n",hdr->name.len,hdr->name.s);
+ goto error;
+ }
+ memcpy( buf.s, body->uri.s, body->uri.len);
+@@ -554,6 +553,7 @@ int restore_uri( struct sip_msg *msg, str *rr_param, str* restore_avp, int check
+ goto failed;
+ }
+ pkg_free(add_to_rr.s);
++ add_to_rr.s = NULL;
+
+ /* dencrypt parameter ;) */
+ if (uac_passwd.len)
+@@ -662,10 +662,10 @@ failed:
+ void rr_checker(struct sip_msg *msg, str *r_param, void *cb_param)
+ {
+ /* check if the request contains the route param */
+- if ( (restore_uri( msg, &rr_from_param, &restore_from_avp, 1/*from*/) +
+- restore_uri( msg, &rr_to_param, &restore_to_avp, 0/*to*/) )!= -2 ) {
++ if ( (restore_uri( msg, &rr_from_param, &restore_from_avp, 1/*from*/) +
++ restore_uri( msg, &rr_to_param, &restore_to_avp, 0/*to*/) )!= -2 ) {
+ /* restore in req performed -> replace in reply */
+- /* in callback we need TO/FROM to be parsed- it's already done
++ /* in callback we need TO/FROM to be parsed- it's already done
+ * by restore_from_to() function */
+ if ( uac_tmb.register_tmcb( msg, 0, TMCB_RESPONSE_IN,
+ restore_uris_reply, 0, 0)!=1 ) {
+@@ -680,7 +680,7 @@ void rr_checker(struct sip_msg *msg, str *r_param, void *cb_param)
+
+ /* replace the entire HDR with the original request */
+ static inline int restore_uri_reply(struct sip_msg *rpl,
+- struct hdr_field *rpl_hdr, struct hdr_field *req_hdr, str* stored_value)
++ struct hdr_field *rpl_hdr, struct hdr_field *req_hdr, str* stored_value)
+
+ {
+ struct lump* l;
+@@ -758,7 +758,7 @@ void restore_uris_reply(struct cell* t, int type, struct tmcb_params *p)
+
+ /* parse FROM in reply */
+ if (parse_from_header( rpl )<0 ) {
+- LM_ERR("failed to find/parse FROM hdr\n");
++ LM_ERR("failed to find/parse FROM hdr\n");
+ return;
+ }
+
+@@ -776,7 +776,7 @@ void restore_uris_reply(struct cell* t, int type, struct tmcb_params *p)
+ if (req->msg_flags & FL_USE_UAC_TO ) {
+
+ /* parse TO in reply */
+- if ( rpl->to==0 && (parse_headers(rpl,HDR_TO_F,0)!=0 || rpl->to==0) ) {
++ if ( rpl->to==0 && (parse_headers(rpl,HDR_TO_F,0)!=0 || rpl->to==0) ) {
+ LM_ERR("failed to parse TO hdr\n");
+ return;
+ }
+@@ -787,7 +787,7 @@ void restore_uris_reply(struct cell* t, int type, struct tmcb_params *p)
+ }
+
+ if (restore_uri_reply( rpl, rpl->to, req->to, &avp_value.s)) {
+- LM_ERR("failed to restore TO\n");
++ LM_ERR("failed to restore TO\n");
+ }
+
+ }
+--
+2.7.0
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/kamailio.git
More information about the Pkg-voip-commits
mailing list