[sr-dev] Re: [kamailio/kamailio] Kamailio segfaults when KEMI functions are invoked from app_python script (Issue #3746)

2024-04-06 Thread github-actions[bot] via sr-dev
Closed #3746 as not planned.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3746#event-12382951035
You are receiving this because you are subscribed to this thread.

Message ID: ___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org


[sr-dev] git:master:b4537720: modules: readme files regenerated - corex ... [skip ci]

2024-04-06 Thread Kamailio Dev via sr-dev
Module: kamailio
Branch: master
Commit: b4537720ff8158d59856cc0601ff4bf84216be99
URL: 
https://github.com/kamailio/kamailio/commit/b4537720ff8158d59856cc0601ff4bf84216be99

Author: Kamailio Dev 
Committer: Kamailio Dev 
Date: 2024-04-06T08:46:21+02:00

modules: readme files regenerated - corex ... [skip ci]

---

Modified: src/modules/corex/README

---

Diff:  
https://github.com/kamailio/kamailio/commit/b4537720ff8158d59856cc0601ff4bf84216be99.diff
Patch: 
https://github.com/kamailio/kamailio/commit/b4537720ff8158d59856cc0601ff4bf84216be99.patch

___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org


[sr-dev] git:master:9b3b8ec9: corex: docs for dns_file parameter

2024-04-06 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: 9b3b8ec968c6f7bda0d10a0d4fe593a92560ee7d
URL: 
https://github.com/kamailio/kamailio/commit/9b3b8ec968c6f7bda0d10a0d4fe593a92560ee7d

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-06T08:35:19+02:00

corex: docs for dns_file parameter

---

Modified: src/modules/corex/doc/corex_admin.xml

---

Diff:  
https://github.com/kamailio/kamailio/commit/9b3b8ec968c6f7bda0d10a0d4fe593a92560ee7d.diff
Patch: 
https://github.com/kamailio/kamailio/commit/9b3b8ec968c6f7bda0d10a0d4fe593a92560ee7d.patch

---

diff --git a/src/modules/corex/doc/corex_admin.xml 
b/src/modules/corex/doc/corex_admin.xml
index d5cfe1db477..3cdad0aa2a5 100644
--- a/src/modules/corex/doc/corex_admin.xml
+++ b/src/modules/corex/doc/corex_admin.xml
@@ -162,6 +162,41 @@ modparam("corex", "alias_subdomains", 
"udp:sip-router.org:5060")
 modparam("corex", "dns_cache", 
"type=A;name=kamailio.org;addr=193.22.119.66;ttl=360;flags=0")
 modparam("corex", "dns_cache", 
"type=;name=kamailio.org;addr=2a00:d60:0:400::2;ttl=360;flags=0")
 ...
+
+   
+   
+   
+   dns_file (string)
+   
+   Path to the file from where to load dns_cache records. It can 
be set
+   many times to add more than one file.
+   
+   
+   Inside the file, the dns_cache record has to be in a single line, 
with
+   the format of the dns_cache module parameter (see above). Empty 
lines
+   or lines with whitespaces only are ignored. Comment lines have to 
start
+   with '#'. Comments are not accepted after dns_cache records, only on
+   separate lines.
+   
+   
+   
+   Default value is NULL.
+   
+   
+   
+   Set dns_file parameter
+   
+...
+# content of /etc/kamailio/kamailio-cache.dns
+
+# IPv4 record
+type=A;name=kamailio.org;addr=193.22.119.66;ttl=360;flags=0
+# IPv6 record
+type=;name=kamailio.org;addr=2a00:d60:0:400::2;ttl=360;flags=0
+...
+...
+modparam("corex", "dns_file", "/etc/kamailio/kamailio-cache.dns")
+...
 


@@ -1291,4 +1326,3 @@ sub do_uncompress() {
 
 
 
-

___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org


[sr-dev] git:master:c8cf642c: corex: added dns_file modparam

2024-04-06 Thread Daniel-Constantin Mierla via sr-dev
Module: kamailio
Branch: master
Commit: c8cf642c21169bcaee82347db858d8f3bcb6a42c
URL: 
https://github.com/kamailio/kamailio/commit/c8cf642c21169bcaee82347db858d8f3bcb6a42c

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2024-04-06T08:19:19+02:00

corex: added dns_file modparam

- can be set to the path of a file containing dns_cache records
- each line has to contain a dns_cache-param-formatted record
- empty lines are allowed
- comment line has to start with #, comments can be only on separate
  line, not supported after dns_cache record

---

Modified: src/modules/corex/corex_mod.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/c8cf642c21169bcaee82347db858d8f3bcb6a42c.diff
Patch: 
https://github.com/kamailio/kamailio/commit/c8cf642c21169bcaee82347db858d8f3bcb6a42c.patch

---

diff --git a/src/modules/corex/corex_mod.c b/src/modules/corex/corex_mod.c
index 4152fbf5df4..6739e4cee16 100644
--- a/src/modules/corex/corex_mod.c
+++ b/src/modules/corex/corex_mod.c
@@ -32,6 +32,7 @@
 #include "../../core/fmsg.h"
 #include "../../core/kemi.h"
 #include "../../core/str_list.h"
+#include "../../core/trim.h"
 #include "../../core/events.h"
 #include "../../core/onsend.h"
 #include "../../core/forward.h"
@@ -82,12 +83,15 @@ static int corex_evrt_reply_out_no = -1;
 
 int corex_alias_subdomains_param(modparam_t type, void *val);
 int corex_dns_cache_param(modparam_t type, void *val);
+int corex_dns_file_param(modparam_t type, void *val);
+int corex_dns_file_load(void);
 
 static int mod_init(void);
 static int child_init(int);
 static void mod_destroy(void);
 
 static str_list_t *corex_dns_cache_list = NULL;
+static str_list_t *corex_dns_file_list = NULL;
 
 static int corex_dns_cache_param_add(str *pval);
 
@@ -176,6 +180,8 @@ static param_export_t params[] = {
(void *)corex_alias_subdomains_param},
{"dns_cache", PARAM_STR | USE_FUNC_PARAM,
(void *)corex_dns_cache_param},
+   {"dns_file", PARAM_STR | USE_FUNC_PARAM,
+   (void *)corex_dns_file_param},
{"nio_intercept", INT_PARAM, _intercept},
{"nio_min_msg_len", INT_PARAM, _min_msg_len},
{"nio_msg_avp", PARAM_STR, _msg_avp_param},
@@ -226,6 +232,9 @@ static int mod_init(void)
return -1;
}
}
+   if(corex_dns_file_load() < 0) {
+   return -1;
+   }
 
if((nio_intercept > 0) && (nio_intercept_init() < 0)) {
LM_ERR("failed to register network io intercept callback\n");
@@ -385,6 +394,67 @@ int corex_dns_cache_param(modparam_t type, void *val)
return 0;
 }
 
+int corex_dns_file_param(modparam_t type, void *val)
+{
+   str_list_t *sit;
+
+   if(val == NULL || ((str *)val)->s == NULL || ((str *)val)->len == 0) {
+   LM_ERR("invalid parameter\n");
+   return -1;
+   }
+
+   sit = (str_list_t *)pkg_mallocxz(sizeof(str_list_t));
+   if(sit == NULL) {
+   PKG_MEM_ERROR;
+   return -1;
+   }
+   sit->s = *((str *)val);
+   if(corex_dns_file_list != NULL) {
+   sit->next = corex_dns_file_list;
+   }
+   corex_dns_file_list = sit;
+
+   return 0;
+}
+
+int corex_dns_file_load(void)
+{
+   str_list_t *sit;
+   str sline;
+   char lbuf[512];
+   FILE *FP;
+
+   for(sit = corex_dns_file_list; sit != NULL; sit = sit->next) {
+   FP = fopen(sit->s.s, "r");
+   if(FP == NULL) {
+   LM_ERR("failed to open file '%.*s'\n", sit->s.len, 
sit->s.s);
+   return -1;
+   }
+   while(fgets(lbuf, 512, FP)) {
+   sline.s = lbuf;
+   sline.len = strlen(sline.s);
+   trim();
+   if(sline.len <= 0) {
+   /* empty line */
+   continue;
+   }
+   if(sline.s[0] == '#') {
+   /* comment */
+   continue;
+   }
+   if(corex_dns_cache_param_add() < 0) {
+   LM_ERR("failed to add record: '%.*s' (%.*s)\n", 
sline.len,
+   sline.s, sit->s.len, sit->s.s);
+   fclose(FP);
+   return -1;
+   }
+   }
+   fclose(FP);
+   }
+
+   return 0;
+}
+
 static int corex_dns_cache_param_add(str *pval)
 {
str sval;

___
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org