<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/4.8.4">
</HEAD>
<BODY>
hello all<BR>
<BR>
today testing kamailio 5.0.1 version we have seen that some rpc commands of benchmark module are not working fine.<BR>
<BR>
when trying to change enable_global parameter, setting 1 for example it says that the parameter is invalid<BR>
/usr/local/kamailio-5.0/sbin/kamcmd -s udp:127.0.0.1:2046 benchmark.enable_global 1<BR>
error: 500 - Invalid Parameter Value<BR>
<BR>
besides, it also permits to set a granularity value of 0 without giving error.<BR>
By doing that, if the kamailio has calls in progress, the kamailio get a crash<BR>
<BR>
Core was generated by `/usr/local/kamailio-5.0/sbin/kamailio -P /var/run/kamailio/kamailio_talos.pid -'.<BR>
Program terminated with signal 8, Arithmetic exception.<BR>
#0  0x00007f4d55989757 in _bm_log_timer (id=0) at benchmark.c:320<BR>
320             if ((bm_mycfg->tindex[id]->calls % bm_mycfg->granularity) == 0)<BR>
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.132.el6.x86_64 libxml2-2.7.6-14.el6.x86_64 pcre-7.8-6.el6.x86_64 zlib-1.2.3-29.el6.x86_64<BR>
<BR>
i understand that maybe is trying to divide by 0 to calcutate the benchmark stats.<BR>
<BR>
checking the functions, we made a change to fix this problem, by chaning the type of the vars defined as "int", instead of "long int".<BR>
this way seems the commands work fine<BR>
<BR>
/usr/local/kamailio-5.0/sbin/kamcmd -s udp:127.0.0.1:2046 benchmark.enable_global 1<BR>
/usr/local/kamailio-5.0/sbin/kamcmd -s udp:127.0.0.1:2046 benchmark.granularity 0<BR>
error: 500 - Invalid Parameter Value<BR>
<BR>
this are the changes we made<BR>
index d40469b..5a353d5 100644<BR>
--- a/src/modules/benchmark/benchmark.c<BR>
+++ b/src/modules/benchmark/benchmark.c<BR>
@@ -479,7 +479,8 @@ static inline int fixup_bm_timer(void** param, int param_no)<BR>
  */<BR>
 void bm_rpc_enable_global(rpc_t* rpc, void* ctx)<BR>
 {<BR>
-       long int v1;<BR>
+       int v1;<BR>
+       /*long int v1;*/<BR>
        if(rpc->scan(ctx, "d", (int*)(&v1))<1) {<BR>
                LM_WARN("no parameters\n");<BR>
                rpc->fault(ctx, 500, "Invalid Parameters");<BR>
@@ -518,7 +519,8 @@ void bm_rpc_enable_timer(rpc_t* rpc, void* ctx)<BR>
 <BR>
 void bm_rpc_granularity(rpc_t* rpc, void* ctx)<BR>
 {<BR>
-       long int v1;<BR>
+       int v1;<BR>
+        /*long int v1;*/<BR>
        if(rpc->scan(ctx, "d", (int*)(&v1))<1) {<BR>
                LM_WARN("no parameters\n");<BR>
                rpc->fault(ctx, 500, "Invalid Parameters");<BR>
@@ -533,7 +535,8 @@ void bm_rpc_granularity(rpc_t* rpc, void* ctx)<BR>
 <BR>
 void bm_rpc_loglevel(rpc_t* rpc, void* ctx)<BR>
 {<BR>
-       long int v1;<BR>
+       int v1;<BR>
+       /*long int v1;*/<BR>
        if(rpc->scan(ctx, "d", (int*)(&v1))<1) {<BR>
                LM_WARN("no parameters\n");<BR>
                rpc->fault(ctx, 500, "Invalid Parameters");<BR>
<BR>
could you please check if this fix is enough? and maybe there can be some other functions with this problem?<BR>
<BR>
thanks  alot and regards<BR>
david
</BODY>
</HTML>