Browse code

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 authored on 21/12/2010 13:38:45
Showing 4 changed files
... ...
@@ -98,7 +98,8 @@ int update_sock_struct_from_via( union sockaddr_union* to,
98 98
 /* use src_ip, port=src_port if rport, via port if via port, 5060 otherwise */
99 99
 #define update_sock_struct_from_ip(  to, msg ) \
100 100
 	init_su((to), &(msg)->rcv.src_ip, \
101
-			(((msg)->via1->rport)||((msg)->msg_flags&FL_FORCE_RPORT))? \
101
+			(((msg)->via1->rport)|| \
102
+			 (((msg)->msg_flags|global_req_flags)&FL_FORCE_RPORT))? \
102 103
 							(msg)->rcv.src_port: \
103 104
 							((msg)->via1->port)?(msg)->via1->port: SIP_PORT )
104 105
 
... ...
@@ -156,9 +156,6 @@
156 156
 extern char version[];
157 157
 extern int version_len;
158 158
 
159
-/* global flags for build_req_from_sip_req */
160
-static unsigned int global_req_flags=0;
161
-
162 159
 
163 160
 
164 161
 /** per process fixup function for global_req_flags.
... ...
@@ -82,6 +82,8 @@
82 82
 
83 83
 /* number of via's encountered */
84 84
 int via_cnt;
85
+/* global request flags */
86
+unsigned int global_req_flags = 0;
85 87
 
86 88
 /* returns pointer to next header line, and fill hdr_f ;
87 89
  * if at end of header returns pointer to the last crlf  (always buf)*/
... ...
@@ -373,6 +373,13 @@ typedef struct sip_msg {
373 373
 #define FAKED_REPLY     ((struct sip_msg *) -1)
374 374
 
375 375
 extern int via_cnt;
376
+/** global  request flags.
377
+ *  msg->msg_flags should be OR'ed with it before
378
+ * a flag value is checked, e.g.:
379
+ * if ((msg->msg_flags|global_req_flags) & FL_XXX) ...
380
+ */
381
+extern unsigned int global_req_flags;
382
+
376 383
 
377 384
 int parse_msg(char* buf, unsigned int len, struct sip_msg* msg);
378 385