Module: sip-router
Branch: master
Commit: 70b2fe02a634ed2fd020eab27cbc8e7f676289bf
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=70b2fe0…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Tue Dec 21 14:38:45 2010 +0100
core: fix ignored force_rport
The global force_rport config setting (not the force_rport()
script function), was ignored in some cases (e.g. tm & sl).
Reported-by: Tomas Mandys tomas.mandys iptel org
---
forward.h | 3 ++-
msg_translator.c | 3 ---
parser/msg_parser.c | 2 ++
parser/msg_parser.h | 7 +++++++
4 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/forward.h b/forward.h
index e5f1a38..7600535 100644
--- a/forward.h
+++ b/forward.h
@@ -98,7 +98,8 @@ int update_sock_struct_from_via( union sockaddr_union* to,
/* use src_ip, port=src_port if rport, via port if via port, 5060 otherwise */
#define update_sock_struct_from_ip( to, msg ) \
init_su((to), &(msg)->rcv.src_ip, \
- (((msg)->via1->rport)||((msg)->msg_flags&FL_FORCE_RPORT))? \
+ (((msg)->via1->rport)|| \
+ (((msg)->msg_flags|global_req_flags)&FL_FORCE_RPORT))? \
(msg)->rcv.src_port: \
((msg)->via1->port)?(msg)->via1->port: SIP_PORT )
diff --git a/msg_translator.c b/msg_translator.c
index c96d5b6..8b60fa7 100644
--- a/msg_translator.c
+++ b/msg_translator.c
@@ -156,9 +156,6 @@
extern char version[];
extern int version_len;
-/* global flags for build_req_from_sip_req */
-static unsigned int global_req_flags=0;
-
/** per process fixup function for global_req_flags.
diff --git a/parser/msg_parser.c b/parser/msg_parser.c
index a2a834e..f65cf85 100644
--- a/parser/msg_parser.c
+++ b/parser/msg_parser.c
@@ -82,6 +82,8 @@
/* number of via's encountered */
int via_cnt;
+/* global request flags */
+unsigned int global_req_flags = 0;
/* returns pointer to next header line, and fill hdr_f ;
* if at end of header returns pointer to the last crlf (always buf)*/
diff --git a/parser/msg_parser.h b/parser/msg_parser.h
index baf0cf1..8ef60ca 100644
--- a/parser/msg_parser.h
+++ b/parser/msg_parser.h
@@ -373,6 +373,13 @@ typedef struct sip_msg {
#define FAKED_REPLY ((struct sip_msg *) -1)
extern int via_cnt;
+/** global request flags.
+ * msg->msg_flags should be OR'ed with it before
+ * a flag value is checked, e.g.:
+ * if ((msg->msg_flags|global_req_flags) & FL_XXX) ...
+ */
+extern unsigned int global_req_flags;
+
int parse_msg(char* buf, unsigned int len, struct sip_msg* msg);