Module: kamailio
Branch: 5.3
Commit: c0b87c2cc13b1f46b8c5c902a0f5a82e913b85d9
URL: https://github.com/kamailio/kamailio/commit/c0b87c2cc13b1f46b8c5c902a0f5a82…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-05-06T12:01:19+02:00
core: hash_func.h - use file name specific include guard
(cherry picked from commit 9691f6e0cab48114ef4067a22cc8f9c1efb8944c)
---
Modified: src/core/hash_func.h
---
Diff: https://github.com/kamailio/kamailio/commit/c0b87c2cc13b1f46b8c5c902a0f5a82…
Patch: https://github.com/kamailio/kamailio/commit/c0b87c2cc13b1f46b8c5c902a0f5a82…
---
diff --git a/src/core/hash_func.h b/src/core/hash_func.h
index 203e10b1c8..aeb9794bf2 100644
--- a/src/core/hash_func.h
+++ b/src/core/hash_func.h
@@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*!
@@ -26,14 +26,14 @@
-#ifndef _HASH_H
-#define _HASH_H
+#ifndef _HASH_FUNC_H_
+#define _HASH_FUNC_H_
#include "str.h"
#include "hashes.h"
/* always use a power of 2 for hash table size */
-#define T_TABLE_POWER 16
+#define T_TABLE_POWER 16
#define TABLE_ENTRIES (1 << (T_TABLE_POWER))
unsigned int new_hash( str call_id, str cseq_nr );
Module: kamailio
Branch: 5.3
Commit: 8f5653e6cd84bc1dfa2498959b99f3fe2911b483
URL: https://github.com/kamailio/kamailio/commit/8f5653e6cd84bc1dfa2498959b99f3f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-05-06T11:57:37+02:00
kamctl: kamdbclt mysql skip creating dbrouser if same as dbrwuser
(cherry picked from commit 66ef7ab7b078794b96ecee13f6867d5f90a8d63e)
---
Modified: utils/kamctl/kamdbctl.mysql
---
Diff: https://github.com/kamailio/kamailio/commit/8f5653e6cd84bc1dfa2498959b99f3f…
Patch: https://github.com/kamailio/kamailio/commit/8f5653e6cd84bc1dfa2498959b99f3f…
---
diff --git a/utils/kamctl/kamdbctl.mysql b/utils/kamctl/kamdbctl.mysql
index e8f8d2e861..358742dad4 100644
--- a/utils/kamctl/kamdbctl.mysql
+++ b/utils/kamctl/kamdbctl.mysql
@@ -161,9 +161,12 @@ kamailio_db_grant () # pars: <database name>
# 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: <database name>
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: <database name>
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: <database name>
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: <database name>
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: <database name>
fi
if [ ! -z "$DBACCESSHOST" ] ; then
- sql_query "" "REVOKE ALL PRIVILEGES ON $1.* FROM '$DBRWUSER'@'$DBACCESSHOST';
- REVOKE SELECT ON $1.* FROM '$DBROUSER'@'$DBACCESSHOST';"
+ sql_query "" "REVOKE ALL PRIVILEGES ON $1.* FROM '$DBRWUSER'@'$DBACCESSHOST';"
+ if [ "${DBRWUSER}" != "${DBROUSER}" ] ; then
+ sql_query "" "REVOKE SELECT ON $1.* FROM '$DBROUSER'@'$DBACCESSHOST';"
+ fi
if [ $? -ne 0 ] ; then
merr "granting access host privileges to database $1 failed!"
exit 1
Module: kamailio
Branch: 5.3
Commit: 4790825cc98068b07c1e0402bdea93f839a1fd77
URL: https://github.com/kamailio/kamailio/commit/4790825cc98068b07c1e0402bdea93f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-05-06T11:57:22+02:00
htable: docs - more details about size attribute for htable
(cherry picked from commit 35f711e6ec74c6e67edf99adaa15cc353f2ce949)
---
Modified: src/modules/htable/doc/htable_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/4790825cc98068b07c1e0402bdea93f…
Patch: https://github.com/kamailio/kamailio/commit/4790825cc98068b07c1e0402bdea93f…
---
diff --git a/src/modules/htable/doc/htable_admin.xml b/src/modules/htable/doc/htable_admin.xml
index 17391626a1..f0b560cfd1 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
</listitem>
<listitem>
<para>
- <emphasis>size</emphasis> - 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
+ <emphasis>size</emphasis> - 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.
</para>
</listitem>
<listitem>