[sr-dev] Re: [kamailio/kamailio] tm: add mandatory Max-Forwards header to local AC (3a34b46)
Victor Seva via sr-dev writes: > @juha-h please use ``cherry-pick -x `` when back-porting I used `git cherry-pick . This gets too complicated for me so better that I leave the git stuff to those who know. ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:5.8:3a34b468: tm: add mandatory Max-Forwards header to local AC
Module: kamailio Branch: 5.8 Commit: 3a34b468ad93904c507bd0fc7ef592b25321807f URL: https://github.com/kamailio/kamailio/commit/3a34b468ad93904c507bd0fc7ef592b25321807f Author: Juha Heinanen Committer: Juha Heinanen Date: 2024-05-20T19:54:45+03:00 tm: add mandatory Max-Forwards header to local AC --- Modified: src/modules/tm/t_msgbuilder.c --- Diff: https://github.com/kamailio/kamailio/commit/3a34b468ad93904c507bd0fc7ef592b25321807f.diff Patch: https://github.com/kamailio/kamailio/commit/3a34b468ad93904c507bd0fc7ef592b25321807f.patch --- diff --git a/src/modules/tm/t_msgbuilder.c b/src/modules/tm/t_msgbuilder.c index 362ff6c5eb5..1aa680aa9a4 100644 --- a/src/modules/tm/t_msgbuilder.c +++ b/src/modules/tm/t_msgbuilder.c @@ -1246,7 +1246,8 @@ char *build_dlg_ack(struct sip_msg *rpl, struct cell *Trans, /* headers */ *len += Trans->from_hdr.len + Trans->callid_hdr.len + to->len - + Trans->cseq_hdr_n.len + 1 + ACK_LEN + CRLF_LEN; + + Trans->cseq_hdr_n.len + 1 + ACK_LEN + +MAXFWD_HEADER_LEN + + CRLF_LEN; /* copy'n'paste Route headers */ @@ -1291,6 +1292,8 @@ char *build_dlg_ack(struct sip_msg *rpl, struct cell *Trans, append_str(p, Trans->callid_hdr.s, Trans->callid_hdr.len); append_str(p, to->s, to->len); + append_str(p, MAXFWD_HEADER, MAXFWD_HEADER_LEN); + append_str(p, Trans->cseq_hdr_n.s, Trans->cseq_hdr_n.len); append_str(p, " ", 1); append_str(p, ACK, ACK_LEN); ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:master:0054b875: Avoid 'qm_strnstr' defined but not used warning
Module: kamailio Branch: master Commit: 0054b875045b4badfedd3e8424bf4772d6a9bc6b URL: https://github.com/kamailio/kamailio/commit/0054b875045b4badfedd3e8424bf4772d6a9bc6b Author: Juha Heinanen Committer: Juha Heinanen Date: 2024-03-12T22:18:20+02:00 Avoid 'qm_strnstr' defined but not used warning --- Modified: src/core/mem/q_malloc.c --- Diff: https://github.com/kamailio/kamailio/commit/0054b875045b4badfedd3e8424bf4772d6a9bc6b.diff Patch: https://github.com/kamailio/kamailio/commit/0054b875045b4badfedd3e8424bf4772d6a9bc6b.patch --- diff --git a/src/core/mem/q_malloc.c b/src/core/mem/q_malloc.c index aa68debdf30..5850c07a018 100644 --- a/src/core/mem/q_malloc.c +++ b/src/core/mem/q_malloc.c @@ -993,6 +993,7 @@ void qm_status(void *qmp) } +#ifdef DBG_QM_MALLOC static void *qm_strnstr(const void *b1, int l1, const void *b2, int l2) { char *sp = (char *)b1; @@ -1012,6 +1013,7 @@ static void *qm_strnstr(const void *b1, int l1, const void *b2, int l2) return NULL; } +#endif void qm_status_filter(void *qmp, str *fmatch, FILE *fp) { ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:5.8:2122afae: Avoid 'qm_strnstr' defined but not used warning
Module: kamailio Branch: 5.8 Commit: 2122afae2a6604c0bc44a43ab37ee274a15a700a URL: https://github.com/kamailio/kamailio/commit/2122afae2a6604c0bc44a43ab37ee274a15a700a Author: Juha Heinanen Committer: Juha Heinanen Date: 2024-03-12T22:16:23+02:00 Avoid 'qm_strnstr' defined but not used warning --- Modified: src/core/mem/q_malloc.c --- Diff: https://github.com/kamailio/kamailio/commit/2122afae2a6604c0bc44a43ab37ee274a15a700a.diff Patch: https://github.com/kamailio/kamailio/commit/2122afae2a6604c0bc44a43ab37ee274a15a700a.patch --- diff --git a/src/core/mem/q_malloc.c b/src/core/mem/q_malloc.c index aa68debdf30..5850c07a018 100644 --- a/src/core/mem/q_malloc.c +++ b/src/core/mem/q_malloc.c @@ -993,6 +993,7 @@ void qm_status(void *qmp) } +#ifdef DBG_QM_MALLOC static void *qm_strnstr(const void *b1, int l1, const void *b2, int l2) { char *sp = (char *)b1; @@ -1012,6 +1013,7 @@ static void *qm_strnstr(const void *b1, int l1, const void *b2, int l2) return NULL; } +#endif void qm_status_filter(void *qmp, str *fmatch, FILE *fp) { ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:5.8:1928af8f: core: set null-terminated char for modparam (backport from master)
Module: kamailio Branch: 5.8 Commit: 1928af8f90ebf02f610c0904bc3d24a00aaedb81 URL: https://github.com/kamailio/kamailio/commit/1928af8f90ebf02f610c0904bc3d24a00aaedb81 Author: Juha Heinanen Committer: Juha Heinanen Date: 2024-03-12T07:54:50+02:00 core: set null-terminated char for modparam (backport from master) --- Modified: src/core/modparam.c --- Diff: https://github.com/kamailio/kamailio/commit/1928af8f90ebf02f610c0904bc3d24a00aaedb81.diff Patch: https://github.com/kamailio/kamailio/commit/1928af8f90ebf02f610c0904bc3d24a00aaedb81.patch --- diff --git a/src/core/modparam.c b/src/core/modparam.c index 46ea0169e53..b48d9e82442 100644 --- a/src/core/modparam.c +++ b/src/core/modparam.c @@ -152,6 +152,7 @@ int set_mod_param_regex(char *regex, char *name, modparam_t type, void *val) return -1; } strncpy(*((char **)ptr), (char *)val2, len_param); + (*((char **)ptr))[len_param] = '\0'; break; case PARAM_STR: ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] Re: git:master:1acede64: core: added tcp_check_timer parameter
How about the diff below? Also, is there plan to backport ksr_tcp_msg_data_timeout, ksr_tcp_msg_read_timeout, and ksr_tcp_check_timer to 5.7, since they can help in protecting from DoS attacks that we have seen in the wild. -- Juha diff --git a/src/main.c b/src/main.c index 0fa2da6ec2..f3cddf8bad 100644 --- a/src/main.c +++ b/src/main.c @@ -535,7 +535,7 @@ int ksr_tcp_msg_read_timeout = 20; /* timeout (secs) to read SIP message */ int ksr_tcp_msg_data_timeout = 20; /* timeout (secs) to receive first msg data */ int ksr_tcp_accept_iplimit = 1024; /* limit of accepted connections per IP */ -int ksr_tcp_check_timer = 10; /* seconds to check tcp connections */ +int ksr_tcp_check_timer = -1; /* seconds to check tcp connections */ /* memory manager */ #define SR_MEMMNG_DEFAULT "qm" @@ -1726,12 +1726,22 @@ int main_loop(void) cfg_main_reset_local(); #ifdef USE_TCP - if(!tcp_disable && ksr_tcp_check_timer > 0) { - if(sr_wtimer_add( + if(!tcp_disable) { + if(ksr_tcp_check_timer == -1) { + if(ksr_tcp_msg_data_timeout > 0 && ksr_tcp_msg_read_timeout > 0) + ksr_tcp_check_timer = + MIN(ksr_tcp_msg_data_timeout, ksr_tcp_msg_read_timeout) / 2; + else + ksr_tcp_check_timer = ksr_tcp_msg_data_timeout > 0 ? + ksr_tcp_msg_data_timeout / 2 : ksr_tcp_msg_read_timeout / 2; + } + if(ksr_tcp_check_timer > 0) { + if(sr_wtimer_add( tcp_timer_check_connections, NULL, ksr_tcp_check_timer) - < 0) { - LM_CRIT("cannot add timer for tcp connection checks\n"); - goto error; + < 0) { + LM_CRIT("cannot add timer for tcp connection checks\n"); + goto error; + } } } #endif ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] Re: git:master:1acede64: core: added tcp_check_timer parameter
Daniel-Constantin Mierla writes: > > In order to make configuration simpler, how about having a dynamic default > > as I suggested? > > Default is half (hardcoded), but its own parameter gives more > flexibility for granularity -- one extra parameter is not adding much > complexity, imo, and case by case one may want more often checks to > clean up those that end up in timeout. I didn't suggest to remove the parameter, but change its default value if the parameter is not given. ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] Re: git:master:1acede64: core: added tcp_check_timer parameter
Daniel-Constantin Mierla writes: > Smaller is recommended for better accuracy. In order to make configuration simpler, how about having a dynamic default as I suggested? ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] Re: git:master:1acede64: core: added tcp_check_timer parameter
If so, how about defaulting to half of tcp_msg_read_timeout or tcp_msg_data_timeout whichever is smallest? ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:master:1acede64: core: added tcp_check_timer parameter
Daniel-Constantin Mierla via sr-dev writes: > core: added tcp_check_timer parameter > > - set the check interval (in seconds) for tcp connections > - default 10 Does this need to be smaller than tcp_msg_read_timeout and tcp_msg_data_timeout in order for them to have effect? ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org