Module: kamailio
Branch: master
Commit: 5dbee20d7d44bae21f3a225966808576285ef2eb
URL: https://github.com/kamailio/kamailio/commit/5dbee20d7d44bae21f3a22596680857…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2022-08-21T15:46:09+02:00
modules: readme files regenerated - topos ... [skip ci]
---
Modified: src/modules/topos/README
---
Diff: https://github.com/kamailio/kamailio/commit/5dbee20d7d44bae21f3a22596680857…
Patch: https://github.com/kamailio/kamailio/commit/5dbee20d7d44bae21f3a22596680857…
---
diff --git a/src/modules/topos/README b/src/modules/topos/README
index 774cc4f347..1f8e8c191d 100644
--- a/src/modules/topos/README
+++ b/src/modules/topos/README
@@ -500,11 +500,11 @@ modparam("topos", "methods_nocontact", "CANCEL,PRACK")
List of headers to disable multiple comma separated values inserted in
compact form. Altough compact form is RFC compliant this paramter gives
- possibilty to disable compact form header values for UA that dont
- support/handle it. The following options are available: (1) - disable
- multiple comma separated values for Via header (2) - disable multiple
- comma separated values for Record-Route header (4) - disable multiple
- comma separated values for Route header
+ possibilty to disable compact form header values for UA that don't
+ support or can't handle it. The following options are available: (1) -
+ disable multiple comma separated values for Via header (2) - disable
+ multiple comma separated values for Record-Route header (4) - disable
+ multiple comma separated values for Route header
Default value is “0”.
Module: kamailio
Branch: master
Commit: 7dd3658e248a6c64b1606ebebac76869a006b911
URL: https://github.com/kamailio/kamailio/commit/7dd3658e248a6c64b1606ebebac7686…
Author: Henning Westerholt <hw(a)gilawa.com>
Committer: Henning Westerholt <hw(a)gilawa.com>
Date: 2022-08-21T13:31:51Z
topos: small doc improvements related to header_mode parameter
---
Modified: src/modules/topos/doc/topos_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/7dd3658e248a6c64b1606ebebac7686…
Patch: https://github.com/kamailio/kamailio/commit/7dd3658e248a6c64b1606ebebac7686…
---
diff --git a/src/modules/topos/doc/topos_admin.xml b/src/modules/topos/doc/topos_admin.xml
index c15fcf245e..dcf61a0fed 100644
--- a/src/modules/topos/doc/topos_admin.xml
+++ b/src/modules/topos/doc/topos_admin.xml
@@ -551,11 +551,11 @@ modparam("topos", "methods_nocontact", "CANCEL,PRACK")
<para>
List of headers to disable multiple comma separated values inserted in compact form.
Altough compact form is RFC compliant this paramter gives possibilty to disable
- compact form header values for UA that dont support/handle it.
+ compact form header values for UA that don't support or can't handle it.
The following options are available:
- (1) - disable multiple comma separated values for Via header
+ (1) - disable multiple comma separated values for Via header
(2) - disable multiple comma separated values for Record-Route header
(4) - disable multiple comma separated values for Route header
<!-- Kamailio Pull Request Template -->
Topos module always put a single Via header with multiple comma separated values.
Even if this behaviour is RFC compliant there should a possibilty to disable that behaviour four uas that dont support/handle that.
this pull request adds a new parameter topos module to disable that behaviour if needed otherwise the default topos compact form is used.
```
modparam("topos", "separate_via", 1)
```
<!--
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 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
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [x] 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 #3216
#### Description
<!-- Describe your changes in detail -->
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3220
-- Commit Summary --
* topos: enable multiple Via values in separate via header
-- File Changes --
M src/modules/topos/topos_mod.c (2)
M src/modules/topos/tps_msg.c (48)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3220.patchhttps://github.com/kamailio/kamailio/pull/3220.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3220
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3220(a)github.com>
Module: kamailio
Branch: master
Commit: 54fe9d29d15bd15b60950035ad348baacbb868fe
URL: https://github.com/kamailio/kamailio/commit/54fe9d29d15bd15b60950035ad348ba…
Author: Mvondo Eric <106535097+emvondo(a)users.noreply.github.com>
Committer: GitHub <noreply(a)github.com>
Date: 2022-08-21T15:19:51+02:00
topos: disable multiple comma separated values in One Single Via, Record-Route or Route header if needed (#3220)
* topos: enable multiple Via values in separate via header
* topos: disable multiple comma separated values in One Single Via, Record-Route or Route header
* topos: disable multiple comma separated values in One Single Via, Record-Route or Route header
* topos: disable multiple comma separated values in One Single Via, Record-Route or Route header
* change parameter name for disabling compact form values
---
Modified: src/modules/topos/doc/topos_admin.xml
Modified: src/modules/topos/topos_mod.c
Modified: src/modules/topos/tps_msg.c
Modified: src/modules/topos/tps_msg.h
---
Diff: https://github.com/kamailio/kamailio/commit/54fe9d29d15bd15b60950035ad348ba…
Patch: https://github.com/kamailio/kamailio/commit/54fe9d29d15bd15b60950035ad348ba…
#### Pre-Submission Checklist
- [X] Commit message has the format required by CONTRIBUTING guide
- [X] Commits are split per component (core, individual modules, libs, utils, ...)
- [ ] 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)
- [X] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
- [ ] PR should be backported to stable branches (no, it is a requirement to use UDP/IPv6 with everyone)
- [X] Tested changes locally (same results as before with the Kamailio test framework)
- [ ] Related to issue #3119
#### Description
The IPv6 support for Path MTU discovery is absent, but IPv6 has no DF flag to allow downstream fragmentation. See Issue #3119 for my discovery / learning path. In short, unconnected UDP sockets do not learn Path MTU problems, so a message dropped once will be dropped again on resend. Using `IPV6_PMTUDISC_WANT`, any knowledge in the kernel can be used to fragment the message at sending time, as intended for IPv6.
These patches actually correct two IPv6-related things in the `core/udp_server.c`,
1. Benefit from any kernel knowledge about Path MTU for IPv6
2. The same option to learn from UDP_ERRORS is now available for IPv6
Do note that the last has not been implemented for IPv4 or IPv6. It is more useful for IPv6, allowing instant "tm" resends for Path MTU, but not "sl" I think. I cannot do that work, but this brings IPv6 to the same level as IPv4.
```
commit 0f90cff05c1a448eb2f85f83b4c087ab32ede11
Author: Rick van Rein <rick(a)openfortress.nl>
Date: Sat Jun 11 10:57:32 2022 +0000
core: Issue 3119. Handling ICMPv6 Packet too Big
- This was only defined for IPv4 under flag UDP_ERRORS
- IPv6 has no toggle DF to clear for en-route fragmentation
- Kamailio currently does not collect with recvmsg(...,MSG_ERRQUEUE)
- The benefits of adding that can be instant resends for "tm" messages
- Note that "sl" messages will have been forgotten at this point
commit 6b404b5f9807174177bee36eaf3543be0794f55e
Author: Rick van Rein <rick(a)openfortress.nl>
Date: Sat Jun 11 10:44:27 2022 +0000
core: Issue #3119. Path MTU kernel info for IPv6
- For IPv4, DF is an option; for IPv6 it is always active
- This makes pmtu_discover an IPv4-only option
- This means that we should set IPV6_MTU_DISCOVER to IPV6_PMTUDISC_WANT
- Unconnected UDP sockets can now learn from ICMPv6 "Packet too Big"
- As a result, hitting a Path MTU upper bound is a learning process
- This should stop consistent SIP packet drops due to Path MTU
```
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3141
-- Commit Summary --
* core: Issue #3119. Path MTU kernel info for IPv6
* core: Issue 3119. Handling ICMPv6 Packet too Big
-- File Changes --
M doc/misc/NEWS (2)
M src/core/udp_server.c (44)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3141.patchhttps://github.com/kamailio/kamailio/pull/3141.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3141
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3141(a)github.com>
Module: kamailio
Branch: master
Commit: a022dbd6b30d8301053950756cd30a2b478433e0
URL: https://github.com/kamailio/kamailio/commit/a022dbd6b30d8301053950756cd30a2…
Author: Henning Westerholt <hw(a)gilawa.com>
Committer: Henning Westerholt <hw(a)gilawa.com>
Date: 2022-08-21T12:38:16Z
core: add pmtu_discovery=2 for IPv4 and IPv6 - set IP_PMTUDISC_WANT/IPV6_PMTUDISC_WANT (GH #3141)
- add pmtu_discovery=2 for IPv4 and IPv6 - set IP_PMTUDISC_WANT/IPV6_PMTUDISC_WANT
- related to GH #3141
- for IPv4: will fragment a datagram if needed according to the path MTU,
or will set the don't-fragment flag otherwise
- for IPv6: will fragment a datagram if needed according to the path MTU for IPv6
---
Modified: src/core/udp_server.c
---
Diff: https://github.com/kamailio/kamailio/commit/a022dbd6b30d8301053950756cd30a2…
Patch: https://github.com/kamailio/kamailio/commit/a022dbd6b30d8301053950756cd30a2…
---
diff --git a/src/core/udp_server.c b/src/core/udp_server.c
index 7c501f0dab..3edf485199 100644
--- a/src/core/udp_server.c
+++ b/src/core/udp_server.c
@@ -349,9 +349,19 @@ int udp_init(struct socket_info* sock_info)
#endif
#if defined (__OS_linux)
if (addr->s.sa_family==AF_INET){
- /* If pmtu_discovery=1 then set DF bit and do Path MTU discovery
- * disabled by default. Specific to IPv4. */
- optval= (pmtu_discovery) ? IP_PMTUDISC_DO : IP_PMTUDISC_DONT;
+ /* If pmtu_discovery=1 then set DF bit and do Path MTU discovery,
+ * disabled by default. Specific to IPv4. If pmtu_discovery=2
+ * then the datagram will be fragmented if needed according to
+ * path MTU, or will set the don't-fragment flag otherwise */
+ switch (pmtu_discovery) {
+ case 1: optval=IP_PMTUDISC_DO;
+ break;
+ case 2: optval=IP_PMTUDISC_WANT;
+ break;
+ case 0:
+ default: optval=IP_PMTUDISC_DONT;
+ break;
+ }
if(setsockopt(sock_info->socket, IPPROTO_IP, IP_MTU_DISCOVER,
(void*)&optval, sizeof(optval)) ==-1){
LM_ERR("IPv4 setsockopt: %s\n", strerror(errno));
@@ -359,9 +369,19 @@ int udp_init(struct socket_info* sock_info)
}
} else if (addr->s.sa_family==AF_INET6){
/* IPv6 never fragments but sends ICMPv6 Packet too Big,
- * If pmtu_discovery=1 then set DF bit and do Path MTU discovery
- * disabled by default. Specific to IPv6. */
- optval= (pmtu_discovery) ? IPV6_PMTUDISC_DO : IPV6_PMTUDISC_DONT;
+ * If pmtu_discovery=1 then set DF bit and do Path MTU discovery,
+ * disabled by default. Specific to IPv6. If pmtu_discovery=2
+ * then the datagram will be fragmented if needed according to
+ * path MTU */
+ switch (pmtu_discovery) {
+ case 1: optval=IPV6_PMTUDISC_DO;
+ break;
+ case 2: optval=IPV6_PMTUDISC_WANT;
+ break;
+ case 0:
+ default: optval=IPV6_PMTUDISC_DONT;
+ break;
+ }
if(setsockopt(sock_info->socket, IPPROTO_IPV6,
IPV6_MTU_DISCOVER,
(void*)&optval, sizeof(optval)) ==-1){
Module: kamailio
Branch: master
Commit: 24cfce96a1e9e970ab7661a4e188dab2b3542fd0
URL: https://github.com/kamailio/kamailio/commit/24cfce96a1e9e970ab7661a4e188dab…
Author: Henning Westerholt <hw(a)gilawa.com>
Committer: Henning Westerholt <hw(a)gilawa.com>
Date: 2022-08-19T14:02:16Z
tm: improve comment related to dns failover, add debug output in this case
---
Modified: src/modules/tm/timer.c
---
Diff: https://github.com/kamailio/kamailio/commit/24cfce96a1e9e970ab7661a4e188dab…
Patch: https://github.com/kamailio/kamailio/commit/24cfce96a1e9e970ab7661a4e188dab…
---
diff --git a/src/modules/tm/timer.c b/src/modules/tm/timer.c
index 4c821ba871..8437b4ed40 100644
--- a/src/modules/tm/timer.c
+++ b/src/modules/tm/timer.c
@@ -442,12 +442,14 @@ inline static void final_response_handler(
BLST_ERR_TIMEOUT, &r_buf->dst, r_buf->my_T->uas.request);
#endif
#ifdef USE_DNS_FAILOVER
- /* if this is an invite, the destination resolves to more ips, and
- * it still hasn't passed more than fr_inv_timeout since we
- * started, add another branch/uac */
+ /* if this is an request, the destination resolves to more IPs, and
+ * it still hasn't passed more than max_inv_lifetime or
+ * max_noninv_lifetimesince we started, add another branch/uac */
if(cfg_get(core, core_cfg, use_dns_failover)) {
now = get_ticks_raw();
if((s_ticks_t)(t->end_of_life - now) > 0) {
+ LM_DBG("send on branch %d failed, adding another branch\n",
+ r_buf->branch);
branch_ret = add_uac_dns_fallback(
t, t->uas.request, &t->uac[r_buf->branch], 0);
prev_branch = -1;
Module: kamailio
Branch: master
Commit: d6b1c20d3ad94d9136cf247e67b7fc0d32b18d3b
URL: https://github.com/kamailio/kamailio/commit/d6b1c20d3ad94d9136cf247e67b7fc0…
Author: Henning Westerholt <hw(a)gilawa.com>
Committer: Henning Westerholt <hw(a)gilawa.com>
Date: 2022-08-09T14:11:59Z
tm: restore X/AVP values from initial transaction in DNS failover processing
- restore X/AVP values from initial transaction in DNS failover processing
- the X/AVP context gets lost, so we need to re-create it from the transaction
- otherwise modules that depends on the X/AVPs, e.g. topology hiding will not work
- tested with one load-balancer and two proxy servers
---
Modified: src/modules/tm/t_fwd.c
---
Diff: https://github.com/kamailio/kamailio/commit/d6b1c20d3ad94d9136cf247e67b7fc0…
Patch: https://github.com/kamailio/kamailio/commit/d6b1c20d3ad94d9136cf247e67b7fc0…
---
diff --git a/src/modules/tm/t_fwd.c b/src/modules/tm/t_fwd.c
index fbcf1b3e02..6b26f28f6a 100644
--- a/src/modules/tm/t_fwd.c
+++ b/src/modules/tm/t_fwd.c
@@ -1042,6 +1042,8 @@ int add_uac_dns_fallback(struct cell *t, struct sip_msg* msg,
t->uac[t->nr_of_outgoings].on_branch_failure = old_uac->on_branch_failure;
/* copy branch flags */
t->uac[t->nr_of_outgoings].branch_flags = old_uac->branch_flags;
+ /* restore X/AVP values from initial transaction */
+ tm_xdata_swap(t, 0, 0);
if (cfg_get(tm, tm_cfg, reparse_on_dns_failover)){
/* Reuse the old buffer and only replace the via header.
<!--
Kamailio Project uses GitHub Issues only for bugs in the code or feature requests. Please use this template only for bug reports.
If you have questions about using Kamailio or related to its configuration file, ask on sr-users mailing list:
* http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
If you have questions about developing extensions to Kamailio or its existing C code, ask on sr-dev mailing list:
* http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
Please try to fill this template as much as possible for any issue. It helps the developers to troubleshoot the issue.
If there is no content to be filled in a section, the entire section can be removed.
You can delete the comments from the template sections when filling.
You can delete next line and everything above before submitting (it is a comment).
-->
### Description
The keepalive (ka*) features of usrloc does not work for TLS connections (and probably TCP). If a TLS connection is registered, the keepalive code attempts to send OPTIONS packets to the endpoint using UDP. Additionally, a TCP/TLS connection is not re-used and the code attempts to create a new one each request.
### Troubleshooting
#### Reproduction
Enable keepalive and register a phone using TLS
#### Log Messages
Kamailio Host: 10.15.5.116
Phone: 10.15.5.117
Phone is registered and seen in the registry
```
kamctl ul show
{
"jsonrpc": "2.0",
"result": {
"Domains": [{
"Domain": {
"Domain": "location",
"Size": 1024,
"AoRs": [{
"Info": {
"AoR": "anonymous",
"HashID": 3819435025,
"Contacts": [{
"Contact": {
"Address": "sips:anonymous@10.15.5.117:5061",
"Expires": 3531,
"Q": -1,
"Call-ID": "d06e987694afb559",
"CSeq": 521595368,
"User-Agent": "testclient/1.0",
"Received": "[not set]",
"Path": "[not set]",
"State": "CS_NEW",
"Flags": 0,
"CFlags": 0,
"Socket": "tls:10.15.5.116:5061",
"Methods": 7903,
"Ruid": "uloc-62c87f5c-1b6b-2",
"Instance": "<urn:uuid:00000000-0000-1000-8000-0010492e1879>",
"Reg-Id": 0,
"Server-Id": 0,
"Tcpconn-Id": 17,
"Keepalive": 0,
"Last-Keepalive": 1657310753,
"KA-Roundtrip": 0,
"Last-Modified": 1657310753
}
}]
}
}
],
"Stats": {
"Records": 1,
"Max-Slots": 1
}
}
}]
},
"id": 14871
```
When the keepalive code runs it shows the following:
```
Jul 8 14:27:52 localhost kamailio[6976]: 33(7012) DEBUG: usrloc [ul_keepalive.c:112]: ul_ka_urecord(): keepalive for aor: anonymous
Jul 8 14:27:52 localhost kamailio[6976]: 33(7012) DEBUG: usrloc [ul_keepalive.c:235]: ul_ka_urecord(): keepalive request (len: 295) [[
Jul 8 14:27:52 localhost kamailio[6976]: OPTIONS sips:anonymous@10.15.5.117:5061 SIP/2.0
Jul 8 14:27:52 localhost kamailio[6976]: Via: SIP/2.0/UDP 10.15.5.116:5061;branch=z9hG4bKx.20.1.0
Jul 8 14:27:52 localhost kamailio[6976]: From: <sips:10.15.5.116:5061>;tag=uloc-62c87f5c-1b71-1-e3a7f411-62c88538-cc68d-14.1
Jul 8 14:27:52 localhost kamailio[6976]: To: <sip:anonymous@kamailio.org>
Jul 8 14:27:52 localhost kamailio[6976]: Call-ID: ksrulka-20.1
Jul 8 14:27:52 localhost kamailio[6976]: CSeq: 80 OPTIONS
Jul 8 14:27:52 localhost kamailio[6976]: Content-Length: 0
Jul 8 14:27:52 localhost kamailio[6976]: #015
Jul 8 14:27:52 localhost kamailio[6976]: ]]
Jul 8 14:27:52 localhost kamailio[6976]: 33(7012) ERROR: <core> [core/udp_server.c:597]: udp_send(): sendto(sock, buf: 0x7fffe728ece0, len: 295, 0, dst: (10.15.5.117:5061), tolen: 16) - err: Bad file descriptor (9)
```
### Possible Solutions
There are 2 problems here.
First, the address record does not have a transport defined.
https://github.com/kamailio/kamailio/blob/a466d0b73a66b18419555eca437136f1b…
at this point, `sdst.s` is "sips:anonymous@10.15.5.117:5061" so parse_uri returns a proto of `UDP`. If you override the value to "sips:anonymous@10.15.5.117:5061;transport=tls" then the code works as expected. The protocol is detected as TLS and the OPTIONS message generated later has the correct `Via` header.
I'm not sure if the problem is that the address record is missing the transport, or if we need to infer the transport from the socket connection.
The second issue is that the keepalive code doesn't re-use TCP/TLS connections. In the ul_ka_send() function ) all of the socket IDs hardcoded to '0' https://github.com/kamailio/kamailio/blob/a466d0b73a66b18419555eca437136f1b…
This is easily fixable by adding in
```
if(uc->tcpconn_id) {
idst.id = uc->tcpconn_id;
}
```
to `ul_ka_urecord()` and removing all of the `kadst->id=0;` lines from the `ul_ka_send()` function. This works for in-memory during testing. I believe the tcpconn_id field needs to be set in ul_ka_db_records if you're returning it from the DB. I don't have an environment setup to test that.
With those two changes made (hardcoding the transport and fixing the connection id) the keepalives are sent and work as expected:
```
33(19413) DEBUG: usrloc [ul_keepalive.c:112]: ul_ka_urecord(): keepalive for aor: anonymous
33(19413) DEBUG: usrloc [ul_keepalive.c:169]: ul_ka_urecord(): MANUALLY OVERRIDING SDST: sips:anonymous@10.15.5.117:5061;transport=tls
33(19413) DEBUG: usrloc [ul_keepalive.c:247]: ul_ka_urecord(): keepalive request (len: 288) [[
OPTIONS sips:anonymous@10.15.5.117:5061 SIP/2.0
Via: SIP/2.0/TLS 10.15.5.116:5061;branch=z9hG4bKx.33.1.0
From: <sips:10.15.5.116:5061>;tag=uloc-62c8af83-4bd9-1-e3a7f411-62c8b37f-f2a22-21.1
To: <sip:anonymous@kamailio.org>
Call-ID: ksrulka-33.1
CSeq: 80 OPTIONS
Content-Length: 0
]]
33(19413) DEBUG: <core> [core/tcp_main.c:1644]: _tcpconn_find(): found connection by id: 1
33(19413) DEBUG: <core> [core/tcp_main.c:2539]: tcpconn_send_put(): found fd in cache (4, 0x7fbaef193db8, 1)
33(19413) DEBUG: <core> [core/tcp_main.c:2761]: tcpconn_do_send(): sending...
33(19413) DEBUG: <core> [core/tcp_main.c:2794]: tcpconn_do_send(): after real write: c= 0x7fbaef193db8 n=317 fd=4
```
I assume that we'd want to re-use a TCP/TLS connection but maybe that needs to be an option (ka_reuse_tcp) if other people are expecting the current behavior of creating a new connection for each new keepalive request.
### Additional Information
```
version: kamailio 5.7.0-dev0 (x86_64/linux) a466d0
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, 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_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: a466d0
compiled on 11:27:35 Jul 8 2022 with gcc 8.3.0
```
* **Operating System**:
Debian Buster
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3178
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3178(a)github.com>
### Description
While debugging an issue in Kamailio 5.4, I compiled/installed master to see if the issue persists. However, I immediately ran into multiple issues with dialog in master:
#### Using enable_dmq=1
With dmq enabled, I receive the following log lines which did not appear when running 5.4:
```
CRITICAL: dialog [dlg_timer.c:129]: insert_dlg_timer(): Trying to insert a bogus dlg tl=0x7fa0bc21fc80 tl->next=0x7fa0bbf46ba8 tl->prev=0x7fa0bbf46ba8
CRITICAL: dialog [dlg_dmq.c:314]: dlg_dmq_handle_msg(): Unable to insert dlg timer 0x7fa0bc21fc20 [2687:66928]
```
#### Using database
When using database persistence (sqlite and db_mode=3 (SHUTDOWN)), dialogs are not persisted across restarts (which was working in 5.4). There are no obvious log lines, except when I end the call after restarting Kamailio I receive a "unable to find dialog for BYE" message which would be expected if the dialog did not persist.
### Troubleshooting
- I ran the same configuration using 5.4 and neither issue occurred.
- I attempted to identify the troublesome commit by checking out/compiling older commits based on the commit history of the dialog module, but could only go so far back until builds started failing with `module not found: modules/siprepo`. As such I was not able to identify when the behavior changed.
#### Reproduction
DMQ issue: Use dialog module with dmq enabled and start a call that has `dlg_manage();` in the path. My configuration has the following settings:
```
modparam("dmq", "server_address", SERVER_ADDRESS_DMQ)
modparam("dmq", "notification_address", "redacted")
modparam("dmq", "notification_address", "redacted")
modparam("dmq", "num_workers", 6)
modparam("dialog", "default_timeout", 14520)
modparam("dialog", "profiles_with_value", "group")
modparam("dialog", "enable_dmq", 1)
modparam("dialog", "h_id_start", 0)
modparam("dialog", "h_id_step", 16)
```
DB issue: Use dialog module with db enabled. Start a call that has `dlg_manage();` in the path and keep the call open. Observe `kamcmd dlg.list` shows the dialog. Restart kamailio. Observe `kamcmd dlg.list` no longer lists any dialogs. My configuration has the following additional settings:
```
modparam("dialog", "db_url", "sqlite:////kamailio/kamailio.sqlite")
modparam("dialog", "db_mode", 3)
```
### Additional Information
**Kamailio Version**
```
version: kamailio 5.7.0-dev0 (x86_64/linux) f1dcb6
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, 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_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: f1dcb6
compiled on 23:18:23 Aug 15 2022 with gcc 8.3.0```
```
**Operating System**
```
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
Release: 10
Codename: buster
```
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3218
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3218(a)github.com>
Hi!
SBOM - Software Bill of Materials - often comes up in discussions in my projects. There’s a new working group in the IETF working on it and several other standardization bodies.
A starting point is identification of the license in each source code file with a parseable SPDX identifier.
- Is anyone against adding that to our source code?
- Would it be beneficial for packaging in any way?
I think at some point in the future, a SBOM list in <pick format> will be included in packages, in order to be able to produce a SBOM for the container or the machine.
As we have multiple licenses in the source code it’s important to mark every file correctly.
I can start experimenting with http_client, then work myself around, if the dev community doesn’t scream and argue that it’s a bad thing (TM).
Read more here
- SPDX - a linux foundation project ans ISO standard - https://spdx.dev
- Tags in source code - https://spdx.dev/ids/
Cheers,
/O
Module: kamailio
Branch: master
Commit: 02a04a2b544d16ced3d6e59c4458605419880cfe
URL: https://github.com/kamailio/kamailio/commit/02a04a2b544d16ced3d6e59c4458605…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2022-08-17T10:46:42+02:00
modules: readme files regenerated - usrloc ... [skip ci]
---
Modified: src/modules/usrloc/README
---
Diff: https://github.com/kamailio/kamailio/commit/02a04a2b544d16ced3d6e59c4458605…
Patch: https://github.com/kamailio/kamailio/commit/02a04a2b544d16ced3d6e59c4458605…
---
diff --git a/src/modules/usrloc/README b/src/modules/usrloc/README
index d180968e95..a15bc8c62d 100644
--- a/src/modules/usrloc/README
+++ b/src/modules/usrloc/README
@@ -1113,10 +1113,15 @@ modparam("usrloc", "version_table", 0)
Note: the internal keepalive is for the moment implemented only for
contact records stored in memory.
- Note: it is recommeder to set 'timer_procs' parameter in order to have
+ Note: it is recommended to set 'timer_procs' parameter in order to have
dedicated timer processes for usrloc module and off-load the keepalive
sending process from the core timers.
+ Note: Keepalives will be sent to the IP and port using the transport
+ defined in the âreceivedâ column. If not set, then keepalives will
+ be sent to the AOR using UDP as a default transport. If available, the
+ TCP connection will be re-used for WS, TCP and TLS.
+
Default value is “0 (keepalive disabled)”.
Example 1.50. ka_mode parameter usage
- Fixes GH #3178. Sets TCP connection id for keepalive based on the value in the database
If unset, tcpconn_id will remain 0 and keepalives will work the same as they do today
- Update documentation to clarify when it will use received vs AOR for keepalive
<!-- 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 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
- [ ] 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
- [X] Related to issue #3178 (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
Updated usrloc module to re-use an active TCP session (if it exists). I marked this breaking only because the current code will use a UDP OPTIONS keepalive method even if the device is registered over TCP. I doubt that's what anyone would be expecting so I think the change is ok.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3219
-- Commit Summary --
* usrloc: re-use TCP connections for keepalive
-- File Changes --
M src/modules/usrloc/dlist.c (4)
M src/modules/usrloc/doc/usrloc_admin.xml (9)
M src/modules/usrloc/ul_keepalive.c (4)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3219.patchhttps://github.com/kamailio/kamailio/pull/3219.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3219
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3219(a)github.com>
Module: kamailio
Branch: master
Commit: 06f933ad17aac3a3f0f81cf0e0ab04f38cf60993
URL: https://github.com/kamailio/kamailio/commit/06f933ad17aac3a3f0f81cf0e0ab04f…
Author: Andy Brezinsky <andy.brezinsky(a)mitel.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-08-17T10:33:50+02:00
usrloc: re-use TCP connections for keepalive
- Fixes GH #3178. Sets TCP connection id for keepalive based on the value in the database
If unset, tcpconn_id will remain 0 and keepalives will work the same as they do today
- Update documentation to clarify when it will use received vs AOR for keepalive
---
Modified: src/modules/usrloc/dlist.c
Modified: src/modules/usrloc/doc/usrloc_admin.xml
Modified: src/modules/usrloc/ul_keepalive.c
---
Diff: https://github.com/kamailio/kamailio/commit/06f933ad17aac3a3f0f81cf0e0ab04f…
Patch: https://github.com/kamailio/kamailio/commit/06f933ad17aac3a3f0f81cf0e0ab04f…
---
diff --git a/src/modules/usrloc/dlist.c b/src/modules/usrloc/dlist.c
index 252bb8bde07..c0c7cb0009f 100644
--- a/src/modules/usrloc/dlist.c
+++ b/src/modules/usrloc/dlist.c
@@ -114,6 +114,7 @@ int ul_ka_db_records(int partidx)
keys2[5] = &ul_ruid_col;
keys2[6] = &ul_user_col;
keys2[7] = &ul_domain_col;
+ keys2[8] = &ul_con_id_col;
/* where fields */
keys1[0] = &ul_expires_col;
@@ -256,6 +257,9 @@ int ul_ka_db_records(int partidx)
ur.aorhash = ul_get_aorhash(&ur.aor);
ur.contacts = &uc;
+ /* tcpconn_id */
+ uc.tcpconn_id = VAL_INT(ROW_VALUES(row)+8);
+
ul_ka_urecord(&ur);
} /* row cycle */
diff --git a/src/modules/usrloc/doc/usrloc_admin.xml b/src/modules/usrloc/doc/usrloc_admin.xml
index 66dae449130..f2d2001689c 100644
--- a/src/modules/usrloc/doc/usrloc_admin.xml
+++ b/src/modules/usrloc/doc/usrloc_admin.xml
@@ -1317,11 +1317,17 @@ modparam("usrloc", "version_table", 0)
contact records stored in memory.
</para>
<para>
- Note: it is recommeder to set 'timer_procs' parameter in order to have
+ Note: it is recommended to set 'timer_procs' parameter in order to have
dedicated timer processes for usrloc module and off-load the keepalive
sending process from the core timers.
</para>
<para>
+ Note: Keepalives will be sent to the IP and port using the transport
+ defined in the “received” column. If not set, then keepalives will be sent
+ to the AOR using UDP as a default transport. If available, the TCP
+ connection will be re-used for WS, TCP and TLS.
+ </para>
+ <para>
Default value is <quote>0 (keepalive disabled)</quote>.
</para>
<example>
@@ -1780,4 +1786,3 @@ modparam("usrloc", "db_clean_tcp", 1)
</chapter>
-
diff --git a/src/modules/usrloc/ul_keepalive.c b/src/modules/usrloc/ul_keepalive.c
index 8808725849f..ffe37fdc738 100644
--- a/src/modules/usrloc/ul_keepalive.c
+++ b/src/modules/usrloc/ul_keepalive.c
@@ -200,6 +200,7 @@ int ul_ka_urecord(urecord_t *ur)
}
idst.proto = dproto;
idst.send_sock = ssock;
+ idst.id = uc->tcpconn_id;
if(ssock->useinfo.name.len > 0) {
if (ssock->useinfo.address.af == AF_INET6) {
@@ -270,19 +271,16 @@ static int ul_ka_send(str *kamsg, dest_info_t *kadst)
#ifdef USE_TCP
else if(kadst->proto == PROTO_WS || kadst->proto == PROTO_WSS) {
/*ws-wss*/
- kadst->id=0;
return wss_send(kadst, kamsg->s, kamsg->len);
}
else if(kadst->proto == PROTO_TCP) {
/*tcp*/
- kadst->id=0;
return tcp_send(kadst, 0, kamsg->s, kamsg->len);
}
#endif
#ifdef USE_TLS
else if(kadst->proto == PROTO_TLS) {
/*tls*/
- kadst->id=0;
return tcp_send(kadst, 0, kamsg->s, kamsg->len);
}
#endif
<!-- Kamailio Pull Request Template -->
#### 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)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
- [ ] PR should be backported to stable branches
- [x] Tested changes locally
- [x] Related to issue #3218
#### Description
Per the DB issue in #3218:
I've determined the commit where dialog with db_mode SHUTDOWN stopped working is 1ff86ffceede46c7a67fec92c8319c34c916a545.
This is the change where `PROC_POSTCHILDINIT` was enabled/used.
In dialog.c `child_init()`, there is code that resets the DB mode to NONE if not running in the main process:
```c
/* in DB_MODE_SHUTDOWN only PROC_MAIN will do a DB dump at the end, so
* for the rest of the processes will be the same as DB_MODE_NONE */
if (dlg_db_mode==DB_MODE_SHUTDOWN && rank!=PROC_MAIN)
dlg_db_mode = DB_MODE_NONE;
```
However, because PROC_POSTCHILDINIT has now been enabled for the module, this code effectively disables DB persistence as PROC_POSTCHILDINIT is called in the main process after PROC_MAIN.
I have modified the rank check to `rank!=PROC_POSTCHILDINIT` and can confirm that DB persistence in SHUTDOWN mode is working once again.
Note that the PR changes the logic to:
```c
if (dlg_db_mode==DB_MODE_SHUTDOWN && rank!=PROC_POSTCHILDINIT)
dlg_db_mode = DB_MODE_NONE;
```
Technically dlg_db_mode will be reset to DB_MODE_NONE when called with rank PROC_MAIN, but the value will be restored when PROC_POSTCHILDINIT is called. I assume this behavior is OK, but otherwise I can change it to:
```c
if (dlg_db_mode==DB_MODE_SHUTDOWN && rank!=PROC_MAIN && rank!=PROC_POSTCHILDINIT)
dlg_db_mode = DB_MODE_NONE;
```
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3221
-- Commit Summary --
* dialog: dont reset dlg_db_mode in POSTCHILDINIT for DB_MODE_SHUTDOWN
-- File Changes --
M src/modules/dialog/dialog.c (2)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3221.patchhttps://github.com/kamailio/kamailio/pull/3221.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3221
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3221(a)github.com>
Module: kamailio
Branch: master
Commit: 8fb25f7cb6fa73dc37fe11df9b921c32009bd107
URL: https://github.com/kamailio/kamailio/commit/8fb25f7cb6fa73dc37fe11df9b921c3…
Author: Shane Mitchell <sm(a)opencluster.com.au>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-08-17T10:32:41+02:00
dialog: dont reset dlg_db_mode in POSTCHILDINIT for DB_MODE_SHUTDOWN
---
Modified: src/modules/dialog/dialog.c
---
Diff: https://github.com/kamailio/kamailio/commit/8fb25f7cb6fa73dc37fe11df9b921c3…
Patch: https://github.com/kamailio/kamailio/commit/8fb25f7cb6fa73dc37fe11df9b921c3…
---
diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
index 9b196f86c1d..4347399a794 100644
--- a/src/modules/dialog/dialog.c
+++ b/src/modules/dialog/dialog.c
@@ -824,7 +824,7 @@ static int child_init(int rank)
/* in DB_MODE_SHUTDOWN only PROC_MAIN will do a DB dump at the end, so
* for the rest of the processes will be the same as DB_MODE_NONE */
- if (dlg_db_mode==DB_MODE_SHUTDOWN && rank!=PROC_MAIN)
+ if (dlg_db_mode==DB_MODE_SHUTDOWN && rank!=PROC_POSTCHILDINIT)
dlg_db_mode = DB_MODE_NONE;
/* in DB_MODE_REALTIME and DB_MODE_DELAYED the PROC_MAIN have no DB handle */
if ( (dlg_db_mode==DB_MODE_REALTIME || dlg_db_mode==DB_MODE_DELAYED) &&
<!-- 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 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
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [X] 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 -->
- [ ] 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 -->
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3193
-- Commit Summary --
* tls: add timestamp and sni info for a session
-- File Changes --
M src/core/tcp_conn.h (1)
M src/core/tcp_main.c (1)
M src/modules/tls/tls_rpc.c (18)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3193.patchhttps://github.com/kamailio/kamailio/pull/3193.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3193
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3193(a)github.com>
Hi
I am looking at modifying the topoh module to support having multiple outside IP addresses.
To do this I am looking for a way to store an IP address per SIP message for later use. Is there a standard way of doing this or will I have to add a data structure to the module for this?
Tor