### Description
Ubuntu 18.04 offers both libssl 1.0 and 1.1, however the -dev packages conflict between them and only one can be installed at a given time. The libmysqlclient-dev (the MySQL project, not MariaDB) requires the libssl1.1-dev, so only this one can be used to compile at the same time db_mysql and tls.
During start up, a few kamailio processes die due to a crash in libmysqlclient, referencing the use of libssl and libcrypto. This happens when connecting over IP sockets to MySQL server, not over local unix file socket (which is done when using `localhost` for db server host).
The solution so far was to add a new modparam opt_ssl_mode to db_mysql to set the SSL mode for the connection, allowing to disable it. Without, the client library attempts always to use SSL/TLS.
A set of commits were pushed recently to db_mysql modules:
* https://github.com/kamailio/kamailio/commits/master/src/modules/db_mysql
I plan to backport them 5.3 and 5.2 branches, in order to fix the crash and be able to connect to MySQL servers in private network. It proved that the SSL mode options can be set only when MySQL Project libmysqlclient library is used (and maybe only when using the MySQL server, in my case it was MySQL server 5.7.30), the MariaDB client library does not offer these options.
Wondering if anyone else experienced something similar?
### Troubleshooting
#### Reproduction
Kamailio v5.2.7 compiled from sources on Ubuntu 18.04 with db_mysql and tls loaded.
#### Debugging Data
A backtrace looks like:
```
(paste your debugging data here)#0 X509_LOOKUP_ctrl (ctx=0x15328f0b9ac0, cmd=2, argc=0x0, argl=3, ret=0x0) at ../crypto/x509/x509_lu.c:79
#1 0x00001532b24dcc7c in X509_STORE_set_default_paths (ctx=0x15328fed9f18) at ../crypto/x509/x509_d2.c:27
#2 0x00001532b27f2d79 in SSL_CTX_set_default_verify_paths (ctx=<optimized out>) at ../ssl/ssl_lib.c:3991
#3 0x00001532b2ecc364 in new_VioSSLFd (key_file=0x0, cert_file=0x0, ca_file=0x0, ca_path=0x0, cipher=0x0, is_client=is_client@entry=1 '\001', error=0x7ffd8c3a8090,
crl_file=0x0, crl_path=0x0, ssl_ctx_flags=0) at ./vio/viosslfactories.c:623
#4 0x00001532b2ecc9e3 in new_VioSSLConnectorFd (key_file=<optimized out>, cert_file=<optimized out>, ca_file=<optimized out>, ca_path=<optimized out>, cipher=<optimized out>,
error=error@entry=0x7ffd8c3a8090, crl_file=0x0, crl_path=0x0, ssl_ctx_flags=0) at ./vio/viosslfactories.c:710
#5 0x00001532b2e9f3f7 in cli_establish_ssl (mysql=0x1532b5abb698) at ./sql-common/client.c:3492
#6 mysql_real_connect (mysql=0x1532b5abb698, host=<optimized out>, user=<optimized out>, passwd=<optimized out>, db=0x1532b5a2e4b0 "enswitch", port=<optimized out>,
unix_socket=<optimized out>, client_flag=65536) at ./sql-common/client.c:4609
#7 0x00001532b343a0fc in db_mysql_new_connection (id=0x1532b5a2e268) at km_my_con.c:137
#8 0x00001532b4f4dbdf in db_do_init2 (url=0x1532b53bc420 <db_url>, new_connection=0x1532b3438c9b <db_mysql_new_connection>, pooling=DB_POOLING_PERMITTED) at db.c:317
#9 0x00001532b4f4cb65 in db_do_init (url=0x1532b53bc420 <db_url>, new_connection=0x1532b3438c9b <db_mysql_new_connection>) at db.c:270
#10 0x00001532b34301e6 in db_mysql_init (_url=0x1532b53bc420 <db_url>) at km_dbase.c:206
#11 0x00001532b518dedd in child_init (_rank=37) at usrloc_mod.c:435
#12 0x0000559b145fcec0 in init_mod_child (m=0x1532b59cdb08, rank=37) at core/sr_module.c:846
#13 0x0000559b145fcb43 in init_mod_child (m=0x1532b59cdfa8, rank=37) at core/sr_module.c:842```
### Possible Solutions
Patches in master branch for db_mysql module
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
5.2.7
```
* **Operating System**:
```
Ubuntu 18.04 - Linux4.15.0-101-generic #102-Ubuntu SMP Mon May 11 10:07:26 UTC 2020 x86_64 x86_64 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/2360
### Description
Introduce a permanent usrloc entry with kamctl not working, but introduce a temporary usrloc entry with expires date is ok for me.
### Troubleshooting
#### Debugging Data
`kamctl ul add +982191079726 sip:+982191079726@172.22.132.230:5060`
#### Log Messages
{
"jsonrpc": "2.0",
"error": {
"code": 500,
"message": "Not enough parameters or wrong format"
},
"id": 107809
}
When I try with introduce a temporary usrloc entry every thing is ok.
`kamctl ul add +982191079723 sip:+982191079723@172.22.132.235 2020-07-30 08:51:40`
```
{
"jsonrpc": "2.0",
"result": {
},
"id": 107852
}
```
### Additional Information
```
version: kamailio 5.0.8 (x86_64/linux)
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, 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: unknown
compiled with gcc 6.3.0
```
* **Operating System**:
```
Linux trunk2-sbc 4.9.0-6-amd64 #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-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/2379
Yes, $xavp(s) are bound to the transaction, like the $avp.
About the memory fragmentation - the memory manager should re-use fitting memory blocks, but this depends on the overall traffic to the server. In general, if you use a recent kamailio version, we activated the memory defragmentation some time ago. This should reduce the number of fragements. You can check with the shm stats. On old servers you can activate with a core parameter.
Cheers,
Henning
--
Henning Westerholt – https://skalatan.de/blog/
Kamailio services – https://gilawa.com
-----Original Message-----
From: sr-users <sr-users-bounces(a)lists.kamailio.org> On Behalf Of Alex Balashov
Sent: Monday, June 29, 2020 10:31 PM
To: sr-users(a)lists.kamailio.org
Subject: Re: [SR-Users] Sql_result_free() not cleaning properly
On 6/29/20 4:27 PM, Henning Westerholt wrote:
> I guess you are using sql_xquery? The sql_free_result will only free a
> native sql result in script, not the xavp.
But the XAVP goes out of scope once the transaction to which it pertains expires, right? And accordingly should be freed?
(This also leads one to wonder: if the same XAVP name is referenced in a subsequent sql_xquery() call in the course of processing the same message, will it free and re-allocate memory for a new PV, perhaps contributing to unnecessary fragmentation? Or will it simply reuse the SHM block for the previously allocated PV?)
-- Alex
--
Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
### Description
I want start kamailio as `root` user with carrierroute module.
and get this error message
```
[root@ip-172-22-6-233 config]# kamailio -DD -E
0(13687) INFO: <core> [core/sctp_core.c:74]: sctp_core_check_support(): SCTP API not enabled - if you want to use it, load sctp module
Listening on
udp: 172.22.6.233:5060
tcp: 172.22.6.233:5060
Aliases:
tcp: ip-172-22-6-233.us-west-1.compute.internal:5060
udp: ip-172-22-6-233.us-west-1.compute.internal:5060
0(13687) INFO: <core> [core/tcp_main.c:5042]: init_tcp(): using epoll_lt as the io watch method (auto detected)
0(13687) INFO: carrierroute [carrierroute.c:197]: mod_init(): use file as configuration source
0(13687) ERROR: carrierroute [carrierroute.c:219]: mod_init(): config file /etc/kamailio/carrierroute.conf not writable
0(13687) ERROR: <core> [core/sr_module.c:849]: init_mod(): Error while initializing module carrierroute (/usr/lib64/kamailio/modules/carrierroute.so)
ERROR: error while initializing modules
0(13687) INFO: <core> [core/sctp_core.c:53]: sctp_core_destroy(): SCTP API not initialized
```
I checked file permissions
```sh
[root@ip-172-22-6-233 config]# ls -l /etc/kamailio/carrierroute.conf
-rw-rw----. 1 kamailio kamailio 403 Jun 23 18:07 /etc/kamailio/carrierroute.conf
```
Looks as file permissions as expected.
### Troubleshooting
Issue related to a difference of process user/group and file user/group.
#### Reproduction
1) create `/etc/kamailio/carrierroute.conf` with kamailio user/group;
2) change file permissions to 660;
3) start kamailio as root user
#### Debugging Data
none
#### Log Messages
none
#### SIP Traffic
none
### Possible Solutions
Add information about the expected user group permissions, like
```
config file /etc/kamailio/carrierroute.conf not writable or not owned by "root" user and "root" group
```
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
[root@ip-172-22-6-233 config]# kamailio -v
version: kamailio 5.3.4 (x86_64/linux) 117ff9
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_BLACKLIST, 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: 117ff9
compiled on 15:31:51 May 6 2020 with gcc 8.3.1
```
* **Operating System**:
```
[root@ip-172-22-6-233 config]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="8 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="8"
```
--
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/2369
Module: kamailio
Branch: master
Commit: 7ac314353f206924234ee416829fc9d75f52a737
URL: https://github.com/kamailio/kamailio/commit/7ac314353f206924234ee416829fc9d…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org>
Committer: Kamailio Dev <kamailio.dev(a)kamailio.org>
Date: 2020-06-29T08:31:12+02:00
modules: readme files regenerated - carrierroute ... [skip ci]
---
Modified: src/modules/carrierroute/README
---
Diff: https://github.com/kamailio/kamailio/commit/7ac314353f206924234ee416829fc9d…
Patch: https://github.com/kamailio/kamailio/commit/7ac314353f206924234ee416829fc9d…
---
diff --git a/src/modules/carrierroute/README b/src/modules/carrierroute/README
index cb659bdf75..8f1b4a0532 100644
--- a/src/modules/carrierroute/README
+++ b/src/modules/carrierroute/README
@@ -365,7 +365,8 @@ modparam("carrierroute", "config_source", "file")
3.6. config_file (string)
- Specifies the path to the config file.
+ Specifies the path to the config file. The file has to be owned by the
+ user and group used to run Kamailio.
Default value is “/etc/kamailio/carrierroute.conf”.