From 9e22de3bea9f31d50ae4ba733963fd04b54483c4 Mon Sep 17 00:00:00 2001 From: Raphael Coeffic Date: Tue, 31 Aug 2010 18:48:38 +0200 Subject: [PATCH] added some entropy into compute_branch without this change, branch tags created for the same transaction would be to similar. --- core/sip/trans_table.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/core/sip/trans_table.cpp b/core/sip/trans_table.cpp index 8eb3afc7..0d80cb1e 100644 --- a/core/sip/trans_table.cpp +++ b/core/sip/trans_table.cpp @@ -474,17 +474,18 @@ void compute_sl_to_tag(char* to_tag/*[8]*/, sip_msg* msg) void compute_branch(char* branch/*[8]*/, const cstring& callid, const cstring& cseq) { - unsigned int h=0; - unsigned int h_tv=0; + unsigned int hl=0; + unsigned int hh=0; timeval tv; gettimeofday(&tv,NULL); - h = hashlittle(callid.s,callid.len,h); - h = hashlittle(cseq.s,cseq.len,h); - h_tv = tv.tv_sec + tv.tv_usec; + hh = hl = tv.tv_sec + tv.tv_usec; + + hl = hashlittle(callid.s,callid.len,hl); + hh = hashlittle(cseq.s,cseq.len,hh); - compute_tag(branch,h,h_tv); + compute_tag(branch,hl,hh); } trans_bucket* get_trans_bucket(const cstring& callid, const cstring& cseq_num)