Module: sip-router
Branch: master
Commit: 090be2532da73f51043f9ba5f4b221fe338d60fa
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=090be25…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Fri Aug 3 09:20:03 2012 +0200
rr(k): add missing '<' in Route header for strict routing
- if next hop is strict router after loose routing, moving the r-uri to
last Route header was missing '<' in front of the address
- reported by Varsha Venkatraramani
---
modules_k/rr/loose.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/modules_k/rr/loose.c b/modules_k/rr/loose.c
index b74797f..22360df 100644
--- a/modules_k/rr/loose.c
+++ b/modules_k/rr/loose.c
@@ -49,6 +49,9 @@
#define RR_DRIVEN 1 /*!< The next hop is determined from the route set */
#define NOT_RR_DRIVEN -1 /*!< The next hop is not determined from the route set */
+#define RR_ROUTE_PREFIX ROUTE_PREFIX "<"
+#define RR_ROUTE_PREFIX_LEN (sizeof(RR_ROUTE_PREFIX)-1)
+
#define ROUTE_SUFFIX ">\r\n" /*!< SIP header suffix */
#define ROUTE_SUFFIX_LEN (sizeof(ROUTE_SUFFIX)-1)
@@ -307,7 +310,8 @@ static inline int save_ruri(struct sip_msg* _m)
}
/* Create buffer for new lump */
- len = ROUTE_PREFIX_LEN + _m->first_line.u.request.uri.len + ROUTE_SUFFIX_LEN;
+ len = RR_ROUTE_PREFIX_LEN + _m->first_line.u.request.uri.len
+ + ROUTE_SUFFIX_LEN;
s = (char*)pkg_malloc(len);
if (!s) {
LM_ERR("No memory pkg left\n");
@@ -315,9 +319,11 @@ static inline int save_ruri(struct sip_msg* _m)
}
/* Create new header field */
- memcpy(s, ROUTE_PREFIX, ROUTE_PREFIX_LEN);
- memcpy(s + ROUTE_PREFIX_LEN, _m->first_line.u.request.uri.s,
_m->first_line.u.request.uri.len);
- memcpy(s + ROUTE_PREFIX_LEN + _m->first_line.u.request.uri.len, ROUTE_SUFFIX,
ROUTE_SUFFIX_LEN);
+ memcpy(s, RR_ROUTE_PREFIX, RR_ROUTE_PREFIX_LEN);
+ memcpy(s + RR_ROUTE_PREFIX_LEN, _m->first_line.u.request.uri.s,
+ _m->first_line.u.request.uri.len);
+ memcpy(s + ROUTE_PREFIX_LEN + _m->first_line.u.request.uri.len,
+ ROUTE_SUFFIX, ROUTE_SUFFIX_LEN);
LM_DBG("New header: '%.*s'\n", len, ZSW(s));