[sr-dev] git:3.1: rr(k): execute callbacks only for local route uri
Daniel-Constantin Mierla
miconda at gmail.com
Wed Sep 14 11:23:39 CEST 2011
Module: sip-router
Branch: 3.1
Commit: b4fae8b9eee6d893aa2591bcc9039ea53a142161
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b4fae8b9eee6d893aa2591bcc9039ea53a142161
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: Wed Sep 14 11:19:56 2011 +0200
rr(k): execute callbacks only for local route uri
- parameters callback are executed only if there is a list with
parameters in Route URI and for loose routing the URI has to match
myself condition
- should fix bogus value of Route URI params in callback function when
URI of top Route is not myself
- reported by Andreas Granig
(cherry picked from commit 10eac9b125ff2a13a2ae240897a3f17bc1243c71)
---
modules_k/rr/loose.c | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/modules_k/rr/loose.c b/modules_k/rr/loose.c
index a6d7e44..5c8b244 100644
--- a/modules_k/rr/loose.c
+++ b/modules_k/rr/loose.c
@@ -581,6 +581,11 @@ static inline int after_strict(struct sip_msg* _m)
rt = (rr_t*)hdr->parsed;
uri = rt->nameaddr.uri;
+ /* reset rr handling static vars for safety in error case */
+ routed_msg_id = 0;
+ routed_params.s = NULL;
+ routed_params.len = 0;
+
if (parse_uri(uri.s, uri.len, &puri) < 0) {
LM_ERR("failed to parse the first route URI\n");
return RR_ERROR;
@@ -734,8 +739,9 @@ static inline int after_strict(struct sip_msg* _m)
}
}
- /* run RR callbacks */
- run_rr_callbacks( _m, &routed_params );
+ /* run RR callbacks only if we have Route URI parameters */
+ if(routed_params.len > 0)
+ run_rr_callbacks( _m, &routed_params );
return RR_DRIVEN;
}
@@ -764,6 +770,11 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
rt = (rr_t*)hdr->parsed;
uri = rt->nameaddr.uri;
+ /* reset rr handling static vars for safety in error case */
+ routed_msg_id = 0;
+ routed_params.s = NULL;
+ routed_params.len = 0;
+
if (parse_uri(uri.s, uri.len, &puri) < 0) {
LM_ERR("failed to parse the first route URI\n");
return RR_ERROR;
@@ -889,8 +900,9 @@ static inline int after_loose(struct sip_msg* _m, int preloaded)
status = RR_DRIVEN;
done:
- /* run RR callbacks */
- run_rr_callbacks( _m, &routed_params );
+ /* run RR callbacks only if we have Route URI parameters */
+ if(routed_params.len > 0)
+ run_rr_callbacks( _m, &routed_params );
return status;
}
More information about the sr-dev
mailing list