MT#8797 backport upstream patches to deal with double record route

vseva/8905
Victor Seva 12 years ago
parent 3ac0dec31f
commit 1a6523a779

@ -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

@ -0,0 +1,25 @@
From 79a01b9df71bdc4329ee14e29d5c5ef230116bd2 Mon Sep 17 00:00:00 2001
From: Daniel-Constantin Mierla <miconda@gmail.com>
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

@ -0,0 +1,79 @@
From cc84b46d473236d162a852c3604eacfc88e56ba2 Mon Sep 17 00:00:00 2001
From: Daniel-Constantin Mierla <miconda@gmail.com>
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
Loading…
Cancel
Save