Re: [sr-dev] [kamailio/kamailio] Cannot set alias from substdef/environment (#2310)

2020-05-01 Thread Daniel-Constantin Mierla
The list of aliases seems ok, the address is the value of the environment 
variable, unless you got the `kamctl rpc core.aliases_list` for the config with 
static alias value.

If you got it with the config using env variable, do it with the master branch 
and debug=3 in kamailio.cfg, then send the log debug messages when matching the 
myself. I just pushed a commit to print more details when matching the aliases 
list. It should reveal what is compared.

-- 
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/2310#issuecomment-622745569___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:34b9b59b: core: more debug messages when matching myself

2020-05-01 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 34b9b59b97f7d529025863992408fd60a27a941a
URL: 
https://github.com/kamailio/kamailio/commit/34b9b59b97f7d529025863992408fd60a27a941a

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2020-05-02T08:47:30+02:00

core: more debug messages when matching myself

- coherent coding style for related functions

---

Modified: src/core/forward.c
Modified: src/core/name_alias.h
Modified: src/core/socket_info.c

---

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


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:66ef7ab7: kamctl: kamdbclt mysql skip creating dbrouser if same as dbrwuser

2020-05-01 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 66ef7ab7b078794b96ecee13f6867d5f90a8d63e
URL: 
https://github.com/kamailio/kamailio/commit/66ef7ab7b078794b96ecee13f6867d5f90a8d63e

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2020-05-02T08:47:30+02:00

kamctl: kamdbclt mysql skip creating dbrouser if same as dbrwuser

---

Modified: utils/kamctl/kamdbctl.mysql

---

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

---

diff --git a/utils/kamctl/kamdbctl.mysql b/utils/kamctl/kamdbctl.mysql
index bdb8b98ab4..4050371bfe 100644
--- a/utils/kamctl/kamdbctl.mysql
+++ b/utils/kamctl/kamdbctl.mysql
@@ -161,9 +161,12 @@ kamailio_db_grant () # pars: 
 
# Users: kamailio is the regular user, kamailioro only for reading
sql_query "" "CREATE USER '${DBRWUSER}'@'$DBHOST' IDENTIFIED BY 
'$DBRWPW';
-   GRANT ALL PRIVILEGES ON $1.* TO '${DBRWUSER}'@'$DBHOST';
-   CREATE USER '${DBROUSER}'@'$DBHOST' IDENTIFIED BY '$DBROPW';
-   GRANT SELECT ON $1.* TO '${DBROUSER}'@'$DBHOST';"
+   GRANT ALL PRIVILEGES ON $1.* TO '${DBRWUSER}'@'$DBHOST';"
+
+   if [ "${DBRWUSER}" != "${DBROUSER}" ] ; then
+   sql_query "" "CREATE USER '${DBROUSER}'@'$DBHOST' IDENTIFIED BY 
'$DBROPW';
+   GRANT SELECT ON $1.* TO '${DBROUSER}'@'$DBHOST';"
+   fi
 
if [ $? -ne 0 ] ; then
merr "granting privileges to database $1 failed!"
@@ -172,9 +175,11 @@ kamailio_db_grant () # pars: 
 
if [ "$DBHOST" != "localhost" ] ; then
sql_query "" "CREATE USER '$DBRWUSER'@'localhost' IDENTIFIED BY 
'$DBRWPW';
-   GRANT ALL PRIVILEGES ON $1.* TO '$DBRWUSER'@'localhost';
-   CREATE USER '$DBROUSER'@'localhost' IDENTIFIED BY 
'$DBROPW';
-   GRANT SELECT ON $1.* TO '$DBROUSER'@'localhost';"
+   GRANT ALL PRIVILEGES ON $1.* TO 
'$DBRWUSER'@'localhost';"
+   if [ "${DBRWUSER}" != "${DBROUSER}" ] ; then
+   sql_query "" "CREATE USER '$DBROUSER'@'localhost' 
IDENTIFIED BY '$DBROPW';
+   GRANT SELECT ON $1.* TO 
'$DBROUSER'@'localhost';"
+   fi
if [ $? -ne 0 ] ; then
merr "granting localhost privileges to database $1 
failed!"
exit 1
@@ -183,9 +188,11 @@ kamailio_db_grant () # pars: 
 
if [ ! -z "$DBACCESSHOST" ] ; then
sql_query "" "CREATE USER '$DBRWUSER'@'$DBACCESSHOST' 
IDENTIFIED BY '$DBRWPW';
-   GRANT ALL PRIVILEGES ON $1.* TO 
'$DBRWUSER'@'$DBACCESSHOST';
-   CREATE USER '$DBROUSER'@'$DBACCESSHOST' IDENTIFIED BY 
'$DBROPW';
-   GRANT SELECT ON $1.* TO '$DBROUSER'@'$DBACCESSHOST';"
+   GRANT ALL PRIVILEGES ON $1.* TO 
'$DBRWUSER'@'$DBACCESSHOST';"
+   if [ "${DBRWUSER}" != "${DBROUSER}" ] ; then
+   sql_query "" "CREATE USER '$DBROUSER'@'$DBACCESSHOST' 
IDENTIFIED BY '$DBROPW';
+   GRANT SELECT ON $1.* TO 
'$DBROUSER'@'$DBACCESSHOST';"
+   fi
if [ $? -ne 0 ] ; then
merr "granting access host privileges to database $1 
failed!"
exit 1
@@ -203,8 +210,11 @@ kamailio_db_revoke () # pars: 
minfo "revoking privileges to database $1 ..."
 
# Users: kamailio is the regular user, kamailioro only for reading
-   sql_query "" "REVOKE ALL PRIVILEGES ON $1.* FROM 
'${DBRWUSER}'@'$DBHOST';
-   REVOKE SELECT ON $1.* FROM '${DBROUSER}'@'$DBHOST';"
+   sql_query "" "REVOKE ALL PRIVILEGES ON $1.* FROM 
'${DBRWUSER}'@'$DBHOST';"
+
+   if [ "${DBRWUSER}" != "${DBROUSER}" ] ; then
+   sql_query "" "REVOKE SELECT ON $1.* FROM 
'${DBROUSER}'@'$DBHOST';"
+   fi
 
if [ $? -ne 0 ] ; then
merr "revoking privileges to database $1 failed!"
@@ -212,8 +222,10 @@ kamailio_db_revoke () # pars: 
fi
 
if [ "$DBHOST" != "localhost" ] ; then
-   sql_query "" "REVOKE ALL PRIVILEGES ON $1.* FROM 
'$DBRWUSER'@'localhost';
-   REVOKE SELECT ON $1.* FROM '$DBROUSER'@'localhost';"
+   sql_query "" "REVOKE ALL PRIVILEGES ON $1.* FROM 
'$DBRWUSER'@'localhost';"
+   if [ "${DBRWUSER}" != "${DBROUSER}" ] ; then
+   sql_query "" "REVOKE SELECT ON $1.* FROM 
'$DBROUSER'@'localhost';"
+   fi
if [ $? -ne 0 ] ; then
merr "granting localhost privileges to database $1 
failed!"
exit 1
@@ -221,8 +233,10 @@ kamailio_db_revoke () # pars: 
fi
 
if [ ! -z "$DBACCESSHOST" ] ; then
-   sql_quer

Re: [sr-dev] [kamailio/kamailio] hash table size issue (#2311)

2020-05-01 Thread fborot
ok, thank you Daniel

-- 
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/2311#issuecomment-622558576___
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] hash table size issue (#2311)

2020-05-01 Thread Daniel-Constantin Mierla
That style of key for 3) is ok, there should be no problem with them.

So this looks like usage issues, needs tuning of modparams for ctl module for 
full output or use jsonrpcs module. kamcmd is also supporting only signed int, 
printing large numbers in negative value.

I am closing this one, let's discuss on sr-users if you still have issues 
getting them working as expected. If proves to be some issue in the code, this 
can be reopen.

-- 
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/2311#issuecomment-622547689___
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] hash table size issue (#2311)

2020-05-01 Thread Daniel-Constantin Mierla
Closed #2311.

-- 
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/2311#event-3294337653___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:5.3:cca28078: core: do not use tcp id for lookup if not needed

2020-05-01 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: 5.3
Commit: cca28078f7fe329046744c9b63d01bb9945a8dca
URL: 
https://github.com/kamailio/kamailio/commit/cca28078f7fe329046744c9b63d01bb9945a8dca

Author: Donato Sciarra 
Committer: Daniel-Constantin Mierla 
Date: 2020-05-01T09:55:25+02:00

core: do not use tcp id for lookup if not needed

In case the first lookup (with tcp id) is not successfull, the second
attempt should have been performed without a tcp id.
Issue was introduced with dc43750644 (new global parameter
tcp_connection_match) in 5.3.

(cherry picked from commit 24a3a172dbdecb6e987df943a3ad1acb4da664b5)

---

Modified: src/core/tcp_main.c

---

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

---

diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c
index 99d33ee719..1c9859f633 100644
--- a/src/core/tcp_main.c
+++ b/src/core/tcp_main.c
@@ -2029,7 +2029,7 @@ int tcp_send(struct dest_info* dst, union sockaddr_union* 
from,
if (likely(port)){
/* try again w/o id */
if(tcp_connection_match==TCPCONN_MATCH_STRICT) {
-   c=tcpconn_lookup(dst->id, &ip, port, 
from, try_local_port, con_lifetime);
+   c=tcpconn_lookup(0, &ip, port, from, 
try_local_port, con_lifetime);
} else {
c=tcpconn_get(0, &ip, port, from, 
con_lifetime);
}


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:5.3:178cbde6: app_python: use -fno-strict-aliasing for gcc

2020-05-01 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: 5.3
Commit: 178cbde6eac86a86b92b107cf2f039400c578a5f
URL: 
https://github.com/kamailio/kamailio/commit/178cbde6eac86a86b92b107cf2f039400c578a5f

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2020-05-01T09:54:30+02:00

app_python: use -fno-strict-aliasing for gcc

- python2 is known for not confirming strict aliasing
- it is EoL and likely not going to be fixed
- GH #2298

(cherry picked from commit 3366bf4f3746285d9dc29e8a2461f53983f0acf0)

---

Modified: src/modules/app_python/Makefile

---

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

---

diff --git a/src/modules/app_python/Makefile b/src/modules/app_python/Makefile
index 0d8bc98701..d22e63e6a4 100644
--- a/src/modules/app_python/Makefile
+++ b/src/modules/app_python/Makefile
@@ -29,5 +29,9 @@ endif
 
 DEFS+=-I${PYTHON_INCDIR}
 
+ifeq ($(CC_NAME), gcc)
+DEFS+= -fno-strict-aliasing
+endif
+
 include ../../Makefile.modules
 


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:5.3:0b6283dc: db2_local: replace timelocal() with mktime()

2020-05-01 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: 5.3
Commit: 0b6283dc6006c8817664dd915057442500e0dae8
URL: 
https://github.com/kamailio/kamailio/commit/0b6283dc6006c8817664dd915057442500e0dae8

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2020-05-01T09:53:53+02:00

db2_local: replace timelocal() with mktime()

- timelocal() is nonstandard GNU extension, not recommended to be used
and mktime() should be equivalent:
  * https://linux.die.net/man/3/timegm
- GH #2298

(cherry picked from commit a0fb220a8b60b135cabf6741882437317116d868)

---

Modified: src/modules/db2_ldap/ld_fld.c

---

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

---

diff --git a/src/modules/db2_ldap/ld_fld.c b/src/modules/db2_ldap/ld_fld.c
index 867c873e8f..7af731f077 100644
--- a/src/modules/db2_ldap/ld_fld.c
+++ b/src/modules/db2_ldap/ld_fld.c
@@ -270,7 +270,7 @@ static inline int ldap_gentime2db_datetime(time_t* dst, 
str* src)
 * of expiration by one hour when daylight saving is used
 */
time.tm_isdst = -1;
-   *dst = timelocal(&time);
+   *dst = mktime(&time);
}

return 0;


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:5.3:21e8b244: Makefile.defs: expose CC_NAME variable

2020-05-01 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: 5.3
Commit: 21e8b244cea32cd3dedba6fb515877a7cdf47a7a
URL: 
https://github.com/kamailio/kamailio/commit/21e8b244cea32cd3dedba6fb515877a7cdf47a7a

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2020-05-01T09:54:19+02:00

Makefile.defs: expose CC_NAME variable

(cherry picked from commit e64b29141afddf06bf7d5d68aa88679b54c5076c)

---

Modified: src/Makefile.defs

---

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

---

diff --git a/src/Makefile.defs b/src/Makefile.defs
index 41f33a51a0..ba0957 100644
--- a/src/Makefile.defs
+++ b/src/Makefile.defs
@@ -2166,10 +2166,10 @@ export exported_vars
 # variable changeable only at configure time (once saved in config.mak they
 #  cannot be overwritten from environment or command line, unless make cfg
 #  is run)
-saved_fixed_vars:= MAIN_NAME  CFG_NAME SCR_NAME FLAVOUR INSTALL_FLAVOUR \
+saved_fixed_vars:= MAIN_NAME CFG_NAME SCR_NAME FLAVOUR INSTALL_FLAVOUR \
SRC_NAME RELEASE OS ARCH \
C_DEFS DEFS_RM PROFILE CC LD MKDEP MKTAGS LDFLAGS C_INCLUDES \
-   CC_MKDEP_OPTS \
+   CC_NAME CC_MKDEP_OPTS \
MOD_LDFLAGS LIB_LDFLAGS UTILS_LDFLAGS LIB_SONAME LD_RPATH \
LIB_SUFFIX LIB_PREFIX \
LIBS \


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:5.3:a5d2abed: redis: init variables to get rid of compile warnings

2020-05-01 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: 5.3
Commit: a5d2abed49bde56f4bdda42aa6a941f419186baf
URL: 
https://github.com/kamailio/kamailio/commit/a5d2abed49bde56f4bdda42aa6a941f419186baf

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2020-05-01T09:54:04+02:00

redis: init variables to get rid of compile warnings

- GH #2298

(cherry picked from commit f1de08eef86dc2cd98509c90fa8b28212d47ca37)

---

Modified: src/modules/db_redis/redis_table.c

---

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

---

diff --git a/src/modules/db_redis/redis_table.c 
b/src/modules/db_redis/redis_table.c
index ed8105d807..721d31d8ea 100644
--- a/src/modules/db_redis/redis_table.c
+++ b/src/modules/db_redis/redis_table.c
@@ -495,13 +495,13 @@ int db_redis_parse_keys(km_redis_con_t *con) {
 str type_name;
 str column_name;
 
-struct str_hash_entry *table_entry;
-redis_table_t *table;
-redis_type_t *type;
-redis_type_t *type_target;
-redis_key_t *key;
-redis_key_t **key_target;
-redis_key_t *key_location;
+struct str_hash_entry *table_entry = NULL;
+redis_table_t *table = NULL;
+redis_type_t *type = NULL;
+redis_type_t *type_target = NULL;
+redis_key_t *key = NULL;
+redis_key_t **key_target = NULL;
+redis_key_t *key_location = NULL;
 
 enum {
 DBREDIS_KEYS_TABLE_ST,
@@ -641,13 +641,13 @@ int db_redis_parse_schema(km_redis_con_t *con) {
 struct dirent* dent;
 char *dir_name;
 
-str table_name;
+str table_name = str_init("");
 str column_name;
 str type_name;
 
-struct str_hash_entry *table_entry;
-struct str_hash_entry *column_entry;
-redis_table_t *table;
+struct str_hash_entry *table_entry = NULL;
+struct str_hash_entry *column_entry = NULL;
+redis_table_t *table = NULL;
 
 char full_path[_POSIX_PATH_MAX + 1];
 int path_len;


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:5.3:479ff8fb: db_redis: var initialization and safety check to avoid compiler warnings

2020-05-01 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: 5.3
Commit: 479ff8fb8761e9780bd33adf977bd44868f59b97
URL: 
https://github.com/kamailio/kamailio/commit/479ff8fb8761e9780bd33adf977bd44868f59b97

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2020-05-01T09:52:25+02:00

db_redis: var initialization and safety check to avoid compiler warnings

(cherry picked from commit b9b177ccffd58b11cf460764514486d29637dd55)

---

Modified: src/modules/db_redis/redis_table.c

---

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

---

diff --git a/src/modules/db_redis/redis_table.c 
b/src/modules/db_redis/redis_table.c
index fe63490174..ed8105d807 100644
--- a/src/modules/db_redis/redis_table.c
+++ b/src/modules/db_redis/redis_table.c
@@ -491,7 +491,7 @@ int db_redis_parse_keys(km_redis_con_t *con) {
 char *start;
 char *end;
 
-str table_name;
+str table_name = str_init("");
 str type_name;
 str column_name;
 
@@ -539,13 +539,18 @@ int db_redis_parse_keys(km_redis_con_t *con) {
 
 table_entry = str_hash_get(&con->tables, table_name.s, 
table_name.len);
 if (!table_entry) {
-LM_ERR("No table schema found for table '%.*s', fix config 
by adding one to the 'schema' mod-param!\n",
+LM_ERR("No table schema found for table '%.*s', fix config"
+   " by adding one to the 'schema' mod-param!\n",
 table_name.len, table_name.s);
 goto err;
 }
 table = table_entry->u.p;
 break;
 case DBREDIS_KEYS_TYPE_ST:
+   if(!table) {
+   LM_ERR("invalid definition, table not set\n");
+   goto err;
+   }
 while(p != end && *p != ':')
 ++p;
 if (p == end) {
@@ -615,8 +620,6 @@ int db_redis_parse_keys(km_redis_con_t *con) {
 case DBREDIS_KEYS_END_ST:
 LM_DBG("done parsing keys definition\n");
 return 0;
-
-
 }
 } while (p != end);
 


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:5.3:5b44b601: presence: increased the array size for rpc cleanup doc

2020-05-01 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: 5.3
Commit: 5b44b60173cb8c5415144b88090ee0f9884f8f76
URL: 
https://github.com/kamailio/kamailio/commit/5b44b60173cb8c5415144b88090ee0f9884f8f76

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2020-05-01T09:51:20+02:00

presence: increased the array size for rpc cleanup doc

- reformatted the static structure for coherence

(cherry picked from commit 318c6a068916b478f16702c6f05b16eb8b64ac20)

---

Modified: src/modules/presence/presence.c

---

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

---

diff --git a/src/modules/presence/presence.c b/src/modules/presence/presence.c
index 9679501fe2..3e7185c956 100644
--- a/src/modules/presence/presence.c
+++ b/src/modules/presence/presence.c
@@ -1725,7 +1725,9 @@ void rpc_presence_refresh_watchers(rpc_t *rpc, void *ctx)
 }
 
 static const char *rpc_presence_refresh_watchers_doc[2] = {
-   "Trigger refresh of watchers", 0};
+   "Trigger refresh of watchers",
+   0
+};
 
 /*! \brief
  *  rpc cmd: presence.updateWatchers
@@ -1767,7 +1769,9 @@ void rpc_presence_update_watchers(rpc_t *rpc, void *ctx)
 }
 
 static const char *rpc_presence_update_watchers_doc[2] = {
-   "Trigger update of watchers", 0};
+   "Trigger update of watchers",
+   0
+};
 
 
 void rpc_presence_cleanup(rpc_t *rpc, void *c)
@@ -1782,18 +1786,21 @@ void rpc_presence_cleanup(rpc_t *rpc, void *c)
return;
 }
 
-static const char *rpc_presence_cleanup_doc[2] = {
-   "Manually triggers the cleanup functions for the 
active_watchers, "
-   "presentity, and watchers tables.",
-   0};
+static const char *rpc_presence_cleanup_doc[3] = {
+   "Manually triggers the cleanup functions for the active_watchers, "
+   "presentity, and watchers tables.",
+   0
+};
+
 
 rpc_export_t presence_rpc[] = {
-   {"presence.cleanup", rpc_presence_cleanup, 
rpc_presence_cleanup_doc, 0},
-   {"presence.refreshWatchers", rpc_presence_refresh_watchers,
-   rpc_presence_refresh_watchers_doc, 0},
-   {"presence.updateWatchers", rpc_presence_update_watchers,
-   rpc_presence_update_watchers_doc, 0},
-   {0, 0, 0, 0}};
+   {"presence.cleanup", rpc_presence_cleanup, rpc_presence_cleanup_doc, 0},
+   {"presence.refreshWatchers", rpc_presence_refresh_watchers,
+   rpc_presence_refresh_watchers_doc, 0},
+   {"presence.updateWatchers", rpc_presence_update_watchers,
+   rpc_presence_update_watchers_doc, 0},
+   {0, 0, 0, 0}
+};
 
 static int presence_init_rpc(void)
 {


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:5.3:c26f248b: ims_usrloc_pcscf: fix value array size and compile warnings

2020-05-01 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: 5.3
Commit: c26f248ba5be9f56bc1c58ad531fc5ead060a2e2
URL: 
https://github.com/kamailio/kamailio/commit/c26f248ba5be9f56bc1c58ad531fc5ead060a2e2

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2020-05-01T09:52:35+02:00

ims_usrloc_pcscf: fix value array size and compile warnings

(cherry picked from commit 1292e40c5260fa77d34db91abf7aacf47549d5e2)

---

Modified: src/modules/ims_usrloc_pcscf/pcontact.c
Modified: src/modules/ims_usrloc_pcscf/usrloc_db.c

---

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

---

diff --git a/src/modules/ims_usrloc_pcscf/pcontact.c 
b/src/modules/ims_usrloc_pcscf/pcontact.c
index 1ac55734d7..e597a0daf4 100644
--- a/src/modules/ims_usrloc_pcscf/pcontact.c
+++ b/src/modules/ims_usrloc_pcscf/pcontact.c
@@ -123,8 +123,9 @@ void free_security(security_t* _p)
 return;
 }
 
-if(_p->sec_header.s)
+if(_p->sec_header.s) {
 shm_free(_p->sec_header.s);
+   }
 
 switch (_p->type)
 {
@@ -144,8 +145,9 @@ void free_security(security_t* _p)
 break;
 
 case SECURITY_TLS:
-   if(_p->data.tls)
+   if(_p->data.tls) {
shm_free(_p->data.tls);
+   }
 break;
 
 case SECURITY_NONE:
diff --git a/src/modules/ims_usrloc_pcscf/usrloc_db.c 
b/src/modules/ims_usrloc_pcscf/usrloc_db.c
index ba71673e44..ca57a2b4b3 100644
--- a/src/modules/ims_usrloc_pcscf/usrloc_db.c
+++ b/src/modules/ims_usrloc_pcscf/usrloc_db.c
@@ -213,7 +213,7 @@ int db_update_pcontact(pcontact_t* _c)
 int db_delete_pcontact(pcontact_t* _c)
 {
LM_DBG("Trying to delete contact: aor[%.*s], received port %u\n", 
_c->aor.len, _c->aor.s, _c->received_port);
-   db_val_t values[1];
+   db_val_t values[2];
db_key_t match_keys[2] = { &aor_col, &received_port_col };
 
VAL_TYPE(values) = DB1_STR;


___
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] hash table size issue (#2311)

2020-05-01 Thread fborot
thank you Daniel
3- the key is created as follows:
a.b.c.d:5060:X.Y.Z 
where "a.b.c.d" is the IP where we receive the call on, IP of the proxy
"X.Y.Z" are the first 3 octets of the source IP, customer sending calls to the 
proxy 

some times they are very similar for example
10.20.30.41:5060:10.20.30 


for 4 I will look into your suggestion

by the way the kamailio has 16 GB of ram, this is the output of "kamcmd 
core.shmmem"

`[root@aw-atl-proxy-02 sbin]# ./kamcmd core.shmmem
{
total: -2147483648
free: 2108379744
used: 37308232
real_used: 39103904
max_used: 39571432
fragments: 6458
}
`


-- 
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/2311#issuecomment-622453114___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:ac531266: modules: readme files regenerated - htable ... [skip ci]

2020-05-01 Thread Kamailio Dev
Module: kamailio
Branch: master
Commit: ac531266077490a85f1ab98853fd64df6feeea43
URL: 
https://github.com/kamailio/kamailio/commit/ac531266077490a85f1ab98853fd64df6feeea43

Author: Kamailio Dev 
Committer: Kamailio Dev 
Date: 2020-05-01T17:31:09+02:00

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

---

Modified: src/modules/htable/README

---

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

---

diff --git a/src/modules/htable/README b/src/modules/htable/README
index 4aa4c258a9..ca193e2213 100644
--- a/src/modules/htable/README
+++ b/src/modules/htable/README
@@ -444,11 +444,17 @@ $ kamcmd htable.dump htable
configuration file.
  * htname - string specifying the name of the hash table. This string
is used by $sht(...) to refer to the hash table.
- * size - number specifying the size of hash table. Larger value means
-   less collisions. The number of entries (aka slots or buckets) in
-   the table is 2^size. The possible range for this value is from 2 to
-   31, smaller or larger values will be increased to 3 (8 slots) or
-   decreased to 14 (16384 slots).
+ * size - number to control how many slots (buckets) to create for the
+   hash table. Larger value means more slots with higher probability
+   for less collisions. The actual number slots (or buckets) created
+   for the table is 2^size. The possible range for this value is from
+   2 to 31, smaller or larger values will be increased to 3 (8 slots)
+   or decreased to 14 (16384 slots). Note that each slot can store
+   more than one item, when there are collisions of hash ids computed
+   for keys. The items in the same slot are stored in a linked list.
+   In other words, the size is not setting a limit of how many items
+   can be stored in a hash table, as long as there is enough free
+   shared memory, new items can be added.
  * autoexpire -time in seconds to delete an item from a hash table if
no update was done to it. If is missing or set to 0, the items
won't expire.


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:35f711e6: htable: docs - more details about size attribute for htable

2020-05-01 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 35f711e6ec74c6e67edf99adaa15cc353f2ce949
URL: 
https://github.com/kamailio/kamailio/commit/35f711e6ec74c6e67edf99adaa15cc353f2ce949

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2020-05-01T17:26:39+02:00

htable: docs - more details about size attribute for htable

---

Modified: src/modules/htable/doc/htable_admin.xml

---

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

---

diff --git a/src/modules/htable/doc/htable_admin.xml 
b/src/modules/htable/doc/htable_admin.xml
index 408fb137d9..573d801bba 100644
--- a/src/modules/htable/doc/htable_admin.xml
+++ b/src/modules/htable/doc/htable_admin.xml
@@ -341,11 +341,17 @@ $ kamcmd htable.dump htable



-   size - number specifying the size 
of hash
-   table.  Larger value means less collisions. The number 
of entries
-   (aka slots or buckets) in the table is 2^size. The 
possible range
+   size - number to control how many 
slots
+   (buckets) to create for the hash table. Larger value 
means more
+   slots with higher probability for less collisions. The 
actual number
+   slots (or buckets) created for the table is 2^size. The 
possible range
for this value is from 2 to 31, smaller or larger 
values will be
-   increased to 3 (8 slots) or decreased to 14 (16384 
slots).
+   increased to 3 (8 slots) or decreased to 14 (16384 
slots). Note
+   that each slot can store more than one item, when there 
are
+   collisions of hash ids computed for keys. The items in 
the same
+   slot are stored in a linked list. In other words, the 
size is not
+   setting a limit of how many items can be stored in a 
hash table, as
+   long as there is enough free shared memory, new items 
can be added.





___
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] hash table size issue (#2311)

2020-05-01 Thread Daniel-Constantin Mierla
Duplicate key names (or arrays) are actually stored in hash table with 
distinctive keys, the key for hash table being the string built like 
`key[index]`.

The size attribute is for the number of buckets (slots) for the hash table, not 
the number of items that can be stored in the hash table. The number of items 
is limited by the shared memory, when it is no more enough free shared memory, 
then you get memory errors and new items no longer stored in hash table. The 
number of slots has relevance in searching for items, making it faster if there 
are no very many items on a bucket (slot).

At 3000 items, even size=12 (2^12 = 4096 slots) results in more slots than 
items, but of course there can be hashid collisions and many items stored in 
the same slot. Each slot keeps a linked list of values. Items are not deleted 
on hashid collision, they are just added to the same slot in the linked list.

For 3. maybe you can give explicit examples to be able to comment more.

For 4 you have to change the values of ctl module parameters related to 
buffers. Or try `kamctl rpc htable.dump a`, you need to use jsonrpcs module.

-- 
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/2311#issuecomment-622429994___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] [kamailio/kamailio] hash table size issue (#2311)

2020-05-01 Thread fborot
I have my hash table set to size = 16 
modparam("htable", "htable", "a=>size=16;autoexpire=0;dbtable=htable;")

I had around 3000 entries in that table, some entries with more than 10 
duplicate keys (key_type = 1) and we found that when  reading the entries of 
the duplicated keys it could not go pass index 9 even though in the physical 
table there were 17 entries.
I deleted some old entries and now the table is about 2000 items and it seems 
to work properly again ,(loads all value in memory). I say seems because I can 
not dump all values:
```
./kamcmd htable.dump a
ERROR: reply too big
```

But I check manually all the ones that were not being loaded and they are now
Questions:
1- the size parameter is for the buckets or entries size ?
2- is 16 a good value for a table with 3000 entries? ( 2^16 is 65k so I figured 
it would be ok)
3- can the the way I define my key impose a limitation?
4- what is the max size for an htable to be dumped with the above command?


-- 
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/2311___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:ae2f1fdc: usrloc: use ul prefix for global param variables

2020-05-01 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: ae2f1fdc40b1ce6ff9d5d06330841809f51df587
URL: 
https://github.com/kamailio/kamailio/commit/ae2f1fdc40b1ce6ff9d5d06330841809f51df587

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2020-05-01T14:47:55+02:00

usrloc: use ul prefix for global param variables

---

Modified: src/modules/usrloc/dlist.c
Modified: src/modules/usrloc/ucontact.c
Modified: src/modules/usrloc/udomain.c
Modified: src/modules/usrloc/ul_keepalive.c
Modified: src/modules/usrloc/ul_rpc.c
Modified: src/modules/usrloc/urecord.c
Modified: src/modules/usrloc/usrloc.c
Modified: src/modules/usrloc/usrloc_mod.c
Modified: src/modules/usrloc/usrloc_mod.h
Modified: src/modules/usrloc/utime.c
Modified: src/modules/usrloc/utime.h

---

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


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:33cb4517: permissions: use perm prefix for global param variables

2020-05-01 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 33cb45179bbd7477b81f297ae8de0a164aea8962
URL: 
https://github.com/kamailio/kamailio/commit/33cb45179bbd7477b81f297ae8de0a164aea8962

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2020-05-01T13:50:54+02:00

permissions: use perm prefix for global param variables

---

Modified: src/modules/permissions/address.c
Modified: src/modules/permissions/address.h
Modified: src/modules/permissions/hash.c
Modified: src/modules/permissions/permissions.c
Modified: src/modules/permissions/permissions.h
Modified: src/modules/permissions/rpc.c
Modified: src/modules/permissions/trusted.c
Modified: src/modules/permissions/trusted.h

---

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


___
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: change "-" for "_" in stats name to be prometheus compliant (#2304)

2020-05-01 Thread Federico Cabiddu
@grumvalski pushed 1 commit.

3203a6572b874d191c3be61519853005bd5ab056  core: new core parameter 
stats_name_separator


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/kamailio/kamailio/pull/2304/files/0595795c659f6af586e63837efe56b45808cd735..3203a6572b874d191c3be61519853005bd5ab056
___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:08671523: modules: readme files regenerated - permissions ... [skip ci]

2020-05-01 Thread Kamailio Dev
Module: kamailio
Branch: master
Commit: 08671523826310b44d7f9a8963dcf948e47f6536
URL: 
https://github.com/kamailio/kamailio/commit/08671523826310b44d7f9a8963dcf948e47f6536

Author: Kamailio Dev 
Committer: Kamailio Dev 
Date: 2020-05-01T09:16:16+02:00

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

---

Modified: src/modules/permissions/README

---

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

---

diff --git a/src/modules/permissions/README b/src/modules/permissions/README
index 31eb37e0d3..9837cfd1b2 100644
--- a/src/modules/permissions/README
+++ b/src/modules/permissions/README
@@ -550,7 +550,8 @@ modparam("permissions", "ip_addr_col", "ip_address")
 
Name of address table column containing the network mask of the
address. Possible values are 0-32 for IPv4 and 0-128 for IPv6
-   addresses.
+   addresses. If the value is 0, the network mask is set to 32 for IPv4
+   addresses and to 128 for IPv6 addresses.
 
Default value is “mask”.
 


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:b5816cae: textopsx: use safer macros for temporarily making zero-ending strings

2020-05-01 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: b5816caeacc4c597b5358c1dcd429581b3233667
URL: 
https://github.com/kamailio/kamailio/commit/b5816caeacc4c597b5358c1dcd429581b3233667

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2020-05-01T08:53:56+02:00

textopsx: use safer macros for temporarily making zero-ending strings

---

Modified: src/modules/textopsx/textopsx.c

---

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

---

diff --git a/src/modules/textopsx/textopsx.c b/src/modules/textopsx/textopsx.c
index 317abb6002..1452e1c3d1 100644
--- a/src/modules/textopsx/textopsx.c
+++ b/src/modules/textopsx/textopsx.c
@@ -352,11 +352,10 @@ static int keep_hf_helper(sip_msg_t *msg, regex_t *re)
return -1;
}
} else {
-   c = hf->name.s[hf->name.len];
-   hf->name.s[hf->name.len] = '\0';
+   STR_VTOZ(hf->name.s[hf->name.len], c);
if(regexec(re, hf->name.s, 1, &pmatch, 0) != 0) {
/* no match => remove */
-   hf->name.s[hf->name.len] = c;
+   STR_ZTOV(hf->name.s[hf->name.len], c);
l = del_lump(msg, hf->name.s - msg->buf, 
hf->len, 0);
if(l == 0) {
LM_ERR("cannot remove header [%.*s]\n", 
hf->name.len,
@@ -364,7 +363,7 @@ static int keep_hf_helper(sip_msg_t *msg, regex_t *re)
return -1;
}
} else {
-   hf->name.s[hf->name.len] = c;
+   STR_ZTOV(hf->name.s[hf->name.len], c);
}
}
}


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:8729a55f: permissions: docs - note about netmask value 0 in the database column

2020-05-01 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 8729a55f00b8ba6adbf97921ef09d56080145810
URL: 
https://github.com/kamailio/kamailio/commit/8729a55f00b8ba6adbf97921ef09d56080145810

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2020-05-01T09:00:21+02:00

permissions: docs - note about netmask value 0 in the database column

---

Modified: src/modules/permissions/doc/permissions_admin.xml

---

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

---

diff --git a/src/modules/permissions/doc/permissions_admin.xml 
b/src/modules/permissions/doc/permissions_admin.xml
index 4e003bcc1b..170f197f14 100644
--- a/src/modules/permissions/doc/permissions_admin.xml
+++ b/src/modules/permissions/doc/permissions_admin.xml
@@ -548,8 +548,9 @@ modparam("permissions", "ip_addr_col", "ip_address")
mask_col (string)

Name of address table column containing the network mask of
-   the address.  Possible values are 0-32 for IPv4 and 0-128 for
-   IPv6 addresses.
+   the address. Possible values are 0-32 for IPv4 and 0-128 for
+   IPv6 addresses. If the value is 0, the network mask is set to 32
+   for IPv4 addresses and to 128 for IPv6 addresses.





___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev