Module: sems
Branch: rco/dnscache
Commit: c495230a3753cf7f00908d4200de835a98af6dbb
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=c495230a3753cf7f00908d4200de835a98af6dbb

Author: Raphael Coeffic <[email protected]>
Committer: Raphael Coeffic <[email protected]>
Date:   Tue Aug 31 18:48:38 2010 +0200

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 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/core/sip/trans_table.cpp b/core/sip/trans_table.cpp
index 8eb3afc..0d80cb1 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)

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to