pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36597?usp=email )
Change subject: SIP_Templates: Make tag collisions harder ......................................................................
SIP_Templates: Make tag collisions harder
It was spotted during some test runs that the same tag was assigned to 2 different components. Let's make this way more difficult by adding some time to it. Asterisk uses longer strings for instance, since 32bits is the minimum.
Change-Id: Iba26259fd48da1c2558451fe5f7014151d4935c8 --- M asterisk/SIP_ConnectionHandler.ttcn M asterisk/gen_links.sh M asterisk/regen_makefile.sh M library/SIP_Templates.ttcn 4 files changed, 22 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/97/36597/1
diff --git a/asterisk/SIP_ConnectionHandler.ttcn b/asterisk/SIP_ConnectionHandler.ttcn index 77ebebb..13b5f04 100644 --- a/asterisk/SIP_ConnectionHandler.ttcn +++ b/asterisk/SIP_ConnectionHandler.ttcn @@ -704,4 +704,4 @@ [fail_others] as_SIP_fail_req(sip_expect_str); }
-} \ No newline at end of file +} diff --git a/asterisk/gen_links.sh b/asterisk/gen_links.sh index 97df3a2..c342e51 100755 --- a/asterisk/gen_links.sh +++ b/asterisk/gen_links.sh @@ -7,6 +7,7 @@ DIR=$BASEDIR/titan.Libraries.TCCUsefulFunctions/src FILES="TCCInterface_Functions.ttcn TCCConversion_Functions.ttcn TCCConversion.cc TCCInterface.cc TCCInterface_ip.h " FILES+="TCCOpenSecurity_Functions.ttcn TCCOpenSecurity.cc TCCOpenSecurity_Functions.hh " +FILES+="TCCDateTime.cc TCCDateTime_Functions.ttcn" gen_links $DIR $FILES
DIR=$BASEDIR/titan.TestPorts.Common_Components.Socket-API/src diff --git a/asterisk/regen_makefile.sh b/asterisk/regen_makefile.sh index 1aa18ae..5d5538e 100755 --- a/asterisk/regen_makefile.sh +++ b/asterisk/regen_makefile.sh @@ -15,6 +15,7 @@ TCCConversion.cc TCCInterface.cc TCCOpenSecurity.cc + TCCDateTime.cc TELNETasp_PT.cc "
diff --git a/library/SIP_Templates.ttcn b/library/SIP_Templates.ttcn index be07196..e115bb7 100644 --- a/library/SIP_Templates.ttcn +++ b/library/SIP_Templates.ttcn @@ -3,6 +3,7 @@ import from SIPmsg_Types all; import from TCCConversion_Functions all; import from TCCOpenSecurity_Functions all; +import from TCCDateTime_Functions all; import from Native_Functions all; import from Osmocom_Types all; import from Misc_Helpers all; @@ -1151,10 +1152,12 @@ req.msgHeader.cSeq.seqNumber := f_sip_next_seq_nr(valueof(req.msgHeader.cSeq.seqNumber)); }
-/* Tags shall have at least 32 bit of randomness */ function f_sip_rand_tag() return charstring { + /* Tags shall have at least 32 bit of randomness */ var integer rnd_int := f_rnd_int(4294967296); - return hex2str(int2hex(rnd_int, 8)); + /* Make collisions harder by appending time to the final string: */ + var integer ts_int := f_time_ms() mod 4294967296; + return hex2str(int2hex(rnd_int, 8)) & "-" & hex2str(int2hex(ts_int, 8)); }
/* Generate a "branch" tag value.