<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hello,<br>
      <br>
      can you make a pull request with your fixes on github project? It
      makes it easier to review and merge if all ok.<br>
      <br>
      Cheers,<br>
      Daniel<br>
      <br>
      On 31.05.17 18:06, David Escartín Almudévar wrote:<br>
    </div>
    <blockquote cite="mid:1496246795.12096.13.camel@bts.io" type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <meta name="GENERATOR" content="GtkHTML/4.8.4">
      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 <a class="moz-txt-link-freetext" href="udp:127.0.0.1:2046">udp:127.0.0.1:2046</a>
      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 <a class="moz-txt-link-freetext" href="udp:127.0.0.1:2046">udp:127.0.0.1:2046</a>
      benchmark.enable_global 1<br>
      /usr/local/kamailio-5.0/sbin/kamcmd -s <a class="moz-txt-link-freetext" href="udp:127.0.0.1:2046">udp:127.0.0.1:2046</a>
      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
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Kamailio (SER) - Development Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-dev@lists.kamailio.org">sr-dev@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev</a>
</pre>
    </blockquote>
    <p><br>
    </p>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
Kamailio World Conference - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
  </body>
</html>