From 1a6523a7793f8478445b311859682b439eb7e836 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Tue, 26 Aug 2014 16:25:26 +0200 Subject: [PATCH] MT#8797 backport upstream patches to deal with double record route --- debian/patches/series | 3 + ...-internal-msg-flag-added-FL_RR_ADDED.patch | 25 ++++++ ...msg-flags-to-mark-a-request-with-rec.patch | 79 +++++++++++++++++++ 3 files changed, 107 insertions(+) create mode 100644 debian/patches/upstream/core-new-internal-msg-flag-added-FL_RR_ADDED.patch create mode 100644 debian/patches/upstream/rr-use-internal-msg-flags-to-mark-a-request-with-rec.patch diff --git a/debian/patches/series b/debian/patches/series index 57e61baa9..a360282ce 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -14,6 +14,9 @@ upstream/0003-textops-functions-to-convert-append-and-remove-multi.patch upstream/0004-textops-add-new-multipart-functions-documentation.patch upstream/0005-textops-Refresh-README.patch # +upstream/core-new-internal-msg-flag-added-FL_RR_ADDED.patch +upstream/rr-use-internal-msg-flags-to-mark-a-request-with-rec.patch +# no_lib64_on_64_bits.patch no_INSTALL_file.patch fix_export.patch diff --git a/debian/patches/upstream/core-new-internal-msg-flag-added-FL_RR_ADDED.patch b/debian/patches/upstream/core-new-internal-msg-flag-added-FL_RR_ADDED.patch new file mode 100644 index 000000000..612d95ff4 --- /dev/null +++ b/debian/patches/upstream/core-new-internal-msg-flag-added-FL_RR_ADDED.patch @@ -0,0 +1,25 @@ +From 79a01b9df71bdc4329ee14e29d5c5ef230116bd2 Mon Sep 17 00:00:00 2001 +From: Daniel-Constantin Mierla +Date: Tue, 29 Apr 2014 00:05:16 +0200 +Subject: [PATCH] core: new internal msg flag added - FL_RR_ADDED + +- marks a sip request when record route is added +--- + parser/msg_parser.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/parser/msg_parser.h b/parser/msg_parser.h +index f25bec9..33d0475 100644 +--- a/parser/msg_parser.h ++++ b/parser/msg_parser.h +@@ -122,6 +122,7 @@ typedef enum request_method { + #define FL_TM_RPL_MATCHED (1<<15) /* tm matched reply already */ + #define FL_RPL_SUSPENDED (1<<16) /* for async reply processing */ + #define FL_BODY_MULTIPART (1<<17) /* body modified is multipart */ ++#define FL_RR_ADDED (1<<18) /* Record-Route header was added */ + + /* WARNING: Value (1 << 28) is temporarily reserved for use in kamailio call_control + * module (flag FL_USE_CALL_CONTROL )! */ +-- +2.1.0.rc1 + diff --git a/debian/patches/upstream/rr-use-internal-msg-flags-to-mark-a-request-with-rec.patch b/debian/patches/upstream/rr-use-internal-msg-flags-to-mark-a-request-with-rec.patch new file mode 100644 index 000000000..ae0233851 --- /dev/null +++ b/debian/patches/upstream/rr-use-internal-msg-flags-to-mark-a-request-with-rec.patch @@ -0,0 +1,79 @@ +From cc84b46d473236d162a852c3604eacfc88e56ba2 Mon Sep 17 00:00:00 2001 +From: Daniel-Constantin Mierla +Date: Tue, 29 Apr 2014 00:01:53 +0200 +Subject: [PATCH] rr: use internal msg flags to mark a request with record + route added + +--- + modules/rr/rr_mod.c | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +diff --git a/modules/rr/rr_mod.c b/modules/rr/rr_mod.c +index 1628f3b..8a7311d 100644 +--- a/modules/rr/rr_mod.c ++++ b/modules/rr/rr_mod.c +@@ -61,7 +61,6 @@ int enable_socket_mismatch_warning = 1; /*!< enable socket mismatch warning */ + static str custom_user_spec = {NULL, 0}; + pv_spec_t custom_user_avp; + +-static unsigned int last_rr_msg; + ob_api_t rr_obb; + + MODULE_VERSION +@@ -268,7 +267,7 @@ static int w_record_route(struct sip_msg *msg, char *key, char *bar) + { + str s; + +- if (msg->id == last_rr_msg) { ++ if (msg->msg_flags & FL_RR_ADDED) { + LM_ERR("Double attempt to record-route\n"); + return -1; + } +@@ -280,7 +279,7 @@ static int w_record_route(struct sip_msg *msg, char *key, char *bar) + if ( record_route( msg, key?&s:0 )<0 ) + return -1; + +- last_rr_msg = msg->id; ++ msg->msg_flags |= FL_RR_ADDED; + return 1; + } + +@@ -289,7 +288,7 @@ static int w_record_route_preset(struct sip_msg *msg, char *key, char *key2) + { + str s; + +- if (msg->id == last_rr_msg) { ++ if (msg->msg_flags & FL_RR_ADDED) { + LM_ERR("Duble attempt to record-route\n"); + return -1; + } +@@ -316,7 +315,7 @@ static int w_record_route_preset(struct sip_msg *msg, char *key, char *key2) + return -1; + + done: +- last_rr_msg = msg->id; ++ msg->msg_flags |= FL_RR_ADDED; + return 1; + } + +@@ -328,7 +327,7 @@ static int w_record_route_advertised_address(struct sip_msg *msg, char *addr, ch + { + str s; + +- if (msg->id == last_rr_msg) { ++ if (msg->msg_flags & FL_RR_ADDED) { + LM_ERR("Double attempt to record-route\n"); + return -1; + } +@@ -340,7 +339,7 @@ static int w_record_route_advertised_address(struct sip_msg *msg, char *addr, ch + if ( record_route_advertised_address( msg, &s ) < 0) + return -1; + +- last_rr_msg = msg->id; ++ msg->msg_flags |= FL_RR_ADDED; + return 1; + } + +-- +2.1.0.rc1 +