Browse code

- by default do not blacklist 503 replies with no Retry-After, to be rfc conformant (blst_503_def_timeout is now 0 by default) (thanks to Miklos Tirpak <miklos@iptel.org> for the hint)

Andrei Pelinescu-Onciul authored on 30/07/2007 20:38:44
Showing 4 changed files
... ...
@@ -48,8 +48,8 @@ modules:
48 48
                         - blst_503_def_timeout - if the Retry-After header from
49 49
                           a 503 reply is missing, use this value for the 
50 50
                           blacklist timeout (in s). Depends on blst_503.
51
-                          The default value is dst_blacklist_expire (60s if 
52
-                          not changed in the config script).
51
+                          The default value is 0 ( do not blacklist if no
52
+                          Retry-After is present).
53 53
                         - blst_503_min_timeot (in s) - if the 503 reply 
54 54
                           Retry-After header value is less, use this value
55 55
                           for the blacklist timeout. Depends on blst_503.
... ...
@@ -308,8 +308,9 @@ modparam("tm", "blst_503", 1)
308 308
 		<varname>blst_503_max_timeout</varname>.
309 309
 	</para>
310 310
 	<para>
311
-		The default value is the <varname>dst_blacklist_expire</varname>'s 
312
-		value (which is 60 s, if not changed in the config).
311
+		The default value is 0, which means that if no Retry-After header is
312
+		present, the 503 reply source will not be blacklisted (rfc conformant
313
+		 behaviour).
313 314
 	</para>
314 315
 	<example>
315 316
 	    <title>Set <varname>blst_503_def_timeout</varname> parameter</title>
... ...
@@ -138,7 +138,8 @@ int tm_blst_503=0;
138 138
 #ifndef DEFAULT_BLST_TIMEOUT
139 139
 #define DEFAULT_BLST_TIMEOUT 60
140 140
 #endif
141
-int tm_blst_503_default=DEFAULT_BLST_TIMEOUT; /* in s */
141
+int tm_blst_503_default=0; /* rfc conformant: do not blacklist if 
142
+							  no retry-after */
142 143
 /* minimum 503 blacklist time */
143 144
 int tm_blst_503_min=0; /* in s */
144 145
 /* maximum 503 blacklist time */
... ...
@@ -1807,11 +1808,13 @@ int reply_received( struct sip_msg  *p_msg )
1807 1807
 					if (hf->type==HDR_RETRY_AFTER_T){
1808 1808
 						/* found */
1809 1809
 						blst_503_timeout=(unsigned)(unsigned long)hf->parsed;
1810
+						blst_503_timeout=MAX_unsigned(blst_503_timeout, 
1811
+															tm_blst_503_min);
1812
+						blst_503_timeout=MIN_unsigned(blst_503_timeout,
1813
+															tm_blst_503_max);
1810 1814
 						break;
1811 1815
 					}
1812 1816
 			}
1813
-			blst_503_timeout=MAX_unsigned(blst_503_timeout, tm_blst_503_min);
1814
-			blst_503_timeout=MIN_unsigned(blst_503_timeout, tm_blst_503_max);
1815 1817
 			if (blst_503_timeout){
1816 1818
 				src.send_sock=0;
1817 1819
 				src.to=p_msg->rcv.src_su;
... ...
@@ -625,10 +625,6 @@ static int mod_init(void)
625 625
 		LOG(L_ERR,"ERROR:tm:mod_init: failed to process timer AVPs\n");
626 626
 		return -1;
627 627
 	}
628
-#ifdef USE_DST_BLACKLIST
629
-	tm_blst_503_default=blst_timeout; /* by default use blacklist's generic 
630
-										 value */
631
-#endif
632 628
 	tm_init = 1;
633 629
 	return 0;
634 630
 }