#1762 ## Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [x] Commit message has the format required by CONTRIBUTING guide
- [x] Commits are split per component (core, individual modules, libs, utils, ...)
- [x] Each component has a single commit (if not, squash them into one commit)
- [x] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [x] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [x] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
Fix invalid JSON returned by stats.fetch with multiple modules as parameter.
Cleanup by reducing code duplication.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2537
-- Commit Summary --
* kex: Make stats.fetch(n) reply with valid JSON
* kex: Remove a lot of duplicate code from rpc_stats_fetch*
* kex: Let the RPC server do printf as it may have optimizations
-- File Changes --
M src/modules/kex/core_stats.c (222)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2537.patchhttps://github.com/kamailio/kamailio/pull/2537.diff
--
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/pull/2537
Module: kamailio
Branch: master
Commit: 2300d0a2a9c78c72c67596eb129cf7bf86bf300b
URL: https://github.com/kamailio/kamailio/commit/2300d0a2a9c78c72c67596eb129cf7b…
Author: Alex Hermann <alex(a)hexla.nl>
Committer: Alex Hermann <alex(a)hexla.nl>
Date: 2020-10-29T15:24:22+01:00
kex: Let the RPC server do printf as it may have optimizations
Some RPC server implementations may print directly to the output buffer, so
this eliminates a string copy.
---
Modified: src/modules/kex/core_stats.c
---
Diff: https://github.com/kamailio/kamailio/commit/2300d0a2a9c78c72c67596eb129cf7b…
Patch: https://github.com/kamailio/kamailio/commit/2300d0a2a9c78c72c67596eb129cf7b…
---
diff --git a/src/modules/kex/core_stats.c b/src/modules/kex/core_stats.c
index 1ebd235752..a1f14a7dc6 100644
--- a/src/modules/kex/core_stats.c
+++ b/src/modules/kex/core_stats.c
@@ -492,15 +492,13 @@ static void rpc_stats_get_statistics(rpc_t* rpc, void* ctx)
static void rpc_fetch_add_stat(rpc_t* rpc, void* ctx, void* hst, char* g, char* n, unsigned long val, int numeric) {
char nbuf[128];
- char vbuf[32];
int res;
snprintf(nbuf, 127, "%s.%s", g, n);
if (numeric) {
res = rpc->struct_add(hst, "d", nbuf, val);
} else {
- snprintf(vbuf, 31, "%lu", val);
- res = rpc->struct_add(hst, "s", nbuf, vbuf);
+ res = rpc->struct_printf(hst, nbuf, "%lu", val);
}
if (res<0)
{
Module: kamailio
Branch: master
Commit: 0ad80449d8da33732b7b67f1a681fa68c45280e4
URL: https://github.com/kamailio/kamailio/commit/0ad80449d8da33732b7b67f1a681fa6…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2020-11-05T12:21:23+01:00
permissions: document reload_delta parameter
---
Modified: src/modules/permissions/doc/permissions_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/0ad80449d8da33732b7b67f1a681fa6…
Patch: https://github.com/kamailio/kamailio/commit/0ad80449d8da33732b7b67f1a681fa6…
---
diff --git a/src/modules/permissions/doc/permissions_admin.xml b/src/modules/permissions/doc/permissions_admin.xml
index adca339d77..e3b65816e5 100644
--- a/src/modules/permissions/doc/permissions_admin.xml
+++ b/src/modules/permissions/doc/permissions_admin.xml
@@ -846,6 +846,33 @@ modparam("permissions", "load_backends", 1)
</programlisting>
</example>
</section>
+ <section id ="permissions.p.reload_delta">
+ <title><varname>reload_delta</varname> (int)</title>
+ <para>
+ The number of seconds that have to be waited before executing a new
+ RPC reload. By default there is a rate limiting of maximum one reload
+ in five seconds.
+ </para>
+ <para>
+ If set to 0, no rate limit is configured. Note carefully: use this
+ configuration only in tests environments because executing two RPC
+ reloads of the same table at the same time can cause to kamailio
+ to crash.
+ </para>
+ <para>
+ <emphasis>
+ Default value is <quote>5</quote>.
+ </emphasis>
+ </para>
+ <example>
+ <title>Set <varname>reload_delta</varname> parameter</title>
+ <programlisting format="linespecific">
+...
+modparam("permissions", "reload_delta", 1)
+...
+ </programlisting>
+ </example>
+ </section>
</section>
<section>
@@ -1278,8 +1305,8 @@ if (allow_trusted("$si", "any", "$ai")) {
different tables: address table and
subnet table depending on the value of
the mask field (IPv6: 64 or smaller, IPv4: 32 or smaller).
- Note that there is a rate limiting of maximum one reload in
- five seconds.
+ Note that there is a rate limiting defined by 'reload_delta'
+ paramenter. By default is allowed maximum one reload in five seconds.
</para>
<para>Parameters: <emphasis>none</emphasis></para>
</section>
@@ -1361,8 +1388,8 @@ if (allow_trusted("$si", "any", "$ai")) {
<para>
Causes the permissions module to re-read the contents of
the trusted database table into cache memory.
- Note that there is a rate limiting of maximum one reload in
- five seconds.
+ Note that there is a rate limiting defined by 'reload_delta'
+ paramenter. By default is allowed maximum one reload in five seconds.
</para>
<para>Parameters: <emphasis>none</emphasis></para>
</section>
Module: kamailio
Branch: master
Commit: 8d8857314a6d7979dbd5fde584d24919ac1c3328
URL: https://github.com/kamailio/kamailio/commit/8d8857314a6d7979dbd5fde584d2491…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2020-11-05T11:46:32+01:00
modules: readme files regenerated - permissions ... [skip ci]
---
Modified: src/modules/permissions/README
---
Diff: https://github.com/kamailio/kamailio/commit/8d8857314a6d7979dbd5fde584d2491…
Patch: https://github.com/kamailio/kamailio/commit/8d8857314a6d7979dbd5fde584d2491…
---
diff --git a/src/modules/permissions/README b/src/modules/permissions/README
index 9837cfd1b2..ebb097b2cd 100644
--- a/src/modules/permissions/README
+++ b/src/modules/permissions/README
@@ -1024,7 +1024,8 @@ if (allow_trusted("$si", "any", "$ai")) {
database table into cache memory. In cache memory the entries are for
performance reasons stored in two different tables: address table and
subnet table depending on the value of the mask field (IPv6: 64 or
- smaller, IPv4: 32 or smaller).
+ smaller, IPv4: 32 or smaller). Note that there is a rate limiting of
+ maximum one reload in five seconds.
Parameters: none
@@ -1066,7 +1067,8 @@ if (allow_trusted("$si", "any", "$ai")) {
5.7. permissions.trustedReload
Causes the permissions module to re-read the contents of the trusted
- database table into cache memory.
+ database table into cache memory. Note that there is a rate limiting of
+ maximum one reload in five seconds.
Parameters: none