<!-- 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
Not for merging yet.
Package tls_wolfssl as an alternative to OpenSSL 3.x.
Depends on PR https://github.com/kamailio/kamailio/pull/3590
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3592
-- Commit Summary --
* pkg: RPM packaging add kamailio-tls_wolfssl subpackage
-- File Changes --
M pkg/kamailio/obs/kamailio.spec (18)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3592.patchhttps://github.com/kamailio/kamailio/pull/3592.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3592
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3592(a)github.com>
<!-- 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
- [x] Related to PR https://github.com/kamailio/kamailio/pull/3891
#### Description
<!-- Describe your changes in detail -->
Normally, the IMS P-CSCF should identify the clients (UEs) by the received IP address and ports on Rx. The current code is using a mix of that, plus using Contact and Via headers, with arguable potential security issues.
This patch adds a new parameter to `ims_registrar_pcscf` and `ims_qos` modules, allowing for an optional outsource of the IPsec functionality to another element, which is also in charge of checking/enforcing correct UE Via header. The existing code is allowed to work as before, with the default value of the flag being towards that.
List of functional changes:
- `ims_qos`
- added `trust_bottom_via` parameter
- used it on `w_rx_aar_register()`
- `ims_registrar_pcscf`
- added `trust_bottom_via` parameter
- used it on `update_contacts()`, `save_pending()`, `check_contact()`, `getContactP()`, `check_service_routes()`, `enforce_service_routes()`
- made `ims_ipsec_pcscf` dependency optional, with checks when used
- skipped checks of `port-uc` in `checkcontact()` if the `ims_ipsec_pcscf` module was not loaded
- added `ignore_contact_rxproto_check` parameter - IMS devices open IPsec Security Associations just between IPs and ports, with both UDP and TCP protocols allowed. The default then was set here to always ignore protocol checks. Before, the `ignore_contact_rxport_check` was used to skip this and still make it work, but that seemed like a typo/mistake with hidden effects.
List of indirect changes:
- `core/ut.h`: added a `str2ushort()` macro, since code was using some dangerous casting and macros with a larger type
- `ims_registrar_pcscf`: added `Route` headers in `SUBSCRIBE` to `reginfo`, with values from `Service-Route`s, as per 3GPP specs.
- `ims_usrloc_pcscf`: small log fixes
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3901
-- Commit Summary --
* core: added str2ushort() to avoid some questionable casting in ims_qos
* lib/ims: fixed a typo in a log message
* ims_usrloc_pcscf: small log fixes
* ims_qos: added trust_bottom_via parameter
* ims_registrar_pcscf: added trust_bottom_via parameter, added ignore_contact_rxproto_check, fixes for logging, fixes for SUBSCRIBE to reginfo for including Service-Route, allow use without ims_ipsec_pcscf
-- File Changes --
M src/core/ut.h (8)
M src/lib/ims/ims_getters.c (2)
M src/modules/ims_qos/doc/ims_qos.xml (6)
M src/modules/ims_qos/doc/ims_qos_admin.xml (41)
M src/modules/ims_qos/ims_qos_mod.c (27)
M src/modules/ims_qos/rx_aar.h (4)
M src/modules/ims_qos/rx_authdata.h (2)
M src/modules/ims_qos/rx_avp.c (2)
M src/modules/ims_registrar_pcscf/doc/ims_registrar_pcscf.xml (6)
M src/modules/ims_registrar_pcscf/doc/ims_registrar_pcscf_admin.xml (73)
M src/modules/ims_registrar_pcscf/ims_registrar_pcscf_mod.c (26)
M src/modules/ims_registrar_pcscf/notify.c (2)
M src/modules/ims_registrar_pcscf/save.c (80)
M src/modules/ims_registrar_pcscf/service_routes.c (136)
M src/modules/ims_registrar_pcscf/subscribe.c (74)
M src/modules/ims_registrar_pcscf/subscribe.h (4)
M src/modules/ims_usrloc_pcscf/udomain.c (4)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3901.patchhttps://github.com/kamailio/kamailio/pull/3901.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3901
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3901(a)github.com>
### Description
Recent commit
```
d53843c75da src/modules/db_mysql/km_my_con.c (Sergey Safarov 2024-05-11 17:45:08 +0300 182) #ifdef MYSQL_OPT_SSL_CA
```
breaks db_mysql on 5.8.2
```
Jul 09 08:40:31 voip-ssl3.voip.test /usr/local/kamailio/sbin/kamailio[10982]: WARNING: db_mysql [km_my_con.c:187]: db_mysql_new_connection(): opt_ssl_ca option not supported by mysql version (value /etc/pki/tls/certs/ca-cert.pem) - ignoring
Jul 09 08:40:31 voip-ssl3.voip.test /usr/local/kamailio/sbin/kamailio[10982]: ERROR: db_mysql [km_my_con.c:217]: db_mysql_new_connection(): driver error: SSL connection error: CA certificate is required if ssl-mode is VERIFY_CA or VERIFY_IDENTITY
```
Ping @sergey-safarov
### Troubleshooting
#### Reproduction
* use 5.8.2
* configure `db_mysql` to use TLS with verification
#### Debugging Data
#### Log Messages
```
Jul 09 08:40:31 voip-ssl3.voip.test /usr/local/kamailio/sbin/kamailio[10982]: WARNING: db_mysql [km_my_con.c:187]: db_mysql_new_connection(): opt_ssl_ca option not supported by mysql version (value /etc/pki/tls/certs/ca-cert.pem) - ignoring
Jul 09 08:40:31 voip-ssl3.voip.test /usr/local/kamailio/sbin/kamailio[10982]: ERROR: db_mysql [km_my_con.c:217]: db_mysql_new_connection(): driver error: SSL connection error: CA certificate is required if ssl-mode is VERIFY_CA or VERIFY_IDENTITY
```
### Additional Information
* **Kamailio Version** - 5.8.2
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3910
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3910(a)github.com>
<!-- 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 -->
- [ ] Commit message has the format required by CONTRIBUTING guide
- [ ] Commits are split per component (core, individual modules, libs, utils, ...)
- Not yet - first let's see if the work is valid, then I'll recompose the whole work to satisfy this. Otherwise... if I need to fix something, it's too hard to work like this...
- [ ] Each component has a single commit (if not, squash them into one commit)
- ditto
- [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 -->
Normally, the IMS P-CSCF should identify the clients (UEs) by the received IP address and ports on Rx. The current code is using a mix of that, plus using Contact and Via headers, with arguable potential security issues.
This patch adds a new parameter to `ims_registrar_pcscf` and `ims_qos` modules, allowing for an optional outsource of the IPsec functionality to another element, which is also in charge of checking/enforcing correct UE Via header. The existing code is allowed to work as before, with the default value of the flag being towards that.
List of functional changes:
- `ims_qos`
- added `trust_bottom_via` parameter
-
List of indirect changes:
- default I-CSCF config example contained a questionable line which adds a `+` as a prefix in Request-URI. After way too much time wasted to figure out why the Diameter LIR has bogus SIP or TEL URI values in UserName AVP, I have discovered this. Seems like someone had just tel-URIs in their network, but otherwise the blind addition of this prefix makes no sense to me.
- added a `str2ushort()` macro, since code was using some dangerous casting and macros with a larger type
-
List of non-functional fixes:
- spelling in comments
- comments at the end of line moved above the line they refer to; with just 80 columns code-formatting, commenting on the same line provides for some super weird and hard to read code, so IMHO should not be allowed (or ... much harder now... increase to 120 columns)
-
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3891
-- Commit Summary --
* squashed work
-- File Changes --
M misc/examples/ims/icscf/kamailio.cfg (4)
M src/core/ut.h (36)
M src/lib/ims/ims_getters.c (2)
M src/modules/ims_icscf/location.c (10)
M src/modules/ims_qos/ims_qos_mod.c (27)
M src/modules/ims_qos/ims_qos_mod.h (1)
M src/modules/ims_qos/rx_aar.h (4)
M src/modules/ims_qos/rx_authdata.h (2)
M src/modules/ims_qos/rx_avp.c (2)
M src/modules/ims_qos/rx_avp.h (1)
M src/modules/ims_registrar_pcscf/doc/ims_registrar_pcscf_admin.xml (39)
M src/modules/ims_registrar_pcscf/ims_registrar_pcscf_mod.c (18)
M src/modules/ims_registrar_pcscf/notify.c (2)
M src/modules/ims_registrar_pcscf/save.c (78)
M src/modules/ims_registrar_pcscf/service_routes.c (125)
M src/modules/ims_registrar_pcscf/subscribe.c (75)
M src/modules/ims_registrar_pcscf/subscribe.h (4)
M src/modules/ims_usrloc_pcscf/udomain.c (4)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3891.patchhttps://github.com/kamailio/kamailio/pull/3891.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3891
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3891(a)github.com>
### Description
When doing base58 encoding and decoding there is some issue with the decoded string.
Here is my code to ilustrate the issue :
$var(Test) = "test_string";
$var(Test) = $(var(Test){s.encode.base58});
xerr("Test String encoded = STRING_BEGIN$var(Test)STRING_END");
$var(Test) = $(var(Test){s.decode.base58});
xerr("Test String decoded = STRING_BEGIN$var(Test)STRING_END");
It has the following output :

I've inserted STRING_BEGIN and STRING_END in the log to be able to know when string ends.
After this i've tried to user {s.trim} method with no success. I've noticed that despite not printing correctly, the string's length is calculated correctly, so i did a manual substring and was able to fix it.
xerr("Test Base58");
$var(Test) = "test_string";
$var(Test) = $(var(Test){s.encode.base58});
xerr("Test String encoded = STRING_BEGIN$var(Test)STRING_END");
$var(Test) = $(var(Test){s.decode.base58});
xerr("Test String decoded = STRING_BEGIN$var(Test)STRING_END");
$var(Test) = $(var(Test){s.trim});
xerr("Test String decoded and trimmed = STRING_BEGIN$var(Test)STRING_END");
$var(substring_length) = $(var(Test){s.len}) - 1;
$var(Test) = $(var(Test){s.substr,0,$var(substring_length)});
xerr("Test String decoded and fixed = STRING_BEGIN$var(Test)STRING_END");
Output :

All of this doesn't happen with method for base64 for example
### Additional Information
version: kamailio 5.7.1 (x86_64/linux) 4238e4
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, MEM_JOIN_FREE, 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: 4238e4
compiled on 12:39:30 Jun 29 2023 with gcc 4.8.5
* **Operating System**:
CentOS 7
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3907
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3907(a)github.com>
Hello,
Upgraded the kamailio version from 5.7.5 to 5.7.6 and after restart the service got the follow WARNING,
WARNING: db_mysql [km_my_con.c:179]: db_mysql_new_connection(): opt_ssl_ca option not supported by mysql version (value (null)) - ignoring,
when downgrade to 5.7.5 dindt happend.
Thanks
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3908
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3908(a)github.com>
### Description
On systems with a high number of TCP sessions there can be a significant performance regression observed, probably related to the newly added TCP connection tracking feature.
### Troubleshooting
#### Reproduction
No special configuration is necessary, just install the latest 5.7.x release, e.g. 5.7.3 on a production system with a lot of clients connected over TCP or TLS. You need to have a large number of clients connected to be able to observe the regression. For a high number of connections (e.g. more then 20.000 up to 30.000 connections) the Kamailio servers uses about 30% to 50% more CPU as with the old version.
#### Debugging Data
Two graphs were attached to this issue. The first shows the CPU load before (less load) and after the upgrade (increased load). The second is a flamegraph that shows that over 80% of the CPU time is spent in the newly added function tcp_connection_limit_srcip().
<img width="372" alt="cpu-load-before-after" src="https://github.com/kamailio/kamailio/assets/6481937/ec92c41b-25e2-4847-a4bc…">

Most of the CPU time is spend in the TCP main process, as expected.
#### Log Messages
No special log messages could be observed.
#### SIP Traffic
### Possible Solutions
The TCP limit feature should probably be optimized to not cause such a large performance regression. It should be also possible to deactivate it completly and therefore getting a comparable performance as before the feature addition.
### Additional Information
Kamailio 5.7.3 and probably also git master version.
* **Operating System**:
Debian 11, Debian 12
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3759
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/3759(a)github.com>