Browse Source

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
Andrei Pelinescu-Onciul 14 years ago
parent
commit
70b2fe02a6
4 changed files with 11 additions and 4 deletions
  1. 2 1
      forward.h
  2. 0 3
      msg_translator.c
  3. 2 0
      parser/msg_parser.c
  4. 7 0
      parser/msg_parser.h

+ 2 - 1
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 )
 

+ 0 - 3
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.

+ 2 - 0
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)*/

+ 7 - 0
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);