[sr-dev] [kamailio/kamailio] dns_int_match_ip is broken (#2645)
### 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-function 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 (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
Re: [sr-dev] [kamailio/kamailio] usrloc Stats are not compatible with Prometheus (xhttp_prom module) (#2644)
Just to add - i think I did not backported it to 5.3 that time, because a new cfg parameter was introduced for it and it has been several commits that depends on each other. -- 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/2644#issuecomment-783513708___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
Re: [sr-dev] [kamailio/kamailio] usrloc Stats are not compatible with Prometheus (xhttp_prom module) (#2644)
Argh. Thanks for notifying. The update to 5.4 is on my roadmap as well, so I guess time will heal. -- 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/2644#issuecomment-783512041___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
Re: [sr-dev] [kamailio/kamailio] usrloc Stats are not compatible with Prometheus (xhttp_prom module) (#2644)
Closed #2644. -- 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/2644#event-4360775119___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
Re: [sr-dev] [kamailio/kamailio] usrloc Stats are not compatible with Prometheus (xhttp_prom module) (#2644)
This has been fixed with PR https://github.com/kamailio/kamailio/pull/2304/. It's included in 5.4 but not in 5.3, but could be easily cherry-picked. -- 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/2644#issuecomment-783509004___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
[sr-dev] [kamailio/kamailio] usrloc Stats are not compatible with Prometheus (xhttp_prom module) (#2644)
### Description We tried to use the `xhttp_prom` module, but our Prometheus couldn't read it, because of metrics conflicting with Prometheus data model. For us, the problem lies in the usrloc module. It exports the following metrics: ``` usrloc:location-contacts = 0 usrloc:location-expires = 0 usrloc:location-users = 0 usrloc:registered_users = 0 ``` However, Prometheus allows only ascii characters and digits, as well as underscores and colons. See: https://prometheus.io/docs/concepts/data_model/#metric-names-and-labels The metrics names should not contain `-`, so they should get converted to `_`. Reproduction Setup Kamailio with `usrloc`, `xhttp` and `xhttp_prom` module and let Prometheus query it. It will stumble upon the first entry of `usrloc` module stats. ### Possible Solutions Either the `usrloc` module could export its stats with the dash replaced by underscores, or the xhttp_prom module could sanitize the output. The first one would be a breaking change, I guess, making this a change for a major release. ### Additional Information * **Kamailio Version** - output of `kamailio -v` ``` root@ifens5:/# kamailio -v version: kamailio 5.3.8 (x86_64/linux) 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: unknown compiled with gcc 7.5.0``` * **Operating System**: ``` Ubuntu 18.04 ``` -- 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/2644___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
Re: [sr-dev] [kamailio/kamailio] lreproxy module (#2208)
I am planning to change lreproxy to lrkproxy. any idea in this regard? @miconda, let me know do i have to create new PR after renaming module or some things else? -- 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/2208#issuecomment-783338108___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
Re: [sr-dev] [kamailio/kamailio] Issue with new memory-only presence feature in 5.4.3 (#2642)
Yes, get the core dump file and then grab the output of `bt full` with gdb. -- 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/2642#issuecomment-783312966___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
[sr-dev] Broken: kamailio/kamailio#9899 (master - c48e409)
Build Update for kamailio/kamailio - Build: #9899 Status: Broken Duration: 5 mins and 30 secs Commit: c48e409 (master) Author: Daniel-Constantin Mierla Message: jsonrpcs: use json null value for c null char* or str* View the changeset: https://github.com/kamailio/kamailio/compare/d40fbc877aa6...c48e409b7418 View the full build log and details: https://travis-ci.org/github/kamailio/kamailio/builds/759983787?utm_medium=notification_source=email -- You can unsubscribe from build emails from the kamailio/kamailio repository going to https://travis-ci.org/account/preferences/unsubscribe?repository=3596148_medium=notification_source=email. Or unsubscribe from *all* email updating your settings at https://travis-ci.org/account/preferences/unsubscribe?utm_medium=notification_source=email. Or configure specific recipients for build notifications in your .travis.yml file. See https://docs.travis-ci.com/user/notifications. ___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
[sr-dev] git:master:c48e409b: jsonrpcs: use json null value for c null char* or str*
Module: kamailio Branch: master Commit: c48e409b741821fa470788b3bca0ead32e4d6efc URL: https://github.com/kamailio/kamailio/commit/c48e409b741821fa470788b3bca0ead32e4d6efc Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2021-02-22T11:29:39+01:00 jsonrpcs: use json null value for c null char* or str* --- Modified: src/modules/jsonrpcs/jsonrpcs_mod.c --- Diff: https://github.com/kamailio/kamailio/commit/c48e409b741821fa470788b3bca0ead32e4d6efc.diff Patch: https://github.com/kamailio/kamailio/commit/c48e409b741821fa470788b3bca0ead32e4d6efc.patch --- diff --git a/src/modules/jsonrpcs/jsonrpcs_mod.c b/src/modules/jsonrpcs/jsonrpcs_mod.c index c3b8003046..a5a92e1537 100644 --- a/src/modules/jsonrpcs/jsonrpcs_mod.c +++ b/src/modules/jsonrpcs/jsonrpcs_mod.c @@ -472,6 +472,7 @@ static srjson_t* jsonrpc_print_value(jsonrpc_ctx_t* ctx, char fmt, va_list* ap) time_t dt; struct tm t; str *sp; + char *cp; switch(fmt) { case 'd': @@ -497,11 +498,20 @@ static srjson_t* jsonrpc_print_value(jsonrpc_ctx_t* ctx, char fmt, va_list* ap) nj = srjson_CreateString(ctx->jrpl, buf); break; case 's': - nj = srjson_CreateString(ctx->jrpl, va_arg(*ap, char*)); + cp = va_arg(*ap, char*); + if(cp!=NULL) { + nj = srjson_CreateString(ctx->jrpl, cp); + } else { + nj = srjson_CreateNull(ctx->jrpl); + } break; case 'S': sp = va_arg(*ap, str*); - nj = srjson_CreateStr(ctx->jrpl, sp->s, sp->len); + if(sp!=NULL && sp->s!=NULL) { + nj = srjson_CreateStr(ctx->jrpl, sp->s, sp->len); + } else { + nj = srjson_CreateNull(ctx->jrpl); + } break; default: LM_ERR("Invalid formatting character [%c]\n", fmt); ___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev