Browse code

relaxed CANCEL matching (no to-tags included) introduced

Jiri Kuthan authored on 21/10/2002 11:46:55
Showing 2 changed files
... ...
@@ -285,8 +285,8 @@ or cat test/transaction.fifo > /tmp/ser_fifo
285 285
 
286 286
 Defines
287 287
 -------
288
-- TOTAG enables matching of acknowledgemnts including to-tags;
289
-  it is disabled by default for two reasons:
288
+- ACK_TAG enables stricter matching of acknowledgemnts including to-tags;
289
+  without it, to-tags are ignored; it is disabled by default for two reasons:
290 290
   a) it eliminates an unlikely race condition in which
291 291
      transaction's to-tag is being rewritten by a 200 OK
292 292
      whereas an ACK is being looked up by to-tag
... ...
@@ -296,7 +296,13 @@ Defines
296 296
   negative reply sent upstream and 200/ACKs are not matched
297 297
   as they consititute another transaction. It will make no
298 298
   difference at all when the new magic cookie matching is
299
-  enabled.
299
+  enabled anyway.
300
+- CANCEL_TAG similarly enables strict matching of CANCELs 
301
+  including to-tags -- act of mercy to UACs, who screw up
302
+  the to-tags (however, it still depends on how forgiving
303
+  the downstream UAS is); like with ACK_TAG, all this
304
+  complex transactions matching goes with RFC3261's
305
+  magic cookie away anyway
300 306
 
301 307
 
302 308
 
... ...
@@ -191,7 +191,10 @@ int t_lookup_request( struct sip_msg* p_msg , int leave_new_locked )
191 191
 			/* To only the uri and ... */
192 192
 			if (get_to(t_msg)->uri.len!=get_to(p_msg)->uri.len)
193 193
 				continue;
194
-#ifdef TOTAG
194
+			/* don't care about to-tags -- many UAC screw them
195
+			 * up anyway, and it doesn't hurt if we ignore 
196
+			 * them */
197
+#ifdef ACKTAG
195 198
 			/* ... its to-tag compared to reply's tag */
196 199
 			if (p_cell->uas.to_tag.len!=get_to(p_msg)->tag_value.len)
197 200
 				continue;
... ...
@@ -207,7 +210,7 @@ int t_lookup_request( struct sip_msg* p_msg , int leave_new_locked )
207 207
 			if (!EQ_STR(from)) continue;
208 208
 			if (memcmp(get_to(t_msg)->uri.s, get_to(p_msg)->uri.s,
209 209
 				get_to(t_msg)->uri.len)!=0) continue;
210
-#ifdef TOTAG
210
+#ifdef ACKTAG
211 211
 			if (
212 212
 #ifdef _BUG
213 213
 				p_cell->uas.to_tag.len!=0 /* to-tags empty */ || 
... ...
@@ -299,8 +302,17 @@ struct cell* t_lookupOriginalT(  struct sip_msg* p_msg )
299 299
 			continue;
300 300
 		if (!EQ_LEN(from))
301 301
 			continue;
302
+#ifdef CANCEL_TAG
302 303
 		if (!EQ_LEN(to))
303 304
 			continue;
305
+#else
306
+		/* relaxed matching -- we don't care about to-tags anymore,
307
+		 * many broken UACs screw them up and ignoring them does not
308
+		 * actually hurt
309
+		 */
310
+		if (get_to(t_msg)->uri.len!=get_to(p_msg)->uri.len)
311
+			continue;
312
+#endif
304 313
 		if (!EQ_REQ_URI_LEN)
305 314
 			continue;
306 315
 		if (!EQ_VIA_LEN(via1))
... ...
@@ -314,8 +326,14 @@ struct cell* t_lookupOriginalT(  struct sip_msg* p_msg )
314 314
 			continue;
315 315
 		if (!EQ_STR(from))
316 316
 			continue;
317
+#ifdef CANCEL_TAG
317 318
 		if (!EQ_STR(to))
318 319
 			continue;
320
+#else
321
+		if (memcmp(get_to(t_msg)->uri.s, get_to(p_msg)->uri.s,
322
+					get_to(t_msg)->uri.len)!=0)
323
+			continue;
324
+#endif
319 325
 		if (!EQ_REQ_URI_STR)
320 326
 			continue;
321 327
 		if (!EQ_VIA_STR(via1))