### Description
`dns_int_match_ip` is broken on 5.3.0 and above
### Troubleshooting
#### Reproduction
Try this dialplan:
```
if (dns_int_match_ip('dns.google', '8.8.8.8')) {
xlog("L_INFO", "OK dns-ip match with dns_int_match_ip");
} else {
xlog("L_ERR", "FAIL dns-ip match with dns_int_match_ip");
}
if (dns_int_match_ip('100.100.100.100', '8.8.8.8')) {
xlog("L_ERR", "FAIL dns_int_match_ip on 2 ip's");
} else {
xlog("L_INFO", "OK dns_int_match_ip on 2 ip's");
}
```
On 5.2 releases, both checks succeed. On 5.3 and up, both fail.
#### Debugging Data
I've traced down the problem to `str2ip`.
In 5.2, this is a `static inline` function defined in the header file `resolve.h`. Therefore, the returned `ip` structure is allocated *once per compilation unit* - ie. `ipops_mod.c` and `dns_cache.c` both have their own versions of the variable.
Since fb75e90549a (5.3 and up) this function is defined in it's own compilation unit (`resolve.c`) and therefore shared by all callers.
See: https://stackoverflow.com/questions/185624/static-variables-in-an-inlined-f…
#### Log Messages
n/a
#### SIP Traffic
n/a
### Possible Solutions
- Have `ki_dns_sys_match_ip` make a local copy of the return value of `str2ip`
- Move `str2ip` back to a header file
- Refactor `str2ip` to take a pointer to an output struct
### Additional Information
In 5.3, this is what happens:
```
# - ki_dns_int_match_ip will call str2ip on 8.8.8.8, filling the static variable
# - resolvehost will call dns_a_get_he, which calls str2ip on dns.google.com, zeroing out the static variable
# - (dns_cache_do_request will call str2ip on dns.google.com, zeroing out the static variable again)
# - resolvehost queries DNS
# - the resolved IP's will be compared to the zero'd out struct
dns_int_match_ip('dns.google', '8.8.8.8') == false
# - ki_dns_int_match_ip will call str2ip on 8.8.8.8, filling the static variable
# - resolvehost will call dns_a_get_he, which calls str2ip on 100.100.100.100, overwriting the static variable
# - the static variable will be compared to itself
dns_int_match_ip('100.100.100.100', '8.8.8.8') == true
```
--
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/2645
<!-- 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, ...)
- [ ] Each component has a single commit (if not, squash them into one commit)
- [ ] 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)
- [ ] 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
- [ ] 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/2664
-- Commit Summary --
* Merge pull request #1 from kamailio/master
* Merge pull request #2 from kamailio/master
* lrkproxy: lreproxy name is changed
* lrkproxy: add doc/ xml folder
* lrkproxy:some issue related to lrkproxy_manage
-- File Changes --
A src/modules/lrkproxy/Makefile (17)
A src/modules/lrkproxy/doc/Makefile (4)
A src/modules/lrkproxy/doc/lrkproxy.xml (33)
A src/modules/lrkproxy/doc/lrkproxy_admin.xml (364)
A src/modules/lrkproxy/lrkproxy.c (1732)
A src/modules/lrkproxy/lrkproxy.h (107)
A src/modules/lrkproxy/lrkproxy_funcs.c (479)
A src/modules/lrkproxy/lrkproxy_funcs.h (41)
A src/modules/lrkproxy/lrkproxy_hash.c (522)
A src/modules/lrkproxy/lrkproxy_hash.h (75)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2664.patchhttps://github.com/kamailio/kamailio/pull/2664.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/2664
### Description
Hi,
I am migrating from Kamailio 4.4.7 (debian 8.1) to 5.4.3 (debian 10.7).
I changed the neccessary changes in configuration (replaced MI with RPC) and I tried to start the kamailio. The issue is that it takes about 3minutes to start. On the older version 4.4.7 it started aproximetly in 20s.
The modules I am using are:
```
"cfgutils.so","db_mysql.so","kex.so","tm.so","tmx.so","sl.so","rr.so","pv.so","maxfwd.so","textops.so","siputils.so","xlog.so","sanity.so","ctl.so","jsonrpcs.so","exec.so","carrierroute.so","avpops.so","sqlops.so","dmq.so","htable.so","dialog.so","acc.so","acc_radius.so","dispatcher.so","dialplan.so","textopsx.so","statsd.so","app_perl.so","http_async_client.so".
```
I assume the issue is caused by carrierroute module. It takes also about 3 minutes to reload routes (when the kamailio service is running) using rpc command cr.reload_routes.
I did not change anything in configuration related to carrierroute module.
```
modparam("carrierroute", "config_source", "db")
modparam("carrierroute", "db_url", DBURL)
modparam("carrierroute", "match_mode", 128)
modparam("carrierroute", "avoid_failed_destinations", 0)
modparam("carrierroute", "carrierroute_table", "carrierroute_view")
```
Carrierroute module loading on version 4.4.7 needed:
- INFO: carrierroute [cr_db.c:317]: load_route_data_db(): **took 1s**
- INFO: carrierroute [cr_carrier.c:100]: add_domain_data(): and INFO: carrierroute [cr_data.c:414]: get_domain_data_or_add(): **took 8s**
- INFO: carrierroute [cr_data.c:655]: rule_fixup(): **took 3s**
Carrierroute module loading on version 5.4.3 needed:
- INFO: carrierroute [cr_db.c:317]: load_route_data_db(): **took 1s**
- INFO: carrierroute [cr_carrier.c:100]: add_domain_data(): and INFO: carrierroute [cr_data.c:414]: get_domain_data_or_add(): **took 2min 23s**
- INFO: carrierroute [cr_data.c:655]: rule_fixup(): **took 17s**
I have also compiled kamailio version 5.0 on both (debian 8.1 and debian 10.7), but it also took so long to start on both machines.
### Additional Information
```
version: kamailio 5.4.3 (x86_64/linux) 06bd17
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: 06bd17
compiled on 16:10:30 Jan 25 2021 with gcc 8.3.0
```
* **Operating System**:
```
Linux 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64 GNU/Linux
Debian 10.7
```
Thank you for your help.
--
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/2613
Module: kamailio
Branch: master
Commit: b81f7bcf4427b050a52ba20f563e993c9e87c3e0
URL: https://github.com/kamailio/kamailio/commit/b81f7bcf4427b050a52ba20f563e993…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-03-09T13:43:28+01:00
uac_redirect: docs - updates for q_value param [skip ci]
---
Modified: src/modules/uac_redirect/doc/uac_redirect_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/b81f7bcf4427b050a52ba20f563e993…
Patch: https://github.com/kamailio/kamailio/commit/b81f7bcf4427b050a52ba20f563e993…
---
diff --git a/src/modules/uac_redirect/doc/uac_redirect_admin.xml b/src/modules/uac_redirect/doc/uac_redirect_admin.xml
index 97cb6414ad..eb66416d05 100644
--- a/src/modules/uac_redirect/doc/uac_redirect_admin.xml
+++ b/src/modules/uac_redirect/doc/uac_redirect_admin.xml
@@ -342,12 +342,12 @@ modparam("uac_redirect","flags_hdr_mode",2)
</example>
</section>
<section>
- <title><varname>default_q_value</varname> (int)</title>
+ <title><varname>q_value</varname> (int)</title>
<para>
Specifies the q-value to asign to contacts without one. Because
Kamailio doesn't support float parameter types, the value in the
parameter is divided by 1000 and stored as float. For example, if
- you want default_q_value to be 0.38, use value 380 here.
+ you want q value to be 0.38, use value 380 here.
</para>
<para>
<emphasis>
@@ -355,10 +355,10 @@ modparam("uac_redirect","flags_hdr_mode",2)
</emphasis>
</para>
<example>
- <title>Set <varname>default_q_value</varname> parameter</title>
+ <title>Set <varname>q_value</varname> parameter</title>
<programlisting format="linespecific">
...
-modparam("uac_redirect","default_q_value",0)
+modparam("uac_redirect","q_value",0)
...
</programlisting>
</example>