[sr-dev] git:master:c82aa6e9: core: helper functions to convert ip to string using a pool of buffers
Module: kamailio Branch: master Commit: c82aa6e92d3475bb56db761ba65abb64e8f712fd URL: https://github.com/kamailio/kamailio/commit/c82aa6e92d3475bb56db761ba65abb64e8f712fd Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2024-11-25T10:16:07+01:00 core: helper functions to convert ip to string using a pool of buffers --- Modified: src/core/ip_addr.c Modified: src/core/ip_addr.h --- Diff: https://github.com/kamailio/kamailio/commit/c82aa6e92d3475bb56db761ba65abb64e8f712fd.diff Patch: https://github.com/kamailio/kamailio/commit/c82aa6e92d3475bb56db761ba65abb64e8f712fd.patch --- diff --git a/src/core/ip_addr.c b/src/core/ip_addr.c index 02c26f969d5..8e2ae6cf42d 100644 --- a/src/core/ip_addr.c +++ b/src/core/ip_addr.c @@ -298,6 +298,52 @@ char *ip_addr2strz(struct ip_addr *ip) return buff; } +#define IP_ADDR_BUF_NR 8 +static char _ksr_addr2x_buff[IP_ADDR_BUF_NR][IP_ADDR_MAX_STR_SIZE]; +static int _ksr_addr2x_idx = 0; + +/* fast ip_addr -> string converter; + * it uses an internal buffer + */ +char *ip_addr2xa(struct ip_addr *ip) +{ + int len; + char *buff; + + buff = _ksr_addr2x_buff[_ksr_addr2x_idx]; + _ksr_addr2x_idx = (_ksr_addr2x_idx + 1) % IP_ADDR_BUF_NR; + + len = ip_addr2sbuf(ip, buff, sizeof(buff) - 1); + buff[len] = 0; + + return buff; +} + + +/* full address in text representation, including [] for ipv6 */ +char *ip_addr2xstrz(struct ip_addr *ip) +{ + char *p; + int len; + char *buff; + + buff = _ksr_addr2x_buff[_ksr_addr2x_idx]; + _ksr_addr2x_idx = (_ksr_addr2x_idx + 1) % IP_ADDR_BUF_NR; + + p = buff; + if(ip->af == AF_INET6) { + *p++ = '['; + } + len = ip_addr2sbuf(ip, p, sizeof(buff) - 3); + p += len; + if(ip->af == AF_INET6) { + *p++ = ']'; + } + *p = 0; + + return buff; +} + /* returns an asciiz string containing the ip and the port * (:port or []:port) diff --git a/src/core/ip_addr.h b/src/core/ip_addr.h index 4a266391190..b55c78bd8bc 100644 --- a/src/core/ip_addr.h +++ b/src/core/ip_addr.h @@ -614,14 +614,18 @@ int ip_addr2sbufz(struct ip_addr *ip, char *buff, int len); #define IP_ADDR_MAX_STR_SIZE (IP6_MAX_STR_SIZE + 1) /* ip62ascii + \0*/ #define IP_ADDR_MAX_STRZ_SIZE (IP6_MAX_STR_SIZE + 3) /* ip62ascii + [ + ] + \0*/ -/* fast ip_addr -> string converter; - * it uses an internal buffer - */ +/* ip addr to string converter; it uses an internal static buffer */ char *ip_addr2a(struct ip_addr *ip); +/* ip addr to string converter; it uses a pool of internal static buffers */ +char *ip_addr2xa(struct ip_addr *ip); -/* full address in text representation, including [] for ipv6 */ +/* full address in text representation, including [] for ipv6 + * - it uses an internal static buffer */ char *ip_addr2strz(struct ip_addr *ip); +/* full address in text representation, including [] for ipv6 + * - it uses a pool of internal static buffers */ +char *ip_addr2xstrz(struct ip_addr *ip); #define SU2A_MAX_STR_SIZE\ ___ Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org To unsubscribe send an email to sr-dev-le...@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
[sr-dev] git:master:bebf3782: corex: fixed name of pv in log message
Module: kamailio Branch: master Commit: bebf378252484f770f2dbc9a27e6ad2b7ff7f880 URL: https://github.com/kamailio/kamailio/commit/bebf378252484f770f2dbc9a27e6ad2b7ff7f880 Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2024-11-25T09:16:30+01:00 corex: fixed name of pv in log message --- Modified: src/modules/corex/corex_mod.c --- Diff: https://github.com/kamailio/kamailio/commit/bebf378252484f770f2dbc9a27e6ad2b7ff7f880.diff Patch: https://github.com/kamailio/kamailio/commit/bebf378252484f770f2dbc9a27e6ad2b7ff7f880.patch --- diff --git a/src/modules/corex/corex_mod.c b/src/modules/corex/corex_mod.c index c5008bfb445..115e50f8a03 100644 --- a/src/modules/corex/corex_mod.c +++ b/src/modules/corex/corex_mod.c @@ -1533,7 +1533,7 @@ static int pv_parse_atkv_name(pv_spec_t *sp, str *in) return 0; error: - LM_ERR("unknown PV time name %.*s\n", in->len, in->s); + LM_ERR("unknown PV atkv name %.*s\n", in->len, in->s); return -1; } ___ Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org To unsubscribe send an email to sr-dev-le...@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
[sr-dev] git:master:8d12a04b: async: fixed name of pv in log message
Module: kamailio Branch: master Commit: 8d12a04b57db2f3da6f522b6685161b38ff40d5e URL: https://github.com/kamailio/kamailio/commit/8d12a04b57db2f3da6f522b6685161b38ff40d5e Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2024-11-25T09:16:30+01:00 async: fixed name of pv in log message --- Modified: src/modules/async/async_sleep.c --- Diff: https://github.com/kamailio/kamailio/commit/8d12a04b57db2f3da6f522b6685161b38ff40d5e.diff Patch: https://github.com/kamailio/kamailio/commit/8d12a04b57db2f3da6f522b6685161b38ff40d5e.patch --- diff --git a/src/modules/async/async_sleep.c b/src/modules/async/async_sleep.c index 5fb8861a861..26d2e067597 100644 --- a/src/modules/async/async_sleep.c +++ b/src/modules/async/async_sleep.c @@ -701,7 +701,7 @@ int pv_parse_async_name(pv_spec_t *sp, str *in) return 0; error: - LM_ERR("unknown PV time name %.*s\n", in->len, in->s); + LM_ERR("unknown PV async name %.*s\n", in->len, in->s); return -1; } ___ Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org To unsubscribe send an email to sr-dev-le...@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
[sr-dev] git:master:e58dc893: core: tcp read - convert ips to different buffers for log messages
Module: kamailio Branch: master Commit: e58dc89324b30f09853a7430620e632ec5efaad5 URL: https://github.com/kamailio/kamailio/commit/e58dc89324b30f09853a7430620e632ec5efaad5 Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2024-11-25T10:27:11+01:00 core: tcp read - convert ips to different buffers for log messages --- Modified: src/core/tcp_read.c --- Diff: https://github.com/kamailio/kamailio/commit/e58dc89324b30f09853a7430620e632ec5efaad5.diff Patch: https://github.com/kamailio/kamailio/commit/e58dc89324b30f09853a7430620e632ec5efaad5.patch --- diff --git a/src/core/tcp_read.c b/src/core/tcp_read.c index fd60918fe34..cd7790eb958 100644 --- a/src/core/tcp_read.c +++ b/src/core/tcp_read.c @@ -265,10 +265,10 @@ int tcp_read_data(int fd, struct tcp_connection *c, char *buf, int b_size, } } LOG(cfg_get(core, core_cfg, corelog), - "error reading: %s (%d) ([%s]:%u ->", strerror(errno), - errno, ip_addr2a(&c->rcv.src_ip), c->rcv.src_port); - LOG(cfg_get(core, core_cfg, corelog), "-> [%s]:%u)\n", - ip_addr2a(&c->rcv.dst_ip), c->rcv.dst_port); + "error reading: %s (%d) ([%s]:%u -> [%s]:%u)\n", + strerror(errno), errno, ip_addr2xa(&c->rcv.src_ip), + c->rcv.src_port, ip_addr2xa(&c->rcv.dst_ip), + c->rcv.dst_port); if(errno == ETIMEDOUT) { c->event = TCP_CLOSED_TIMEOUT; } else if(errno == ECONNRESET) { @@ -280,8 +280,8 @@ int tcp_read_data(int fd, struct tcp_connection *c, char *buf, int b_size, LM_DBG("EOF on connection %p (state: %u, flags: %x) - FD %d," " bytes %d, rd-flags %x ([%s]:%u -> [%s]:%u)", c, c->state, c->flags, fd, bytes_read, *flags, - ip_addr2a(&c->rcv.src_ip), c->rcv.src_port, - ip_addr2a(&c->rcv.dst_ip), c->rcv.dst_port); + ip_addr2xa(&c->rcv.src_ip), c->rcv.src_port, + ip_addr2xa(&c->rcv.dst_ip), c->rcv.dst_port); c->state = S_CONN_EOF; *flags |= RD_CONN_EOF; c->event = TCP_CLOSED_EOF; ___ Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org To unsubscribe send an email to sr-dev-le...@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
[sr-dev] Re: [kamailio/kamailio] Add timer to ping rtpengine (PR #4016)
Merged #4016 into master. -- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/4016#event-15417325538 You are receiving this because you are subscribed to this thread. Message ID: ___ Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org To unsubscribe send an email to sr-dev-le...@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
[sr-dev] git:master:55691f82: modules: readme files regenerated - rtpengine ... [skip ci]
Module: kamailio Branch: master Commit: 55691f82666f361bac5efb6355e6f32afb508660 URL: https://github.com/kamailio/kamailio/commit/55691f82666f361bac5efb6355e6f32afb508660 Author: Kamailio Dev Committer: Kamailio Dev Date: 2024-11-25T10:46:10+01:00 modules: readme files regenerated - rtpengine ... [skip ci] --- Modified: src/modules/rtpengine/README --- Diff: https://github.com/kamailio/kamailio/commit/55691f82666f361bac5efb6355e6f32afb508660.diff Patch: https://github.com/kamailio/kamailio/commit/55691f82666f361bac5efb6355e6f32afb508660.patch ___ Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org To unsubscribe send an email to sr-dev-le...@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
[sr-dev] git:master:c9ec6cad: dispatcher: function to fetch by group id and uri
Module: kamailio Branch: master Commit: c9ec6cad7300d40beef095116bcdd361bc9690c4 URL: https://github.com/kamailio/kamailio/commit/c9ec6cad7300d40beef095116bcdd361bc9690c4 Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2024-11-25T19:58:06+01:00 dispatcher: function to fetch by group id and uri --- Modified: src/modules/dispatcher/dispatcher.c --- Diff: https://github.com/kamailio/kamailio/commit/c9ec6cad7300d40beef095116bcdd361bc9690c4.diff Patch: https://github.com/kamailio/kamailio/commit/c9ec6cad7300d40beef095116bcdd361bc9690c4.patch --- diff --git a/src/modules/dispatcher/dispatcher.c b/src/modules/dispatcher/dispatcher.c index d9626000ddc..852296bbad1 100644 --- a/src/modules/dispatcher/dispatcher.c +++ b/src/modules/dispatcher/dispatcher.c @@ -185,6 +185,7 @@ static int w_ds_reload(struct sip_msg* msg, char*, char*); static int w_ds_is_active(sip_msg_t *msg, char *pset, char *p2); static int w_ds_is_active_uri(sip_msg_t *msg, char *pset, char *puri); static int w_ds_dsg_fetch(sip_msg_t *msg, char *pset, char *p2); +static int w_ds_dsg_fetch_uri(sip_msg_t *msg, char *pset, char *puri); static int w_ds_oc_set_attrs(sip_msg_t*, char*, char*, char*, char*, char*); static int fixup_ds_is_from_list(void** param, int param_no); @@ -199,6 +200,7 @@ static int pv_parse_dsv(pv_spec_p sp, str *in); static int pv_get_dsg(sip_msg_t *msg, pv_param_t *param, pv_value_t *res); static int pv_parse_dsg(pv_spec_p sp, str *in); static void ds_dsg_fetch(int dg); +static void ds_dsg_fetch_uri(int dg, str *uri); static pv_export_t mod_pvs[] = { { {"dsv", (sizeof("dsv")-1)}, PVT_OTHER, pv_get_dsv, 0, @@ -266,6 +268,8 @@ static cmd_export_t cmds[]={ fixup_isiii, fixup_free_isiii, ANY_ROUTE}, {"ds_dsg_fetch", (cmd_function)w_ds_dsg_fetch, 1, fixup_igp_null, fixup_free_igp_null, ANY_ROUTE}, + {"ds_dsg_fetch_uri", (cmd_function)w_ds_dsg_fetch_uri, 2, + fixup_igp_spve, fixup_free_igp_spve, ANY_ROUTE}, {0,0,0,0,0,0} }; @@ -1367,14 +1371,32 @@ static int pv_parse_dsv(pv_spec_p sp, str *in) /** * */ -static int _pv_dsg_fetch = 1; +static int _pv_dsg_fetch_dg = 1; +static str _pv_dsg_fetch_uri = STR_NULL; /** * */ static void ds_dsg_fetch(int dg) { - _pv_dsg_fetch = dg; + _pv_dsg_fetch_dg = dg; + if(_pv_dsg_fetch_uri.s != NULL) { + pkg_free(_pv_dsg_fetch_uri.s); + } + _pv_dsg_fetch_uri.s = NULL; + _pv_dsg_fetch_uri.len = 0; +} + +/** + * + */ +static void ds_dsg_fetch_uri(int dg, str *uri) +{ + _pv_dsg_fetch_dg = dg; + if(_pv_dsg_fetch_uri.s != NULL) { + pkg_free(_pv_dsg_fetch_uri.s); + } + pkg_str_dup(&_pv_dsg_fetch_uri, uri); } /** @@ -1393,6 +1415,28 @@ static int w_ds_dsg_fetch(sip_msg_t *msg, char *pset, char *p2) return 1; } +/** + * + */ +static int w_ds_dsg_fetch_uri(sip_msg_t *msg, char *pset, char *puri) +{ + int set; + str suri = STR_NULL; + + if(fixup_get_ivalue(msg, (gparam_p)pset, &set) != 0) { + LM_ERR("cannot get set id param value\n"); + return -1; + } + if(fixup_get_svalue(msg, (gparam_p)puri, &suri) != 0) { + LM_ERR("cannot get uri param value\n"); + return -1; + } + + ds_dsg_fetch_uri(set, &suri); + + return 1; +} + /** * */ @@ -1439,16 +1483,19 @@ static int pv_get_dsg(sip_msg_t *msg, pv_param_t *param, pv_value_t *res) int active = 0; int inactive = 0; int j = 0; + ds_ocdata_t ocdata; if(param == NULL) { return -1; } - dsg = ds_list_lookup(_pv_dsg_fetch); + dsg = ds_list_lookup(_pv_dsg_fetch_dg); if(dsg == NULL) { return pv_get_null(msg, param, res); } + memset(&ocdata, 0, sizeof(ds_ocdata_t)); + lock_get(&dsg->lock); count = dsg->nr; for(j = 0; j < dsg->nr; j++) { @@ -1457,6 +1504,14 @@ static int pv_get_dsg(sip_msg_t *msg, pv_param_t *param, pv_value_t *res) } else { active++; } + if(_pv_dsg_fetch_uri.s != NULL && _pv_dsg_fetch_uri.len > 0) { + if((_pv_dsg_fetch_uri.len == dsg->dlist[j].uri.len) + && (strncmp(dsg->dlist[j].uri.s, _pv_dsg_fetch_uri.s, + _pv_dsg_fetch_uri.len) + == 0)) { + memcpy(&ocdata, &dsg->dlist[j].ocdata, sizeof(ds_ocdata_t)); + } + } } lock_release(&dsg->lock); ___ Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org To unsubscribe send an email to sr-dev-le...@lists.kamailio.org Important: keep the mailing
[sr-dev] git:master:556efcaa: core: tcp - emit async tkv event for read error
Module: kamailio Branch: master Commit: 556efcaa34367dc689ee653b0de9f22ccef073f9 URL: https://github.com/kamailio/kamailio/commit/556efcaa34367dc689ee653b0de9f22ccef073f9 Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2024-11-25T19:58:06+01:00 core: tcp - emit async tkv event for read error --- Modified: src/core/tcp_read.c --- Diff: https://github.com/kamailio/kamailio/commit/556efcaa34367dc689ee653b0de9f22ccef073f9.diff Patch: https://github.com/kamailio/kamailio/commit/556efcaa34367dc689ee653b0de9f22ccef073f9.patch --- diff --git a/src/core/tcp_read.c b/src/core/tcp_read.c index cd7790eb958..c08d9bf074f 100644 --- a/src/core/tcp_read.c +++ b/src/core/tcp_read.c @@ -52,6 +52,7 @@ #include "ut.h" #include "trim.h" #include "pt.h" +#include "async_task.h" #include "daemonize.h" #include "cfg/cfg_struct.h" #ifdef CORE_TLS @@ -269,6 +270,9 @@ int tcp_read_data(int fd, struct tcp_connection *c, char *buf, int b_size, strerror(errno), errno, ip_addr2xa(&c->rcv.src_ip), c->rcv.src_port, ip_addr2xa(&c->rcv.dst_ip), c->rcv.dst_port); + async_tkv_emit(1200, "tcp-read-error", + "erno=%d;srcip=%s;dstip=%s", errno, + ip_addr2xa(&c->rcv.src_ip), ip_addr2xa(&c->rcv.dst_ip)); if(errno == ETIMEDOUT) { c->event = TCP_CLOSED_TIMEOUT; } else if(errno == ECONNRESET) { ___ Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org To unsubscribe send an email to sr-dev-le...@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
[sr-dev] Re: [kamailio/kamailio] Add timer to ping rtpengine (PR #4016)
@xkaraman pushed 4 commits. 8dbd95bc3ddf5b5e59a0eea801be0f3809105fed rtpengine: Add timer to ping rtpengine 22dd98aafa5ab109e9230cd39baeebbfede7b34f rtpengine: Re-enable down servers (but not disabled ones) b726f7b5aec4038ee1d2e587fa5b5a50a7e127ec rtpengine: Add doxygen function descriptions aa4785cd545142331847cb57ea242f167a651e5c rtpengine/docs: Add ping_interval docs -- View it on GitHub: https://github.com/kamailio/kamailio/pull/4016/files/0a981e20115a3def935206118097ad8603feed62..aa4785cd545142331847cb57ea242f167a651e5c You are receiving this because you are subscribed to this thread. Message ID: ___ Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org To unsubscribe send an email to sr-dev-le...@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
[sr-dev] Re: [kamailio/kamailio] Add timer to ping rtpengine (PR #4016)
@rfuchs Thanks for the quick review. I am merging it! -- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/4016#issuecomment-2497408124 You are receiving this because you are subscribed to this thread. Message ID: ___ Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org To unsubscribe send an email to sr-dev-le...@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
[sr-dev] Re: [kamailio/kamailio] cdp: fixed issues discovered during static code analysis (PR #4030)
Merged #4030 into master. -- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/4030#event-15420024269 You are receiving this because you are subscribed to this thread. Message ID: ___ Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org To unsubscribe send an email to sr-dev-le...@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!
[sr-dev] git:master:1ceeba73: cdp: fixed issues discovered during static code analysis
Module: kamailio Branch: master Commit: 1ceeba7364b745b6ca2840e830d006a37460d10e URL: https://github.com/kamailio/kamailio/commit/1ceeba7364b745b6ca2840e830d006a37460d10e Author: Dragos Vingarzan Committer: Dragos Vingarzan Date: 2024-11-25T13:33:40+01:00 cdp: fixed issues discovered during static code analysis This fixes: - 4-bytes (typically uint32_t) used for time_t storage (Y2K38) - print of time_t with %d instead of %ld - reuse of same loop index variable in a sub-loop - use of random(), when kam_rand() could theoretically be better - copy-paste mistake in sp2/sp parameter, where sp2 was meant and sp is probably NULL --- Modified: src/modules/cdp/authstatemachine.c Modified: src/modules/cdp/common.c Modified: src/modules/cdp/diameter_peer.c Modified: src/modules/cdp/receiver.c Modified: src/modules/cdp/session.c Modified: src/modules/cdp/session.h --- Diff: https://github.com/kamailio/kamailio/commit/1ceeba7364b745b6ca2840e830d006a37460d10e.diff Patch: https://github.com/kamailio/kamailio/commit/1ceeba7364b745b6ca2840e830d006a37460d10e.patch ___ Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org To unsubscribe send an email to sr-dev-le...@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender!