Skip to content

Commit

Permalink
[siptrace] fix hash calculus for extended hep trace_id
Browse files Browse the repository at this point in the history
  • Loading branch information
ionutrazvanionita committed May 6, 2016
1 parent bcbded5 commit 5e261d7
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions modules/siptrace/siptrace.c
Expand Up @@ -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;

Expand Down Expand Up @@ -530,15 +530,23 @@ 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(&param1, &param2, 0);
} else {
param_hash = core_hash(&param1, NULL, 0);
}
hash^= param_hash;
}
} else if (IS_SIP_URI(trace_uri)) {
uri_type = TYPE_SIP;
} else {
/* need to take the table into account */
if (param1.s == NULL || param1.len == 0)
param1 = siptrace_table;

url_table_hash = core_hash(&trace_uri, &param1, 0);
hash ^= (url_table_hash>>3);
param_hash = core_hash(&trace_uri, &param1, 0);
hash ^= (param_hash>>3);
uri_type = TYPE_DB;
}

Expand Down

0 comments on commit 5e261d7

Please sign in to comment.