[sr-dev] [kamailio/kamailio] core: fix a seg while t_continue with nats module (PR #3396)

2023-03-20 Thread Seven Du
!-- Kamailio Pull Request Template --

!--
IMPORTANT:
  - for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
  - pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
  - backports to stable branches must be done with git cherry-pick -x 
...
  - code is contributed under BSD for core and main components (tm, sl, auth, 
tls)
  - code is contributed GPLv2 or a compatible license for the other components
  - GPL code is contributed with OpenSSL licensing exception
--

 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 youre unsure about any of these, dont 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)
- [ ] 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 --
- [x] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue # (replace  with an open issue number)

 Description
!-- Describe your changes in detail --

segfault

```
#0  0xb9934840 in cfg_update_local (no_cbs=0) at 
../../core/cfg/cfg_struct.h:366
366 cfg_child_cb = cfg_child_cb-next;
(gdb) print cfg_child_cb
$1 = (cfg_child_cb_t *) 0x0
```

example lua:

```
function ksr_route_nats()
KSR.tm.t_newtran()
local tindex = KSR.pv.gete($T(id_index))
local tlabel = KSR.pv.gete($T(id_label))
KSR.tmx.t_suspend()

local req = {
jsonrpc = 2.0, method = route,
id = tindex .. : .. tlabel,
params = {
from = KSR.pv.gete($fu),
to = KSR.pv.gete($tu),
}
}
local rpc = cjson.encode(req)
KSR.info(rpc:  .. rpc .. \n)
KSR.nats.publish(cn.xswitch.ctrl.route, rpc)
KSR.x.exit();
end

function handle_nats_response(data)
msg = cjson.decode(data)
if (not msg) or (not msg.id) then return end
KSR.info(= msg.id:  .. msg.id .. \n)

if not msg.result then
KSR.error(response has no result\n)
return
end

tindex, tlabel = msg.id:match((.+):(.+))
if tindex and tlabel then
KSR.pv.sets($var(nats_response), data)
KSR.tmx.t_continue(tindex, tlabel, ksr_nats_continue)
end
end
```

Im not sure if its the proper fix, but this pr fixed the seg. Thanks.


You can view, comment on, or merge this pull request online at:

  https://github.com/kamailio/kamailio/pull/3396

-- Commit Summary --

  * core: fix a seg while t_continue with nats module

-- File Changes --

M src/core/cfg/cfg_struct.h (2)

-- Patch Links --

https://github.com/kamailio/kamailio/pull/3396.patch
https://github.com/kamailio/kamailio/pull/3396.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3396
You are receiving this because you are subscribed to this thread.

Message ID: kamailio/kamailio/pull/3...@github.com
___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org


[sr-dev] git:master:9cc9a177: p_usrloc: use PRIu64 macro to find out what format is needed for uint64_t since it depends on architecture

2023-03-20 Thread Victor Seva
Module: kamailio
Branch: master
Commit: 9cc9a177daf6d5ce11fbdef714bd576716dc5a2f
URL: 
https://github.com/kamailio/kamailio/commit/9cc9a177daf6d5ce11fbdef714bd576716dc5a2f

Author: Victor Seva 
Committer: Victor Seva 
Date: 2023-03-20T16:56:03+01:00

p_usrloc: use PRIu64 macro to find out what format is needed for uint64_t since 
it depends on architecture

---

Modified: src/modules/p_usrloc/ul_check.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/9cc9a177daf6d5ce11fbdef714bd576716dc5a2f.diff
Patch: 
https://github.com/kamailio/kamailio/commit/9cc9a177daf6d5ce11fbdef714bd576716dc5a2f.patch

---

diff --git a/src/modules/p_usrloc/ul_check.c b/src/modules/p_usrloc/ul_check.c
index dfc062f266..0ed32dc99f 100644
--- a/src/modules/p_usrloc/ul_check.c
+++ b/src/modules/p_usrloc/ul_check.c
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
  */
 
+#include 
 #include 
 
 #include "../../core/mem/shm_mem.h"
@@ -136,7 +137,7 @@ int must_retry(time_t *timer, time_t interval){
if(!timer){
return -1;
}
-   LM_DBG("must_retry: time is at %llu, retry at %llu.\n", 
(uint64_t)time(NULL),
+   LM_DBG("must_retry: time is at %" PRIu64 ", retry at %" PRIu64 ".\n", 
(uint64_t)time(NULL),
(uint64_t)(*timer));
if(*timer <= time(NULL)){
*timer = time(NULL) + interval;

___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org


[sr-dev] git:master:1b3224c5: rtpengine: use PRIu64 macro to find out what format is needed for uint64_t since it depends on architecture

2023-03-20 Thread Victor Seva
Module: kamailio
Branch: master
Commit: 1b3224c514105d69c3099c11edc5ef20ca02c567
URL: 
https://github.com/kamailio/kamailio/commit/1b3224c514105d69c3099c11edc5ef20ca02c567

Author: Victor Seva 
Committer: Victor Seva 
Date: 2023-03-20T16:53:15+01:00

rtpengine: use PRIu64 macro to find out what format is needed for uint64_t 
since it depends on architecture

---

Modified: src/modules/rtpengine/rtpengine.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/1b3224c514105d69c3099c11edc5ef20ca02c567.diff
Patch: 
https://github.com/kamailio/kamailio/commit/1b3224c514105d69c3099c11edc5ef20ca02c567.patch

---

diff --git a/src/modules/rtpengine/rtpengine.c 
b/src/modules/rtpengine/rtpengine.c
index 58c96efc0d..51bd9e380a 100644
--- a/src/modules/rtpengine/rtpengine.c
+++ b/src/modules/rtpengine/rtpengine.c
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -1337,7 +1338,7 @@ static void rtpengine_rpc_reload(rpc_t* rpc, void* ctx)
 
_rtpe_list_version->vernum += 1;
_rtpe_list_version->vertime = time(NULL);
-   LM_DBG("current rtpengines list version: %d (%llu)\n",
+   LM_DBG("current rtpengines list version: %d (%" PRIu64 ")\n",
_rtpe_list_version->vernum,
(uint64_t)_rtpe_list_version->vertime);
rpc->rpl_printf(ctx, "Ok. Reload successful.");
@@ -1857,7 +1858,7 @@ static int build_rtpp_socks(int lmode, int rtest) {
 
if(_rtpe_list_vernum_local == _rtpe_list_version->vernum) {
/* same version for the list of rtpengines */
-   LM_DBG("same rtpengines list version: %d (%llu)\n",
+   LM_DBG("same rtpengines list version: %d (%" PRIu64 ")\n",
_rtpe_list_version->vernum,
(uint64_t)_rtpe_list_version->vertime);
return 0;

___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org


[sr-dev] git: new commits in branch master

2023-03-20 Thread Daniel-Constantin Mierla
- URL:  
https://github.com/kamailio/kamailio/commit/926ba9473775878d8f38b175764a50dee15fac69
Author: Daniel-Constantin Mierla 
Date:   2023-03-20T16:28:29+01:00

rtpengine: cast to uint64_t when using time_t value

- URL:  
https://github.com/kamailio/kamailio/commit/e29ce594466385a7c35634fda4b4664d92484622
Author: Daniel-Constantin Mierla 
Date:   2023-03-20T16:28:29+01:00

p_usrloc: cast to uint64_t when using time_t value

- URL:  
https://github.com/kamailio/kamailio/commit/161ec6d14b702cb92406171152d127b0bb85c329
Author: Daniel-Constantin Mierla 
Date:   2023-03-20T16:28:29+01:00

jsonrpcs: protocol extended to allow storing response in a file

- implemented for udp sockets

- URL:  
https://github.com/kamailio/kamailio/commit/4fec664327410db4e5ff7036a459e99abfa539bc
Author: Daniel-Constantin Mierla 
Date:   2023-03-20T16:28:29+01:00

jsonrpcs: implemented result storing for rpc over fifo

- URL:  
https://github.com/kamailio/kamailio/commit/1b5caab3479bb32c2986906e6e07ea9d5be38a8c
Author: Daniel-Constantin Mierla 
Date:   2023-03-20T16:28:29+01:00

kamctl: option to set store path for rpc commands

- URL:  
https://github.com/kamailio/kamailio/commit/e27823f746eb8fca834474945e45bfef27c3d50c
Author: Daniel-Constantin Mierla 
Date:   2023-03-20T16:28:29+01:00

pipelimit: added rpc command pl.rm_pipe

- URL:  
https://github.com/kamailio/kamailio/commit/6c0b62c464bcbc67e485c1e2193b7a6c96e471fb
Author: Daniel-Constantin Mierla 
Date:   2023-03-20T16:28:29+01:00

pipelimit: docs for rpc command pl.rm_pipe

- URL:  
https://github.com/kamailio/kamailio/commit/e0713531bf6ea2aa9b249503dc346ac0d4510a93
Author: Daniel-Constantin Mierla 
Date:   2023-03-20T16:28:30+01:00

pipelimit: new rpc command pl.reset_pipe - reset associated values

- URL:  
https://github.com/kamailio/kamailio/commit/569db2eeaef17f3034f692e808f340103cdbe71e
Author: Daniel-Constantin Mierla 
Date:   2023-03-20T16:28:30+01:00

pipelimit: docs for rpc command pl.reset_pipe

- URL:  
https://github.com/kamailio/kamailio/commit/4c998de5f54ee941f7516e589e2940593b20f827
Author: Daniel-Constantin Mierla 
Date:   2023-03-20T16:28:30+01:00

evapi: wait when idle made a modparam

- URL:  
https://github.com/kamailio/kamailio/commit/3b99e09dc10ff38024b2821b26f2efe7c82d699d
Author: Daniel-Constantin Mierla 
Date:   2023-03-20T16:28:30+01:00

evapi: docs for wait_idle modparam

- URL:  
https://github.com/kamailio/kamailio/commit/3bff060dcb74a081782abdbdade830b61be66557
Author: Daniel-Constantin Mierla 
Date:   2023-03-20T16:28:30+01:00

evapi: use internal workers to handle client messages

- URL:  
https://github.com/kamailio/kamailio/commit/b34e24770a6435577097b173cafab30c6d19e8d1
Author: Daniel-Constantin Mierla 
Date:   2023-03-20T16:28:30+01:00

jsonrpcs: initial support for tcp transport

- one rpc command per connection, which is closed after the response is
  sent

- URL:  
https://github.com/kamailio/kamailio/commit/1400e8cb6aebdd93a5b0c6979a444a81922e37d2
Author: Daniel-Constantin Mierla 
Date:   2023-03-20T16:28:30+01:00

jsonrpcs: more debug messages when handling tcp commands

- URL:  
https://github.com/kamailio/kamailio/commit/7000f437ac8f3fb40c7a55c8c7a3c2c8dfc3fb1b
Author: Daniel-Constantin Mierla 
Date:   2023-03-20T16:28:30+01:00

jsonrpcs: docs for tcp_socket parameter

- URL:  
https://github.com/kamailio/kamailio/commit/58bd64200e4d2f237f192acf6f88074aa983a396
Author: Daniel-Constantin Mierla 
Date:   2023-03-20T16:28:30+01:00

evapi: support for adaptive wait on idle to spare cpu when not busy

- URL:  
https://github.com/kamailio/kamailio/commit/6e4ba9bd7421bf483cdbc7e5484f21d68b8acd8f
Author: Daniel-Constantin Mierla 
Date:   2023-03-20T16:28:30+01:00

evapi: wait increase limit made modparam

- URL:  
https://github.com/kamailio/kamailio/commit/b044c33c72318c12de78c0d8b7f8ac5ffb9b8772
Author: Daniel-Constantin Mierla 
Date:   2023-03-20T16:28:30+01:00

evapi: docs for wait_increase parameter

- URL:  
https://github.com/kamailio/kamailio/commit/1dc0eac9a3a3abd6e128aa5f1d17d5f909efd963
Author: Daniel-Constantin Mierla 
Date:   2023-03-20T16:28:30+01:00

evapi: if workers is 0, execute callback by evapi receiver

- URL:  
https://github.com/kamailio/kamailio/commit/d4be0b2ec72159c5769fc6d7d0cee57e3576a668
Author: Daniel-Constantin Mierla 
Date:   2023-03-20T16:28:30+01:00

evapi: docs - updates to workers parameter

- URL:  
https://github.com/kamailio/kamailio/commit/ab1831efc20816e18a89e6322d16c8e394b59abd
Author: Daniel-Constantin Mierla 
Date:   2023-03-20T16:28:30+01:00

core: skip warning for atomic ops with locking for some dev os-es

- do not print the compile warning for non-native memory barier/atomic
  ops on some devel platforms, for now macos with apple silicon cpu


___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org


[sr-dev] git:master:452af935: modules: readme files regenerated - evapi ... [skip ci]

2023-03-20 Thread Kamailio Dev
Module: kamailio
Branch: master
Commit: 452af935fbcc60572541941612091cbc0535a310
URL: 
https://github.com/kamailio/kamailio/commit/452af935fbcc60572541941612091cbc0535a310

Author: Kamailio Dev 
Committer: Kamailio Dev 
Date: 2023-03-20T16:31:24+01:00

modules: readme files regenerated - evapi ... [skip ci]

---

Modified: src/modules/evapi/README
Modified: src/modules/jsonrpcs/README
Modified: src/modules/pipelimit/README

---

Diff:  
https://github.com/kamailio/kamailio/commit/452af935fbcc60572541941612091cbc0535a310.diff
Patch: 
https://github.com/kamailio/kamailio/commit/452af935fbcc60572541941612091cbc0535a310.patch

___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org


[sr-dev] Re: [kamailio/kamailio] Add support for Linux kernel anyIP feature (Issue #3394)

2023-03-20 Thread Henning Westerholt
Sure, having a complete network on individual workers will waste a lot of 
memory. Just to add a bit more context to this request, this is the feature in 
question 
[link](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ab79ad14a2d51e95f0ac3cef7cd116a57089ba82).
 

This blog post provides some good summary of the option and also explain the 
related IP_FREEBIND option: 
[link](https://oswalt.dev/2022/02/non-local-address-binds-in-linux/)

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3394#issuecomment-1475997089
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org


[sr-dev] git:master:135f7b5e: modules: readme files regenerated - ims_registrar_pcscf ... [skip ci]

2023-03-20 Thread Kamailio Dev
Module: kamailio
Branch: master
Commit: 135f7b5e2114617b0bc408175ec146d248d01d3a
URL: 
https://github.com/kamailio/kamailio/commit/135f7b5e2114617b0bc408175ec146d248d01d3a

Author: Kamailio Dev 
Committer: Kamailio Dev 
Date: 2023-03-20T11:01:25+01:00

modules: readme files regenerated - ims_registrar_pcscf ... [skip ci]

---

Modified: src/modules/ims_registrar_pcscf/README

---

Diff:  
https://github.com/kamailio/kamailio/commit/135f7b5e2114617b0bc408175ec146d248d01d3a.diff
Patch: 
https://github.com/kamailio/kamailio/commit/135f7b5e2114617b0bc408175ec146d248d01d3a.patch

---

diff --git a/src/modules/ims_registrar_pcscf/README 
b/src/modules/ims_registrar_pcscf/README
index 3bfb0e6003..02327a005c 100644
--- a/src/modules/ims_registrar_pcscf/README
+++ b/src/modules/ims_registrar_pcscf/README
@@ -312,6 +312,33 @@ pcscf_save("location");
  * domain - Logical domain within the registrar. If a database is used
then this must be name of the table which stores the contacts.
 
+   The return code may have the following values:
+ * ( 1) OK
+ * (-1) Parsing of contact data failed
+ * (-2) Deregistration in progress
+
+   For db_mode = DB_ONLY (3) setting for ims_usrloc_pcscf module modparam
+   following logic is implemented:
+ * To avoid race time conditions between a REREGISTER and the expiry
+   handler state machine in the scscf an approach is chosen to refuse
+   a REREGISTER in time window of 20 seconds after pcontact expiry on
+   the pcscf (thus allowing expiry handling to finish). REREGISTER is
+   refused in this scenario with return code -2.
+ * In case a REREGISTER arrives at pcscf and the respective pcontact
+   is expired longer than time window of 20 seconds registration also
+   is refused with return code -2 and additionaly PUBLISH is sent to
+   scscf with expiry = 0.
+ * The rc -2 shall be handled in register.cfg script as follows:
+   pcscf_save_pending("location");
+   switch ($retcode) {
+   case -1:
+   ...
+   case -2:
+   send_reply("500", "Deregister in progress - Please try again");
+   exit;
+   break;
+   }
+
 4.3. pcscf_follows_service_routes(domain)
 
Returns true, if the request is following the "learned" service-routes

___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org


[sr-dev] Re: [kamailio/kamailio] ims_registrar_pcscf: changes for ul db_mode DB_ONLY (PR #3317)

2023-03-20 Thread Henning Westerholt
Merged #3317 into master.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3317#event-8792424533
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org


[sr-dev] git:master:38d72c3f: ims_registrar_pcscf: changes for ul db_mode DB_ONLY

2023-03-20 Thread Henning Westerholt
Module: kamailio
Branch: master
Commit: 38d72c3f8248b32b3ba0ff24abd1f2f7407f9d8f
URL: 
https://github.com/kamailio/kamailio/commit/38d72c3f8248b32b3ba0ff24abd1f2f7407f9d8f

Author: Annemarie Mandl 
Committer: Henning Westerholt 
Date: 2023-03-20T10:57:21+01:00

ims_registrar_pcscf:  changes for ul db_mode DB_ONLY

Enable registration of pcscf contact callback during download
from db location table and inserting pcontact (normally this
callback is registered during handling of REGISTER).
Refuse REGISTER when pcontact is expired since [0 to 20] seconds.
Within this time window a NOTIFY is expected from scscf and in order
to avoid race time conditions between scscf and pcscf REGISTER
will be refused. Refuse REGISTER when pcontact is expired longer
than 20 seconds - send PUBLISH (contact expired) to scscf to trigger
NOTIFY. In both REGISTER refused scenarios routing script should reply
500 - Deregistration in progress.

undo changes in ul_callback.c & ul_callback.h

corrections after comments from Henning

---

Modified: src/modules/ims_registrar_pcscf/doc/ims_registrar_pcscf_admin.xml
Modified: src/modules/ims_registrar_pcscf/ims_registrar_pcscf_mod.c
Modified: src/modules/ims_registrar_pcscf/notify.c
Modified: src/modules/ims_registrar_pcscf/save.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/38d72c3f8248b32b3ba0ff24abd1f2f7407f9d8f.diff
Patch: 
https://github.com/kamailio/kamailio/commit/38d72c3f8248b32b3ba0ff24abd1f2f7407f9d8f.patch

___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org