From 5e261d7e9f1ea632806370c16cb0f733cee4edfc Mon Sep 17 00:00:00 2001 From: ionutrazvanionita Date: Fri, 6 May 2016 13:19:15 +0300 Subject: [PATCH] [siptrace] fix hash calculus for extended hep trace_id --- modules/siptrace/siptrace.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/siptrace/siptrace.c b/modules/siptrace/siptrace.c index 33a4c88cbd6..06c62048313 100644 --- a/modules/siptrace/siptrace.c +++ b/modules/siptrace/siptrace.c @@ -486,7 +486,7 @@ static int parse_siptrace_id(str *suri) && (__url__.s[2]|0x20) == 'p')) - unsigned int hash, url_table_hash; + unsigned int hash, param_hash; char *new_url; @@ -530,6 +530,14 @@ static int parse_siptrace_id(str *suri) if (IS_HEP_URI(trace_uri)) { uri_type = TYPE_HEP; + if (param1.s && param1.len) { + if (param2.s && param2.len) { + param_hash = core_hash(¶m1, ¶m2, 0); + } else { + param_hash = core_hash(¶m1, NULL, 0); + } + hash^= param_hash; + } } else if (IS_SIP_URI(trace_uri)) { uri_type = TYPE_SIP; } else { @@ -537,8 +545,8 @@ static int parse_siptrace_id(str *suri) if (param1.s == NULL || param1.len == 0) param1 = siptrace_table; - url_table_hash = core_hash(&trace_uri, ¶m1, 0); - hash ^= (url_table_hash>>3); + param_hash = core_hash(&trace_uri, ¶m1, 0); + hash ^= (param_hash>>3); uri_type = TYPE_DB; }