@@ -60,22 +60,20 @@ int topology_hiding(struct sip_msg *req,int extra_flags, struct th_params *param
6060{
6161 struct dlg_cell * dlg ;
6262 struct cell * t ;
63- str tag ;
64-
65- /* we should only initialize topology hiding for initial requests */
66- if (!req -> to && parse_headers (req , HDR_TO_F ,0 )== -1 ) {
67- LM_ERR ("To parsing failed\n" );
68- return -1 ;
69- }
70- if (!req -> to ) {
71- LM_ERR ("no To\n" );
72- return -1 ;
73- }
74- tag = get_to (req )-> tag_value ;
75- if (tag .len > 0 ) {
76- LM_WARN ("SCRIPT ERROR - trying to initialize topology hiding for sequential request \n" );
63+ int is_sequential = 0 ;
64+
65+ if (!req -> to && parse_headers (req , HDR_TO_F ,0 ) == -1 ) {
66+ LM_ERR ("To parsing failed\n" );
67+ return -1 ;
68+ }
69+
70+ if (!req -> to ) {
71+ LM_ERR ("no To\n" );
7772 return -1 ;
78- }
73+ }
74+
75+ /* one way hiding will fail topology hiding match when going out the untrusted side */
76+ is_sequential = get_to (req )-> tag_value .len > 0 ;
7977
8078 t = tm_api .t_gett ();
8179 if (t == T_UNDEFINED )
@@ -99,13 +97,19 @@ int topology_hiding(struct sip_msg *req,int extra_flags, struct th_params *param
9997 }
10098 }
10199
102- if (!dlg )
103- return topo_hiding_no_dlg (req ,t ,extra_flags ,params );
104- else
105- return topo_hiding_with_dlg (req ,t ,dlg ,extra_flags ,params );
100+ if (dlg ) {
101+ if (is_sequential ) {
102+ LM_WARN ("SCRIPT ERROR - trying to initialize topology hiding for sequential request in dialog mode \n" );
103+ return -1 ;
104+ }
105+
106+ return topo_hiding_with_dlg (req , t , dlg , extra_flags , params );
107+ } else {
108+ return topo_hiding_no_dlg (req , t , extra_flags , params );
109+ }
106110 }
107111
108- return topo_hiding_no_dlg (req ,t , extra_flags ,params );
112+ return topo_hiding_no_dlg (req , t , extra_flags , params );
109113}
110114
111115/* internal functionality */
0 commit comments