Ver Fonte

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 há 6 anos atrás
pai
commit
c5b8e5b3a8
2 ficheiros alterados com 9 adições e 3 exclusões
  1. 6 1
      src/modules/rr/doc/rr_admin.xml
  2. 3 2
      src/modules/rr/loose.c

+ 6 - 1
src/modules/rr/doc/rr_admin.xml

@@ -364,7 +364,7 @@ modparam("rr", "ignore_sips", 1)
 
 
         <listitem>
         <listitem>
           <para><emphasis>2</emphasis> - route calculation based on
           <para><emphasis>2</emphasis> - route calculation based on
-	  flow-token has been successful</para>
+          flow-token has been successful</para>
         </listitem>
         </listitem>
 
 
         <listitem>
         <listitem>
@@ -376,6 +376,11 @@ modparam("rr", "ignore_sips", 1)
           <para><emphasis>-2</emphasis> - outbound flow-token shows evidence
           <para><emphasis>-2</emphasis> - outbound flow-token shows evidence
           of tampering</para>
           of tampering</para>
         </listitem>
         </listitem>
+
+        <listitem>
+          <para><emphasis>-3</emphasis> - next hop is taken from
+          a preloaded route set</para>
+        </listitem>
       </itemizedlist>
       </itemizedlist>
 
 
       <para>This function can be used from REQUEST_ROUTE.</para>
       <para>This function can be used from REQUEST_ROUTE.</para>

+ 3 - 2
src/modules/rr/loose.c

@@ -48,6 +48,7 @@
 #define RR_OB_DRIVEN 2		/*!< The next hop is determined from the route set based on flow-token */
 #define RR_OB_DRIVEN 2		/*!< The next hop is determined from the route set based on flow-token */
 #define NOT_RR_DRIVEN -1	/*!< The next hop is not determined from the route set */
 #define NOT_RR_DRIVEN -1	/*!< The next hop is not determined from the route set */
 #define FLOW_TOKEN_BROKEN -2	/*!< Outbound flow-token shows evidence of tampering */
 #define FLOW_TOKEN_BROKEN -2	/*!< Outbound flow-token shows evidence of tampering */
+#define RR_PRELOADED -3		/*!< The next hop is determined from a preloaded route set */
 
 
 #define RR_ROUTE_PREFIX ROUTE_PREFIX "<"
 #define RR_ROUTE_PREFIX ROUTE_PREFIX "<"
 #define RR_ROUTE_PREFIX_LEN (sizeof(RR_ROUTE_PREFIX)-1)
 #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)
 			}
 			}
 			if (res > 0) { /* No next route found */
 			if (res > 0) { /* No next route found */
 				LM_DBG("No next URI found\n");
 				LM_DBG("No next URI found\n");
-				status = (preloaded ? NOT_RR_DRIVEN : RR_DRIVEN);
+				status = (preloaded ? RR_PRELOADED : RR_DRIVEN);
 				goto done;
 				goto done;
 			}
 			}
 			rt = (rr_t*)hdr->parsed;
 			rt = (rr_t*)hdr->parsed;
@@ -873,7 +874,7 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
 					}
 					}
 				if (res > 0) { /* No next route found */
 				if (res > 0) { /* No next route found */
 					LM_DBG("no next URI found\n");
 					LM_DBG("no next URI found\n");
-					status = (preloaded ? NOT_RR_DRIVEN : RR_DRIVEN);
+					status = (preloaded ? RR_PRELOADED : RR_DRIVEN);
 					goto done;
 					goto done;
 				}
 				}
 				rt = (rr_t*)hdr->parsed;
 				rt = (rr_t*)hdr->parsed;