### Description
Timer on pipelimit doesn't seem to be working. When changing the time interval the limit gets changed in a way that it's multiplied by the time interval. For example if I use a time interval of 1 second and a limit of 20 (if (!pl_check("$si", "TAILDROP", "20"))) the module start limiting right after the traffic gets over 20 CPS. But if I change the time interval to 3 seconds, the module starts limiting the traffic right after 60 CPS. This is my configuration:
# ----- pipelimit params-----
modparam("pipelimit", "timer_interval", 3)
modparam("pipelimit", "hash_size", 10)
modparam("pipelimit", "db_url", DBURL)
modparam("pipelimit", "reply_code", 503)
modparam("pipelimit", "reply_reason", "Limiting")
...
...
...
request_route {
...
...
if(is_method("INVITE")) {
$var(limit) = 20;
if (!pl_check("$si", "TAILDROP", "$var(limit)")) {
xlog("L_INFO", "[$ci] $si - Limiting INVITE using pipe $var(limit) req/sec\n");
pl_drop();
exit;
}
.....
.....
.....
}
}
Checking the source for pipelimit module (https://github.com/kamailio/kamailio/blob/master/src/modules/pipelimit/pipe…) I see that for taildrop it's checking for the limit times the time_interval:
case PIPE_ALGO_TAILDROP:
ret = (pipe->counter <= pipe->limit * timer_interval) ? 1 : -1;
break;
I've made a change eliminating the time_interval (set it to 1) from that check and after that I've got the limit working OK, and the traffic gets drop right after it's over the limit (20 cps) using any time_interval. Is there some issue with the timer for the check not being updated by the module settings (timer_interval)? I'm using kamailio 4.4 and I've also tested it in kamailio 4.3 and 5.1 with same results.
### Troubleshooting
#### Reproduction
#### Debugging Data
### Additional Information
version: kamailio 4.4.6 (x86_64/linux) 212b33
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: 212b33
compiled on 13:02:03 Dec 15 2017 with gcc 4.9.2
* **Operating System**:
Linux sjc-lb-test-cps.telnyx.com 3.16.0-4-amd64 #1 SMP Debian 3.16.39-1+deb8u2 (2017-03-07) x86_64 GNU/Linux
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1390
Module: kamailio
Branch: master
Commit: 5e7330cd419d8d149cc4a4ca6105d1bfa11996be
URL: https://github.com/kamailio/kamailio/commit/5e7330cd419d8d149cc4a4ca6105d1b…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2018-01-13T18:32:27+01:00
modules: readme files regenerated - nathelper ... [skip ci]
---
Modified: src/modules/nathelper/README
---
Diff: https://github.com/kamailio/kamailio/commit/5e7330cd419d8d149cc4a4ca6105d1b…
Patch: https://github.com/kamailio/kamailio/commit/5e7330cd419d8d149cc4a4ca6105d1b…
---
diff --git a/src/modules/nathelper/README b/src/modules/nathelper/README
index 55a1245053..102a639ea0 100644
--- a/src/modules/nathelper/README
+++ b/src/modules/nathelper/README
@@ -249,15 +249,14 @@ Chapter 1. Admin Guide
4.1. force_socket (string)
- Socket to be used when sending NAT pings for UDP communication.
- It uses the first socket it finds based on the IP address. If
- no one specified, the OS will choose a socket.
+ Socket to be used when sending NAT pings for UDP communication. If no
+ one specified, the OS will choose a socket.
Default value is “NULL”.
Example 1.1. Set force_socket parameter
...
-modparam("nathelper", "force_socket", "127.0.0.1")
+modparam("nathelper", "force_socket", "127.0.0.1:5060")
...
4.2. natping_interval (integer)