[sr-dev] git:master:e98a4ee5: nathelper: use portable kamailio rand() wrapper instead of direct library call

Henning Westerholt hw at skalatan.de
Sun Sep 1 17:18:25 CEST 2019


Module: kamailio
Branch: master
Commit: e98a4ee55253302144053704c26089f440d5d7ff
URL: https://github.com/kamailio/kamailio/commit/e98a4ee55253302144053704c26089f440d5d7ff

Author: Henning Westerholt <hw at skalatan.de>
Committer: Henning Westerholt <hw at skalatan.de>
Date: 2019-09-01T17:17:38+02:00

nathelper: use portable kamailio rand() wrapper instead of direct library call

---

Modified: src/modules/nathelper/sip_pinger.h

---

Diff:  https://github.com/kamailio/kamailio/commit/e98a4ee55253302144053704c26089f440d5d7ff.diff
Patch: https://github.com/kamailio/kamailio/commit/e98a4ee55253302144053704c26089f440d5d7ff.patch

---

diff --git a/src/modules/nathelper/sip_pinger.h b/src/modules/nathelper/sip_pinger.h
index 23ea633d03..e84ca6c648 100644
--- a/src/modules/nathelper/sip_pinger.h
+++ b/src/modules/nathelper/sip_pinger.h
@@ -30,6 +30,7 @@
 #include "../../core/str.h"
 #include "../../core/ut.h"
 #include "../../core/ip_addr.h"
+#include "../../core/rand/kam_rand.h"
 
 /* size of buffer used for building SIP PING req */
 #define MAX_SIPPING_SIZE 65536
@@ -56,15 +57,15 @@ static void init_sip_ping(void)
 	char *p;
 
 	/* FROM tag - some random number */
-	sipping_fromtag = rand();
+	sipping_fromtag = kam_rand();
 	/* callid fix part - hexa string */
 	len = 8;
 	p = sipping_callid_buf;
-	int2reverse_hex(&p, &len, rand());
+	int2reverse_hex(&p, &len, kam_rand());
 	sipping_callid.s = sipping_callid_buf;
 	sipping_callid.len = 8 - len;
 	/* callid counter part */
-	sipping_callid_cnt = rand();
+	sipping_callid_cnt = kam_rand();
 }
 
 




More information about the sr-dev mailing list