[sr-dev] git:4.0: modules/rr: only use flow-token for routing if it doesn' t point to the source of the request

Peter Dunkley peter.dunkley at crocodile-rcs.com
Fri Mar 29 02:30:21 CET 2013


Module: sip-router
Branch: 4.0
Commit: 70217018e5a72c80cee37bc5a722b769890fc64c
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=70217018e5a72c80cee37bc5a722b769890fc64c

Author: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Date:   Wed Mar 27 15:43:02 2013 +0000

modules/rr: only use flow-token for routing if it doesn't point to the source of the request
(cherry picked from commit 874669f483e1efba032bd695eb6cee4275673874)

---

 modules/rr/loose.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/modules/rr/loose.c b/modules/rr/loose.c
index b7fa243..268522c 100644
--- a/modules/rr/loose.c
+++ b/modules/rr/loose.c
@@ -513,12 +513,15 @@ static inline int process_outbound(struct sip_msg *_m, str flow_token,
 	ret = rr_obb.decode_flow_token(&rcv, flow_token);
 
 	if (ret == -2) {
-		LM_INFO("no flow token found - outbound not in use\n");
+		LM_DBG("no flow token found - outbound not in use\n");
 		return 0;
 	} else if (ret == -1) {
 		LM_ERR("failed to decode flow token\n");
 		return -1;
-	} else {
+	} else if (!ip_addr_cmp(&rcv.src_ip, &_m->rcv.src_ip)
+			|| rcv.src_port != _m->rcv.src_port) {
+		LM_DBG("\"incoming\" request found. Using flow-token for"
+			"routing\n");
 
 		/* First, force the local socket */
 		si = find_si(&rcv.dst_ip, rcv.dst_port, rcv.proto);
@@ -546,9 +549,9 @@ static inline int process_outbound(struct sip_msg *_m, str flow_token,
 					rcv.src_ip.af == AF_INET6 ? "]" : "",
 					rcv.src_port,
 					get_proto_name(rcv.proto));
-
-		return 1;
 	}
+
+	return 1;
 }
 
 /*!




More information about the sr-dev mailing list