Browse code

rr: Add new return value for preloaded route set to loose_route()

Instead of returning just -1 (error), return a dedicated value. Now it is
possible to detect from the script if a preloaded Route header was removed
that pointed at the local proxy.

The new return code is kept negative, so all code checking for failure response
keeps working.

Alex Hermann authored on 11/01/2019 15:39:02
Showing 2 changed files
... ...
@@ -364,7 +364,7 @@ modparam("rr", "ignore_sips", 1)
364 364
 
365 365
         <listitem>
366 366
           <para><emphasis>2</emphasis> - route calculation based on
367
-	  flow-token has been successful</para>
367
+          flow-token has been successful</para>
368 368
         </listitem>
369 369
 
370 370
         <listitem>
... ...
@@ -376,6 +376,11 @@ modparam("rr", "ignore_sips", 1)
376 376
           <para><emphasis>-2</emphasis> - outbound flow-token shows evidence
377 377
           of tampering</para>
378 378
         </listitem>
379
+
380
+        <listitem>
381
+          <para><emphasis>-3</emphasis> - next hop is taken from
382
+          a preloaded route set</para>
383
+        </listitem>
379 384
       </itemizedlist>
380 385
 
381 386
       <para>This function can be used from REQUEST_ROUTE.</para>
... ...
@@ -48,6 +48,7 @@
48 48
 #define RR_OB_DRIVEN 2		/*!< The next hop is determined from the route set based on flow-token */
49 49
 #define NOT_RR_DRIVEN -1	/*!< The next hop is not determined from the route set */
50 50
 #define FLOW_TOKEN_BROKEN -2	/*!< Outbound flow-token shows evidence of tampering */
51
+#define RR_PRELOADED -3		/*!< The next hop is determined from a preloaded route set */
51 52
 
52 53
 #define RR_ROUTE_PREFIX ROUTE_PREFIX "<"
53 54
 #define RR_ROUTE_PREFIX_LEN (sizeof(RR_ROUTE_PREFIX)-1)
... ...
@@ -840,7 +841,7 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
840 841
 			}
841 842
 			if (res > 0) { /* No next route found */
842 843
 				LM_DBG("No next URI found\n");
843
-				status = (preloaded ? NOT_RR_DRIVEN : RR_DRIVEN);
844
+				status = (preloaded ? RR_PRELOADED : RR_DRIVEN);
844 845
 				goto done;
845 846
 			}
846 847
 			rt = (rr_t*)hdr->parsed;
... ...
@@ -873,7 +874,7 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
873 874
 					}
874 875
 				if (res > 0) { /* No next route found */
875 876
 					LM_DBG("no next URI found\n");
876
-					status = (preloaded ? NOT_RR_DRIVEN : RR_DRIVEN);
877
+					status = (preloaded ? RR_PRELOADED : RR_DRIVEN);
877 878
 					goto done;
878 879
 				}
879 880
 				rt = (rr_t*)hdr->parsed;