[OpenSIPS-Users] rl_check some pipe are missing.

Răzvan Crainea razvan at opensips.org
Mon Oct 12 11:20:10 EST 2020


Hi, Alain!

Sorry for the late reply, has been hell of a few weeks for me, and I 
didn't get any chance to check this out.
I've just run a few tests and managed to pinpoint the issue, and also 
create a fix for it. I've just pushed it in commit a66164811.
Please pull the latest sources you're using and give it a try.

Regarding the $rl_count variable, you are right, the counter is not 
correctly printed. The reason is that the $rl_count variable does not 
accept a formatted name: it only works with a string, or with a 
variable. So available versions are:

1. $rl_count($si) # OK
2. $rl_count($si-real) # NOK - this will return the value of $rl_count($si)
3. $var(name) = $si + "-real"; rl_count($var(name)) # OK

Best regards,

Răzvan Crainea
OpenSIPS Core Developer
http://www.opensips-solutions.com

On 9/29/20 10:59 AM, Alain Bieuzent wrote:
> Hi Răzvan !
> 
> Ok i'm trying to don't use rl_list but export the data from my script with rl_count().
> 
> I made a few test with this code :
> 
> rl_check("$si", 100, "TAILDROP");
> rl_check("$si", 100, "TAILDROP");
> xlog("L_NOTICE", "$si|$rl_count($si)");
> 
> rl_check("$si-real", 1000, "TAILDROP");
> xlog("L_NOTICE", "$si-real|$rl_count($si-real)");
> 
> rl_check("real-$si", 1000, "TAILDROP");
> xlog("L_NOTICE", "real-$si|$rl_count(real-$si)");
> 
> the output is :
> 
> Sep 29 09:36:53 lbsip-test opensips[8618]: 185.101.180.36|2
> Sep 29 09:36:53 lbsip-test opensips[8618]: 185.101.180.36-real|2
> Sep 29 09:36:53 lbsip-test opensips[8618]: real-185.101.180.36|<null>
> 
> The first line (for $si) is correct,
> the second line (for si-real) is wrong because counter =2 but we call rl_check("$si-real", only one time.
> The third is wrong also because value is null
> 
> But if at the same time we run rl_list from opensips-cli, no value are missing and all counter are correct !!
> 
> root at lbsip-test  /usr/local/etc/opensips  opensips-cli -x mi rl_list
> {
>      "Pipes": [
>          {
>              "id": "185.101.180.36",
>              "algorithm": "TAILDROP",
>              "limit": 100,
>              "counter": 2
>          },
>          {
>              "id": "185.101.180.36-real",
>              "algorithm": "TAILDROP",
>              "limit": 1000,
>              "counter": 1
>          },
>          {
>              "id": "real-185.101.180.36",
>              "algorithm": "TAILDROP",
>              "limit": 1000,
>              "counter": 1
>          }
>      ],
>      "drop_rate": 0
> }
> 
> Thanks
> 
> Le 28/09/2020 09:43, « Users au nom de Răzvan Crainea » <users-bounces at lists.opensips.org au nom de razvan at opensips.org> a écrit :
> 
>      Hi, Alain!
> 
>      One thing that I can think of is that the commands you are running (both
>      from script and from MI) are not atomic - this means that from the time
>      you run rl_list, until the time the last one gets executed, new pipes
>      might appear/disappear. So it is almost impossible to get an accurate
>      "snapshot".
>      I don't have other ideas, but it's worth taking this into account.
> 
>      Best regards,
> 
>      Răzvan Crainea
>      OpenSIPS Core Developer
>      http://www.opensips-solutions.com
> 
>      On 9/23/20 10:47 AM, Alain Bieuzent wrote:
>      > Hello all,
>      >
>      > Do we need more info ?
>      >
>      > Someone can help me ?
>      >
>      > Thanks
>      >
>      > *De : *Users <users-bounces at lists.opensips.org> au nom de Alain Bieuzent
>      > <alain.bieuzent at free.fr>
>      > *Répondre à : *OpenSIPS users mailling list <users at lists.opensips.org>
>      > *Date : *lundi 21 septembre 2020 à 10:18
>      > *À : *<users at lists.opensips.org>
>      > *Objet : *[OpenSIPS-Users] rl_check some pipe are missing.
>      >
>      > Hi All,
>      >
>      > We are using ratelimit module with opensips 3.0.3.
>      >
>      > Since we migrate from 2.4.7 to 3.0.3, the data export with opensips-cli
>      > are strange, there is some data missing.
>      >
>      > For example we put this rl_check at the same part of the code (to
>      > exclude an issue with $avp(cps), with add 2 more check with a fix value)
>      >
>      >      rl_check("IP-$si", $(avp(cps){s.int}), "TAILDROP");
>      >
>      >      rl_check("IP2-$si",9999 , "TAILDROP");
>      >
>      >      rl_check("IP3-$si",10000 , "TAILDROP");
>      >
>      > when we export the value with opensips cli, we don’t have the same
>      > number of pipe :
>      >
>      > opensips-cli -x mi rl_list | grep IP- | wc -l &&  opensips-cli -x mi
>      > rl_list | grep IP2- | wc -l && opensips-cli -x mi rl_list | grep IP3- |
>      > wc -l
>      >
>      > 111
>      >
>      > 121
>      >
>      > 145
>      >
>      > Any idea ?
>      >
>      > Thanks
>      >
>      > _______________________________________________ Users mailing list
>      > Users at lists.opensips.org
>      > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>      >
>      >
>      > _______________________________________________
>      > Users mailing list
>      > Users at lists.opensips.org
>      > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>      >
> 
>      _______________________________________________
>      Users mailing list
>      Users at lists.opensips.org
>      http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> 
> 
> 
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> 



More information about the Users mailing list