From 9e4b47f75a572bb7732c90aac4a6b4346737ad37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Sun, 18 Jun 2023 19:10:46 +0200 Subject: [PATCH 01/35] core: typos --- src/core/async_task.c | 6 +++--- src/core/forward.c | 2 +- src/core/mem/dl_malloc.c | 2 +- src/core/msg_translator.c | 2 +- src/core/parser/msg_parser.h | 2 +- src/core/parser/parse_via.c | 2 +- src/core/socket_info.c | 2 +- src/core/tcp_main.c | 2 +- src/main.c | 29 +++++++++++++---------------- 9 files changed, 23 insertions(+), 26 deletions(-) diff --git a/src/core/async_task.c b/src/core/async_task.c index 927cdd2c61c..376924ae571 100644 --- a/src/core/async_task.c +++ b/src/core/async_task.c @@ -143,7 +143,7 @@ int async_task_init(void) int nrg = 0; async_wgroup_t *awg; - LM_DBG("start initializing asynk task framework\n"); + LM_DBG("start initializing async task framework\n"); if(_async_wgroup_list == NULL || _async_wgroup_list->workers <= 0) return 0; @@ -184,7 +184,7 @@ int async_task_child_init(int rank) if(_async_wgroup_list == NULL || _async_wgroup_list->workers <= 0) return 0; - LM_DBG("child initializing asynk task framework\n"); + LM_DBG("child initializing async task framework\n"); if(rank == PROC_INIT) { if(async_task_init_sockets() < 0) { @@ -406,7 +406,7 @@ int async_task_push(async_task_t *task) len = write(_async_wgroup_list->sockets[1], &task, sizeof(async_task_t *)); if(len <= 0) { - LM_ERR("failed to pass the task to asynk workers\n"); + LM_ERR("failed to pass the task to async workers\n"); return -1; } LM_DBG("task sent [%p]\n", task); diff --git a/src/core/forward.c b/src/core/forward.c index df0338173dc..a5fd1fe656f 100644 --- a/src/core/forward.c +++ b/src/core/forward.c @@ -72,7 +72,7 @@ /* return a socket_info_pointer to the sending socket; as opposed to - * get_send_socket, which returns process's default socket, get_out_socket + * get_send_socket, which returns process' default socket, get_out_socket * attempts to determine the outbound interface which will be used; * it uses a temporary connected socket to determine it; it will * be very likely noticeably slower, but it can deal better with diff --git a/src/core/mem/dl_malloc.c b/src/core/mem/dl_malloc.c index d67a02f2019..d80661e4717 100644 --- a/src/core/mem/dl_malloc.c +++ b/src/core/mem/dl_malloc.c @@ -304,7 +304,7 @@ MORECORE default: sbrk MORECORE_CONTIGUOUS default: 1 (true) If true, take advantage of fact that consecutive calls to MORECORE with positive arguments always return contiguous increasing - addresses. This is true of unix sbrk. It does not hurt too much to + addresses. This is true for unix sbrk. It does not hurt too much to set it true anyway, since malloc copes with non-contiguities. Setting it false when definitely non-contiguous saves time and possibly wasted space it would take to discover this though. diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c index 44524379b85..fcc6f133439 100644 --- a/src/core/msg_translator.c +++ b/src/core/msg_translator.c @@ -2768,7 +2768,7 @@ int branch_builder(unsigned int hash_index, } -/* uses only the send_info->send_socket, send_info->proto and +/* uses only the send_info->send_socket, send_info->proto, send_info->id and * send_info->comp (so that a send_info used for sending can be passed * to this function w/o changes and the correct via will be built) */ char *via_builder(unsigned int *len, sip_msg_t *msg, diff --git a/src/core/parser/msg_parser.h b/src/core/parser/msg_parser.h index b9dc0260f9d..b33317da0cb 100644 --- a/src/core/parser/msg_parser.h +++ b/src/core/parser/msg_parser.h @@ -445,7 +445,7 @@ typedef struct sip_msg * runing failure handlers - see modules/tm/t_reply.c */ } sip_msg_t; -/*! \brief pointer to a fakes message which was never received ; +/*! \brief pointer to a faked message which was never received ; (when this message is "relayed", it is generated out of the original request) */ diff --git a/src/core/parser/parse_via.c b/src/core/parser/parse_via.c index 4c6b79241c9..9452ce51132 100644 --- a/src/core/parser/parse_via.c +++ b/src/core/parser/parse_via.c @@ -1090,7 +1090,7 @@ static /*inline*/ char *parse_via_param(char *const p, const char *const end, state = F_COMP_VALUE; break; /* '=' in any other COMP value state is an error, - * and it will be catched by the default branch */ + * and it will be caught by the default branch */ #endif case P_STRING: break; diff --git a/src/core/socket_info.c b/src/core/socket_info.c index b50e58580b4..56a4ba261eb 100644 --- a/src/core/socket_info.c +++ b/src/core/socket_info.c @@ -2065,7 +2065,7 @@ static int fix_socket_list(struct socket_info **list, int *type_flags) ail = ail_next; continue; } - /* 2. check if the extra addresses contain a duplicates for + /* 2. check if the extra addresses contain a duplicate for * other addresses in the same list */ for(tmp_ail = ail->next; tmp_ail;) { tmp_ail_next = tmp_ail->next; diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c index ac65387eafb..e96d68c40b2 100644 --- a/src/core/tcp_main.c +++ b/src/core/tcp_main.c @@ -4464,7 +4464,7 @@ inline static int handle_tcpconn_ev( if ((tcpconn->refcnt!=0)){ /* FIXME: might be valid for sigio_rt iff fd flags are not cleared * (there is a short window in which it could generate a sig - * that would be catched by tcp_main) */ + * that would be caught by tcp_main) */ LM_CRIT("handle_tcpconn_ev: io event on referenced" " tcpconn (%p), refcnt=%d, fd=%d\n", tcpconn, tcpconn->refcnt, tcpconn->s); diff --git a/src/main.c b/src/main.c index 07b89604f84..15f144cb535 100644 --- a/src/main.c +++ b/src/main.c @@ -360,7 +360,7 @@ int timerlog = L_WARN; good for trouble-shooting */ int sip_warning = 0; -/* should localy-generated messages include server's signature? +/* should locally-generated messages include server's signature? be default yes, good for trouble-shooting */ int server_signature=1; @@ -405,8 +405,8 @@ int disable_core_dump=0; /* by default enabled */ int open_files_limit=-1; /* don't touch it by default */ /* memory options */ -int shm_force_alloc=0; /* force immediate (on startup) page allocation - (by writting 0 in the pages), useful if +int shm_force_alloc = 0; /* force immediate (on startup) page allocation + (by writing 0 in the pages), useful if mlock_pages is also 1 */ int mlock_pages=0; /* default off, try to disable swapping */ @@ -1048,9 +1048,8 @@ static void free_name_lst(struct name_lst* lst) } - /* parse h and returns a name lst (flags are set to SI_IS_MHOMED if - * h contains more then one name or contains a name surrounded by '(' ')' ) + * h contains more than one name or contains a name surrounded by '(' ')' ) * valid formats: "hostname" * "(hostname, hostname1, hostname2)" * "(hostname hostname1 hostname2)" @@ -1131,7 +1130,7 @@ static struct name_lst* parse_name_lst(char* h, int h_len) * where proto= udp|tcp|tls|sctp * @param s - string (like above) * @param host - will be filled with the host part - * Note: for multi-homing it wil contain all the addresses + * Note: for multi-homing it will contain all the addresses * (e.g.: "sctp:(1.2.3.4, 5.6.7.8)" => host="(1.2.3.4, 5.6.7.8)") * @param hlen - will be filled with the length of the host part. * @param port - will be filled with the port if present or 0 if it's not. @@ -1200,7 +1199,7 @@ int parse_phostport(char* s, char** host, int* hlen, *host=first+1; *hlen=(int)(p-*host); }else{ - /* valid port => its host:port */ + /* valid port => it is host:port */ *proto=0; *host=s; *hlen=(int)(first-*host); @@ -1222,14 +1221,13 @@ int parse_phostport(char* s, char** host, int* hlen, } - /** get protocol host, port and MH addresses list from a string representation. * parses [proto:]host[:port] or * [proto:](host_1, host_2, ... host_n)[:port] * where proto= udp|tcp|tls|sctp * @param s - string (like above) * @param host - will be filled with the host part - * Note: for multi-homing it wil contain all the addresses + * Note: for multi-homing it will contain all the addresses * (e.g.: "sctp:(1.2.3.4, 5.6.7.8)" => host="(1.2.3.4, 5.6.7.8)") * @param hlen - will be filled with the length of the host part. * @param port - will be filled with the port if present or 0 if it's not. @@ -1247,7 +1245,6 @@ static struct name_lst* parse_phostport_mh(char* s, char** host, int* hlen, } - /** Update \c cfg_file variable to contain full pathname or '-' (for stdin) * allocated in system memory. The function updates * the value of \c cfg_file global variable to contain full absolute pathname @@ -1255,7 +1252,7 @@ static struct name_lst* parse_phostport_mh(char* s, char** host, int* hlen, * determine the default path to the configuration file if the user did not * specify one using the command line option. If \c cfg_file contains an * absolute pathname then it is cloned unmodified, if it contains a relative - * pathanme than the value returned by \c getcwd function will be added at the + * pathname then the value returned by \c getcwd function will be added at the * beginning. This function must be run before changing its current working * directory to / (in daemon mode). * @return Zero on success, negative number @@ -2060,10 +2057,10 @@ int main(int argc, char** argv) /* command line options */ options= ":f:cm:M:dVIhEeb:l:L:n:vKrRDTN:W:w:t:u:g:P:G:SQ:O:a:A:x:X:Y:"; /* Handle special command line arguments, that must be treated before - * intializing the various subsystem or before parsing other arguments: + * initializing the various subsystem or before parsing other arguments: * - get the startup debug and log_stderr values - * - look if pkg mem size is overriden on the command line (-M) and get - * the new value here (before intializing pkg_mem). + * - look if pkg mem size is overridden on the command line (-M) and get + * the new value here (before initializing pkg_mem). * - look if there is a -h, e.g. -f -h construction won't be caught * later */ @@ -2870,7 +2867,7 @@ int main(int argc, char** argv) ksr_sockets_index(); if (default_core_cfg.dns_try_ipv6 && !(socket_types & SOCKET_T_IPV6)){ /* if we are not listening on any ipv6 address => no point - * to try to resovle ipv6 addresses */ + * to try to resolve ipv6 addresses */ default_core_cfg.dns_try_ipv6=0; } /* print all the listen addresses */ @@ -3111,7 +3108,7 @@ int main(int argc, char** argv) #ifdef KSR_PTHREAD_MUTEX_SHARED /** - * code to set PTHREAD_PROCESS_SHARED attribute for phtread mutex to cope + * code to set PTHREAD_PROCESS_SHARED attribute for pthread mutex to cope * with libssl 1.1+ thread-only mutex initialization */ From d61cd534f8ec10a232b8f446f277386b1abc2d66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Sun, 18 Jun 2023 19:14:26 +0200 Subject: [PATCH 02/35] src/Makefile*: typos --- src/Makefile | 2 +- src/Makefile.defs | 14 +++++++------- src/Makefile.groups | 2 +- src/Makefile.targets | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Makefile b/src/Makefile index 6c2b35b4154..28106b06852 100644 --- a/src/Makefile +++ b/src/Makefile @@ -32,7 +32,7 @@ include Makefile.targets err_fail?=1 # whether or not to install $(MAIN_NAME).cfg or just $(MAIN_NAME).cfg.default -# ($(MAIN_NAME).cfg will never be overwritten by make install, this is usefull +# ($(MAIN_NAME).cfg will never be overwritten by make install, this is useful # when creating packages) skip_cfg_install?= diff --git a/src/Makefile.defs b/src/Makefile.defs index d720e708b86..2b8d711fcfc 100644 --- a/src/Makefile.defs +++ b/src/Makefile.defs @@ -589,13 +589,13 @@ data_target = $(prefix)/$(data_dir) # uses a faster malloc # -DDBG_QM_MALLOC # qm_malloc debug code, will cause pkg_malloc and shm_malloc -# to keep and display lot of debuging information: file name, +# to keep and display lot of debugging information: file name, # function, line number of malloc/free call for each block, # extra error checking (trying to free the same pointer # twice, trying to free a pointer alloc'ed with a different # malloc etc.) # -DVQ_MALLOC -# additional option to PKG_MALLOC which utilizes a fater then +# additional option to PKG_MALLOC which utilizes a faster than # qm version # (not true anymore, q_malloc performs approx. the same) # -DQ_MALLOC @@ -619,7 +619,7 @@ data_target = $(prefix)/$(data_dir) # -DMEM_JOIN_FREE # enable the join of free memory chunks (see also mem_join cfg param) # -DFAST_LOCK -# uses fast arhitecture specific locking (see the arh. specific section) +# uses fast architecture specific locking (see the arch. specific section) # -DUSE_SYSV_SEM # uses sys v sems for locking (slower & limited number) # -DUSE_PTHREAD_MUTEX @@ -1004,9 +1004,9 @@ ifeq ($(CC_NAME), icc) CFLAGS+=-O3 -ipo -ipo_obj -unroll $(PROFILE) \ -tpp6 -xK #-openmp #optimize for PIII # -prefetch doesn't seem to work - #( ty to inline acroos files, unroll loops,prefetch, + #( try to inline across files, unroll loops, prefetch, # optimize for PIII, use PIII instructions & vect., - # mutlithread loops) + # multithread loops) else #other compilers $(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc) @@ -1087,9 +1087,9 @@ ifeq ($(CC_NAME), icc) CFLAGS+=-O3 -ipo -ipo_obj -unroll $(PROFILE) \ -tpp6 -xK #-openmp #optimize for PIII # -prefetch doesn't seem to work - #( ty to inline acroos files, unroll loops,prefetch, + #( try to inline across files, unroll loops, prefetch, # optimize for PIII, use PIII instructions & vect., - # mutlithread loops) + # multithread loops) else #other compilers $(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc) diff --git a/src/Makefile.groups b/src/Makefile.groups index e70dedb4fea..eadecda8fd6 100644 --- a/src/Makefile.groups +++ b/src/Makefile.groups @@ -214,7 +214,7 @@ mod_list_erlang=erlang # - modules depending on systemd library mod_list_systemd=log_systemd systemdops -# - modules depending on libnsq (+libev libevbuffsock liblcurl libjson-c) library +# - modules depending on libnsq (+libev libevbuffsock libcurl libjson-c) library mod_list_nsq=nsq # - modules depending on librabbitmq library diff --git a/src/Makefile.targets b/src/Makefile.targets index 9f9bf667c12..054aa9b9124 100644 --- a/src/Makefile.targets +++ b/src/Makefile.targets @@ -16,7 +16,7 @@ clean_targets:= clean proper distclean-old realclean maintainer-clean local-clea clean-modules proper-modules realclean-modules \ distclean-modules maintainer-clean-modules \ clean-utils proper-utils realclean-utils distclean-utils \ - maintaner-clean-utils \ + maintainer-clean-utils \ clean-libs proper-libs realclean-libs distclean-libs \ maintainer-clean-libs \ clean-tmp clean_doxygen clean-extra-names \ @@ -26,7 +26,7 @@ doc_targets:= README man install-doc install-man install-ser-man \ $(foreach m,$(modules_dirs),$(m)-doc $(m)-readme $(m)-man) \ $(foreach m,$(modules_dirs),install-$(m)-doc install-$(m)-man) -# auxiliary: maintance, debugging, etc. (don't affect code/objects) +# auxiliary: maintenance, debugging, etc. (don't affect code/objects) aux_targets:= TAGS tar dist cfg-defs cfg config config.mak print-modules \ dbg dbinstall librpath.lst makecfg.lst modules.lst modules-cfg \ modules-list modules-lst mk-install_dirs autover.h deb @@ -36,6 +36,6 @@ ext_targets:= every-module modules-all $(modules_dirs) libs utils \ $(foreach m,$(modules_dirs),install-$(m)) \ install-share -# all the targets that don't require code dependecies in the current dir. +# all the targets that don't require code dependencies in the current dir. nodep_targets:= $(clean_targets) $(doc_targets) $(aux_targets) $(ext_targets) From 854e69f9db966f11d92c630a4000fc214726ef9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Sun, 18 Jun 2023 19:18:04 +0200 Subject: [PATCH 03/35] lwsc: typos --- src/modules/lwsc/api.h | 2 +- src/modules/lwsc/lwsc_mod.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/lwsc/api.h b/src/modules/lwsc/api.h index 55dfac8e777..2e1cef99598 100644 --- a/src/modules/lwsc/api.h +++ b/src/modules/lwsc/api.h @@ -39,7 +39,7 @@ typedef int (*lwsc_api_request_f)( typedef struct lwsc_api { int loaded; - lwsc_api_request_f request; /* send and receice data */ + lwsc_api_request_f request; /* send and receive data */ } lwsc_api_t; typedef int (*bind_lwsc_f)(lwsc_api_t *api); diff --git a/src/modules/lwsc/lwsc_mod.c b/src/modules/lwsc/lwsc_mod.c index 508c60cd293..358f53e7246 100644 --- a/src/modules/lwsc/lwsc_mod.c +++ b/src/modules/lwsc/lwsc_mod.c @@ -545,7 +545,7 @@ static lwsc_endpoint_t *lwsc_get_endpoint(str *wsurl, str *wsproto) ep->wsctx = lws_create_context(&ep->crtinfo); if(!ep->wsctx) { - LM_ERR("failed to intialize context for ws url [%.*s]\n", wsurl->len, + LM_ERR("failed to initialize context for ws url [%.*s]\n", wsurl->len, wsurl->s); goto error; } From b682bedc8f33ac58297cfead05489e2c4c5204d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Sun, 18 Jun 2023 19:19:56 +0200 Subject: [PATCH 04/35] mangler: typos --- src/modules/mangler/contact_ops.c | 2 +- src/modules/mangler/mangler.c | 4 +-- src/modules/mangler/mangler.cfg | 4 +-- src/modules/mangler/sdp_mangler.c | 46 +++++++++++++++---------------- src/modules/mangler/sdp_mangler.h | 6 ++-- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/modules/mangler/contact_ops.c b/src/modules/mangler/contact_ops.c index 2785122aa81..a6c184f063f 100644 --- a/src/modules/mangler/contact_ops.c +++ b/src/modules/mangler/contact_ops.c @@ -316,7 +316,7 @@ int encode2format(struct sip_msg *msg, str *uri, struct uri_format *format) format->first = start - string + scheme_len + 1 /* ':' */; format->second = end - string; /* --------------------------testing ------------------------------- */ - /* sip:gva@pass@10.0.0.1;;transport=udp>;expires=2 INCORECT BEHAVIOR OF parse_uri,myfunction works good */ + /* sip:gva@pass@10.0.0.1;;transport=udp>;expires=2 INCORRECT BEHAVIOR OF parse_uri,myfunction works good */ foo = parse_uri(start, end - start, &sipUri); if(foo != 0) { LOG(L_ERR, diff --git a/src/modules/mangler/mangler.c b/src/modules/mangler/mangler.c index 702f7ec04fd..0ce7689997c 100644 --- a/src/modules/mangler/mangler.c +++ b/src/modules/mangler/mangler.c @@ -156,7 +156,7 @@ int prepare() { /* using pre-compiled expressions to speed things up*/ - compile_expresions(PORT_REGEX, IP_REGEX); + compile_expressions(PORT_REGEX, IP_REGEX); #ifdef DEMO load_tm_f load_tm; @@ -195,7 +195,7 @@ static int mod_init(void) static void destroy(void) { /*free some compiled regex expressions */ - free_compiled_expresions(); + free_compiled_expressions(); #ifdef DEMO fprintf(stdout, "Freeing pre-compiled expressions\n"); #endif diff --git a/src/modules/mangler/mangler.cfg b/src/modules/mangler/mangler.cfg index 1bc9a5a6b78..affd6d6d852 100644 --- a/src/modules/mangler/mangler.cfg +++ b/src/modules/mangler/mangler.cfg @@ -42,7 +42,7 @@ loadmodule "modules/mangler/mangler.so" #loadmodule "/usr/lib/ser/modules/auth.so" # ----------------- setting module-specific parameters --------------- -# seting separator for encoded contact +# setting separator for encoded contact modparam("mangler","contact_flds_separator","*") @@ -78,7 +78,7 @@ route{ * message */ if (method == "INVITE"){ sdp_mangle_ip("0.0.0.0/0","PUBLIC_IP"); - /* diferent mangling based on what phone we use */ + /* different mangling based on what phone we use */ if (src_ip==10.0.0.1) sdp_mangle_port("+1000"); if (src_ip==10.0.0.2) sdp_mangle_port("-1000"); }; diff --git a/src/modules/mangler/sdp_mangler.c b/src/modules/mangler/sdp_mangler.c index d9cf984db0e..541feb22675 100644 --- a/src/modules/mangler/sdp_mangler.c +++ b/src/modules/mangler/sdp_mangler.c @@ -46,7 +46,7 @@ regex_t *ipExpression = NULL; int sdp_mangle_port(struct sip_msg *msg, char *offset, char *unused) { int oldContentLength, newContentLength, oldlen, err, oldPort, newPort, diff, - offsetValue, len, off, ret, needToDealocate; + offsetValue, len, off, ret, needToDeallocate; struct lump *l; regmatch_t pmatch; regex_t *re; @@ -101,7 +101,7 @@ int sdp_mangle_port(struct sip_msg *msg, char *offset, char *unused) ret = -1; /* try to use pre-compiled expressions */ - needToDealocate = 0; + needToDeallocate = 0; if(portExpression != NULL) { re = portExpression; #ifdef EXTRA_DEBUG @@ -114,7 +114,7 @@ int sdp_mangle_port(struct sip_msg *msg, char *offset, char *unused) LOG(L_ERR, "ERROR: sdp_mangle_port: Unable to allocate re\n"); return -4; } - needToDealocate = 1; + needToDeallocate = 1; if((regcomp(re, key, REG_EXTENDED)) != 0) { LOG(L_ERR, "ERROR: sdp_mangle_port: Unable to compile %s \n", key); pkg_free(re); @@ -131,7 +131,7 @@ int sdp_mangle_port(struct sip_msg *msg, char *offset, char *unused) off = begin - msg->buf; if(pmatch.rm_so == -1) { LOG(L_ERR, "ERROR: sdp_mangle_port: offset unknown\n"); - if(needToDealocate) { + if(needToDeallocate) { regfree(re); pkg_free(re); } @@ -170,7 +170,7 @@ int sdp_mangle_port(struct sip_msg *msg, char *offset, char *unused) "ERROR: sdp_mangle_port: Error converting [%.*s] to int\n", oldlen, pos); #ifdef STRICT_CHECK - if(needToDealocate) { + if(needToDeallocate) { regfree(re); pkg_free(re); } @@ -194,7 +194,7 @@ int sdp_mangle_port(struct sip_msg *msg, char *offset, char *unused) "matching old port %d\n", oldPort); #ifdef STRICT_CHECK - if(needToDealocate) { + if(needToDeallocate) { regfree(re); pkg_free(re); } @@ -223,7 +223,7 @@ int sdp_mangle_port(struct sip_msg *msg, char *offset, char *unused) "matching new port %d\n", newPort); #ifdef STRICT_CHECK - if(needToDealocate) { + if(needToDeallocate) { regfree(re); pkg_free(re); } @@ -262,7 +262,7 @@ int sdp_mangle_port(struct sip_msg *msg, char *offset, char *unused) 0)) == 0) { LOG(L_ERR, "ERROR: sdp_mangle_port: del_lump failed\n"); - if(needToDealocate) { + if(needToDeallocate) { regfree(re); pkg_free(re); } @@ -271,7 +271,7 @@ int sdp_mangle_port(struct sip_msg *msg, char *offset, char *unused) s = pkg_malloc(len); if(s == 0) { LOG(L_ERR, "ERROR: sdp_mangle_port : memory allocation failure\n"); - if(needToDealocate) { + if(needToDeallocate) { regfree(re); pkg_free(re); } @@ -283,7 +283,7 @@ int sdp_mangle_port(struct sip_msg *msg, char *offset, char *unused) if(insert_new_lump_after(l, s, len, 0) == 0) { LOG(L_ERR, "ERROR: sdp_mangle_port: could not insert new lump\n"); pkg_free(s); - if(needToDealocate) { + if(needToDeallocate) { regfree(re); pkg_free(re); } @@ -298,7 +298,7 @@ int sdp_mangle_port(struct sip_msg *msg, char *offset, char *unused) begin = begin + pmatch.rm_eo; } /* while */ - if(needToDealocate) { + if(needToDeallocate) { regfree(re); pkg_free(re); #ifdef EXTRA_DEBUG @@ -322,7 +322,7 @@ int sdp_mangle_port(struct sip_msg *msg, char *offset, char *unused) int sdp_mangle_ip(struct sip_msg *msg, char *oldip, char *newip) { int i, oldContentLength, newContentLength, diff, oldlen, len, off, ret, - needToDealocate; + needToDeallocate; unsigned int mask, address, locatedIp; struct lump *l; regmatch_t pmatch; @@ -395,7 +395,7 @@ int sdp_mangle_ip(struct sip_msg *msg, char *oldip, char *newip) len = strlen(newip); /* try to use pre-compiled expressions */ - needToDealocate = 0; + needToDeallocate = 0; if(ipExpression != NULL) { re = ipExpression; #ifdef EXTRA_DEBUG @@ -409,7 +409,7 @@ int sdp_mangle_ip(struct sip_msg *msg, char *oldip, char *newip) LOG(L_ERR, "ERROR: sdp_mangle_ip: Unable to allocate re\n"); return -7; } - needToDealocate = 1; + needToDeallocate = 1; if((regcomp(re, key, REG_EXTENDED)) != 0) { LOG(L_ERR, "ERROR: sdp_mangle_ip: Unable to compile %s \n", key); pkg_free(re); @@ -517,7 +517,7 @@ int sdp_mangle_ip(struct sip_msg *msg, char *oldip, char *newip) begin = begin + pmatch.rm_eo; } /* while */ - if(needToDealocate) { + if(needToDeallocate) { regfree(re); /* if I am going to use pre-compiled expressions to be removed */ pkg_free(re); #ifdef EXTRA_DEBUG @@ -537,22 +537,22 @@ int sdp_mangle_ip(struct sip_msg *msg, char *oldip, char *newip) return ret + 2; } -int compile_expresions(char *port, char *ip) +int compile_expressions(char *port, char *ip) { portExpression = NULL; portExpression = pkg_malloc(sizeof(regex_t)); if(portExpression != NULL) { if((regcomp(portExpression, port, REG_EXTENDED)) != 0) { LOG(L_ERR, - "ERROR: compile_expresions: Unable to compile " + "ERROR: compile_expressions: Unable to compile " "portExpression [%s]\n", port); pkg_free(portExpression); portExpression = NULL; } } else { - LOG(L_ERR, - "ERROR: compile_expresions: Unable to alloc portExpression \n"); + LOG(L_ERR, "ERROR: compile_expressions: Unable to alloc portExpression " + "\n"); } ipExpression = NULL; @@ -560,21 +560,21 @@ int compile_expresions(char *port, char *ip) if(ipExpression != NULL) { if((regcomp(ipExpression, ip, REG_EXTENDED)) != 0) { LOG(L_ERR, - "ERROR: compile_expresions: Unable to compile ipExpression " - "[%s]\n", + "ERROR: compile_expressions: Unable to compile " + "ipExpression [%s]\n", ip); pkg_free(ipExpression); ipExpression = NULL; } } else { LOG(L_ERR, - "ERROR: compile_expresions: Unable to alloc ipExpression \n"); + "ERROR: compile_expressions: Unable to alloc ipExpression \n"); } return 0; } -int free_compiled_expresions() +int free_compiled_expressions() { if(portExpression != NULL) { regfree(portExpression); diff --git a/src/modules/mangler/sdp_mangler.h b/src/modules/mangler/sdp_mangler.h index 708385bafe5..4ac42819fe8 100644 --- a/src/modules/mangler/sdp_mangler.h +++ b/src/modules/mangler/sdp_mangler.h @@ -20,7 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -/* TO DO: precompiled expresions */ +/* TO DO: precompiled expressions */ #ifndef SDP_MANGLER_H #define SDP_MANGLER_H @@ -83,7 +83,7 @@ int sdp_mangle_port(struct sip_msg *msg, char *offset, char *unused); int sdp_mangle_ip(struct sip_msg *msg, char *oldip, char *newip); -int compile_expresions(char *port, char *ip); -int free_compiled_expresions(); +int compile_expressions(char *port, char *ip); +int free_compiled_expressions(); #endif From 7c97869cb944d6996a8bcf31bd50789b2e5afff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Sun, 18 Jun 2023 19:20:26 +0200 Subject: [PATCH 05/35] matrix: typo --- src/modules/matrix/doc/matrix_admin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/matrix/doc/matrix_admin.xml b/src/modules/matrix/doc/matrix_admin.xml index 3ee5dfe2c94..e03c80187fe 100644 --- a/src/modules/matrix/doc/matrix_admin.xml +++ b/src/modules/matrix/doc/matrix_admin.xml @@ -36,7 +36,7 @@
&kamailio; Modules - The module depends on the following modules (in the other words + The module depends on the following modules (in other words the listed modules must be loaded before this module): From 61b69b2d1b74234e5e78c0c50df6f65fe9273472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Sun, 18 Jun 2023 19:20:48 +0200 Subject: [PATCH 06/35] maxfwd: typo --- src/modules/maxfwd/doc/maxfwd_admin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/maxfwd/doc/maxfwd_admin.xml b/src/modules/maxfwd/doc/maxfwd_admin.xml index a00a5b3e182..009fdc81e2f 100644 --- a/src/modules/maxfwd/doc/maxfwd_admin.xml +++ b/src/modules/maxfwd/doc/maxfwd_admin.xml @@ -186,7 +186,7 @@ if (!maxfwd_process("10") && $retcode==-1) { of the new inserted header (if locally added). The parameter can be a variable. - Retuning codes: + Return codes: 1 (true) - header was found or set and From 55c5535c5fee881b16b95a2152d08aeca88f4b3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Sun, 18 Jun 2023 19:21:28 +0200 Subject: [PATCH 07/35] mediaproxy: typos --- src/modules/mediaproxy/mediaproxy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/mediaproxy/mediaproxy.c b/src/modules/mediaproxy/mediaproxy.c index 99bfa60f2ab..20ac1ca0086 100644 --- a/src/modules/mediaproxy/mediaproxy.c +++ b/src/modules/mediaproxy/mediaproxy.c @@ -123,7 +123,7 @@ typedef struct MediaproxySocket { char *name; // name int sock; // socket - int timeout; // how many miliseconds to wait for an answer + int timeout; // how many milliseconds to wait for an answer time_t last_failure; // time of the last failure char data[BUFFER_SIZE]; // buffer for the answer data } MediaproxySocket; @@ -199,7 +199,7 @@ static str ice_candidate = str_init("none"); static MediaproxySocket mediaproxy_socket = { "/run/mediaproxy/dispatcher.sock", // name -1, // sock - 500, // timeout in 500 miliseconds if there is no answer + 500, // timeout in 500 milliseconds if there is no answer 0, // time of the last failure "" // data }; @@ -754,7 +754,7 @@ static int find_content_type_application_sdp(struct sip_msg *msg, str *sdp) } -// Get the SDP message from SIP message and check it's Content-Type +// Get the SDP message from SIP message and check its Content-Type // Return values: // 1 - success // -1 - error in getting body or invalid content type From 854ccb898a586837c262a5d64515cf7a6820bccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Sun, 18 Jun 2023 19:22:11 +0200 Subject: [PATCH 08/35] memcached: typos --- src/modules/memcached/doc/memcached_admin.xml | 2 +- src/modules/memcached/mcd_var.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/memcached/doc/memcached_admin.xml b/src/modules/memcached/doc/memcached_admin.xml index bc6deedcfe5..cf00fdf0358 100644 --- a/src/modules/memcached/doc/memcached_admin.xml +++ b/src/modules/memcached/doc/memcached_admin.xml @@ -150,7 +150,7 @@ xlog("stored value is $mct(test)"); # will return <null> <varname>servers</varname> (str) The servers to connect to. At the moment only one server is supported. - diff --git a/src/modules/memcached/mcd_var.c b/src/modules/memcached/mcd_var.c index 04b2f9261aa..387113e6b8a 100644 --- a/src/modules/memcached/mcd_var.c +++ b/src/modules/memcached/mcd_var.c @@ -93,7 +93,7 @@ static inline int pv_mcd_key_expiry_split_str( } /*! - * \brief Checks if the key is avaiable and not too long, hashing it with MD5 if necessary. + * \brief Checks if the key is available and not too long, hashing it with MD5 if necessary. * \param msg SIP message * \param param pseudo-variable input parameter * \param key output string name From 91dd1ea66e735478d44906ee01a4d1d8898762d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Sun, 18 Jun 2023 19:22:55 +0200 Subject: [PATCH 09/35] misc_radius: typos --- src/modules/misc_radius/doc/misc_radius_admin.xml | 2 +- src/modules/misc_radius/functions.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/misc_radius/doc/misc_radius_admin.xml b/src/modules/misc_radius/doc/misc_radius_admin.xml index 831a4b6cb08..62094707a7e 100644 --- a/src/modules/misc_radius/doc/misc_radius_admin.xml +++ b/src/modules/misc_radius/doc/misc_radius_admin.xml @@ -77,7 +77,7 @@
&kamailio; Modules - The module depends on the following modules (in the other words + The module depends on the following modules (in other words the listed modules must be loaded before this module): diff --git a/src/modules/misc_radius/functions.c b/src/modules/misc_radius/functions.c index 8d338975c15..bf6b8681996 100644 --- a/src/modules/misc_radius/functions.c +++ b/src/modules/misc_radius/functions.c @@ -406,7 +406,7 @@ int radius_load_callee_avps(struct sip_msg *_m, char *_callee, char *_s2) /* * Check from Radius if a user belongs to a group. User-Name is given in - * first string argment that may contain pseudo variables. SIP-Group is + * first string argument that may contain pseudo variables. SIP-Group is * given in second string variable that may not contain pseudo variables. * Service-Type is Group-Check. */ From 211ede8351683644d1829feb355ca4a2a6227bcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Sun, 18 Jun 2023 19:23:33 +0200 Subject: [PATCH 10/35] misctest: typos --- src/modules/misctest/misctest_mod.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/misctest/misctest_mod.c b/src/modules/misctest/misctest_mod.c index f3d3279d22d..f7d09e77e56 100644 --- a/src/modules/misctest/misctest_mod.c +++ b/src/modules/misctest/misctest_mod.c @@ -681,7 +681,7 @@ static int mem_rnd_realloc(unsigned long size, long *diff) /* * Randomly alloc. total_size bytes, in chunks of size between - * min & max. max - min should be smaller then 4G. + * min & max. max - min should be smaller than 4G. * @return < 0 if there were some alloc errors, 0 on success. */ static int mem_rnd_leak( @@ -1020,7 +1020,7 @@ static const char *rpc_mt_free_doc[2] = { " other misctest functions (e.g. mt.mem_alloc or the script " "mt_mem_alloc). Use b|k|m|g to specify the desired size unit." "Returns the number of bytes freed (can be higher or" - " smaller then the requested size)", + " smaller than the requested size)", 0}; From c632c5fd6afb37704dde2de96c5a5a8d8e4cc44e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Sun, 18 Jun 2023 19:24:16 +0200 Subject: [PATCH 11/35] mqtt: typo --- src/modules/mqtt/mqtt_dispatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/mqtt/mqtt_dispatch.c b/src/modules/mqtt/mqtt_dispatch.c index 5d35d414291..a26ebc40799 100644 --- a/src/modules/mqtt/mqtt_dispatch.c +++ b/src/modules/mqtt/mqtt_dispatch.c @@ -509,7 +509,7 @@ int pv_get_mqtt(sip_msg_t *msg, pv_param_t *param, pv_value_t *res) qos = message->qos; } - // populate value depeding on the param name + // populate value depending on the param name // see pv_parse_mqtt_name() switch(param->pvn.u.isname.name.n) { case 0: From 3157cc16d409de71d692ec43441181327e1ebc9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Sun, 18 Jun 2023 19:25:26 +0200 Subject: [PATCH 12/35] msilo: typos --- src/modules/msilo/doc/msilo_admin.xml | 4 ++-- src/modules/msilo/msilo.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/msilo/doc/msilo_admin.xml b/src/modules/msilo/doc/msilo_admin.xml index e89edc315c5..abd3e45bbff 100644 --- a/src/modules/msilo/doc/msilo_admin.xml +++ b/src/modules/msilo/doc/msilo_admin.xml @@ -560,8 +560,8 @@ modparam("msilo", "use_contact", 0)
<varname>snd_time_avp</varname> (str) - The name of an AVP which may contain the time when to sent - the received message as reminder. The AVP is used ony by m_store(). + The name of an AVP which may contain the time when to send + the received message as reminder. The AVP is used only by m_store(). If the parameter is not set, the module does not look for this AVP. If diff --git a/src/modules/msilo/msilo.c b/src/modules/msilo/msilo.c index 897d097094f..75848925f88 100644 --- a/src/modules/msilo/msilo.c +++ b/src/modules/msilo/msilo.c @@ -99,7 +99,7 @@ MODULE_VERSION static db1_con_t *db_con = NULL; static db_func_t msilo_dbf; -/** precessed msg list - used for dumping the messages */ +/** processed msg list - used for dumping the messages */ msg_list ml = NULL; /** TM bind */ @@ -586,7 +586,7 @@ static int m_store(sip_msg_t *msg, str *owner_s) } else { duri = msg->new_uri; } - LM_DBG("NEW R-URI found - check if is AoR!\n"); + LM_DBG("NEW R-URI found - check if it is AoR!\n"); if(parse_uri(duri.s, duri.len, &puri) != 0) { LM_ERR("bad dst R-URI!!\n"); goto error; From c3919b68e947b6572eef8cd01486af4f28fed963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Sun, 18 Jun 2023 19:25:44 +0200 Subject: [PATCH 13/35] nat_traversal: typo --- src/modules/nat_traversal/nat_traversal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/nat_traversal/nat_traversal.c b/src/modules/nat_traversal/nat_traversal.c index a8c55e5c2df..3dc6f4febd8 100644 --- a/src/modules/nat_traversal/nat_traversal.c +++ b/src/modules/nat_traversal/nat_traversal.c @@ -1168,7 +1168,7 @@ static void __dialog_destroy( lock_get(¶m->lock); - // remove all keepalives on unanswered branches. this is neded because + // remove all keepalives on unanswered branches. This is needed because // we may transit from early to ended without going through confirmed for(i = 0; i < param->callee_candidates.count; i++) { h = HASH(nat_table, param->callee_candidates.uri[i]); From 5f3c2fe040c8a9e19b3ea98dc343fa324c193be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Sun, 18 Jun 2023 19:26:14 +0200 Subject: [PATCH 14/35] ndb_cassandra: typos --- src/modules/ndb_cassandra/doc/ndb_cassandra_admin.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/ndb_cassandra/doc/ndb_cassandra_admin.xml b/src/modules/ndb_cassandra/doc/ndb_cassandra_admin.xml index 94bcfdc3d26..4d995fda473 100644 --- a/src/modules/ndb_cassandra/doc/ndb_cassandra_admin.xml +++ b/src/modules/ndb_cassandra/doc/ndb_cassandra_admin.xml @@ -148,7 +148,7 @@ modparam("ndb_cassandra", "port", 9160) $var(column) = "name"; $var(val_write) = "TestMyName"; # To be written if (cass_insert("$var(keyspace)", "$var(column_family)", "$ru", "$var(column)", "$var(val_write)") > 0) { - xlog("L_DBG", "ndb_cassandra. Sucess while inserting to Cassandra. val_write: \"$var(val_write)\""); + xlog("L_DBG", "ndb_cassandra. Success while inserting to Cassandra. val_write: \"$var(val_write)\""); } else { xlog("L_DBG", "ndb_cassandra. Error while inserting to Cassandra"); } @@ -160,7 +160,7 @@ modparam("ndb_cassandra", "port", 9160) $var(column) = "name"; $var(val_read) = ""; # To be read if (cass_retrieve("$var(keyspace)", "$var(column_family)", "$var(key)", "$var(column)", "$var(val_read)") > 0) { - xlog("L_DBG", "ndb_cassandra. Sucess while reading from Cassandra. val_read: \"$var(val_read)\""); + xlog("L_DBG", "ndb_cassandra. Success while reading from Cassandra. val_read: \"$var(val_read)\""); } else { xlog("L_DBG", "ndb_cassandra. Error while reading from Cassandra"); } From c7471291950d24dceaf8b5db131afd37cde91c1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Sun, 18 Jun 2023 19:26:55 +0200 Subject: [PATCH 15/35] ndb_mongodb: typo --- src/modules/ndb_mongodb/doc/ndb_mongodb_admin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/ndb_mongodb/doc/ndb_mongodb_admin.xml b/src/modules/ndb_mongodb/doc/ndb_mongodb_admin.xml index 733d3601719..cb76de53da9 100644 --- a/src/modules/ndb_mongodb/doc/ndb_mongodb_admin.xml +++ b/src/modules/ndb_mongodb/doc/ndb_mongodb_admin.xml @@ -137,7 +137,7 @@ modparam("ndb_mongodb", "server", "name=mgs2;uri='mongodb://127.0.0.2/kamailio'" - cname - MongodDB collection (table) name. + cname - MongoDB collection (table) name. From 5888a402285b5edb2c8691a263530287968c9658 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Sun, 18 Jun 2023 19:08:52 +0200 Subject: [PATCH 16/35] usrloc: typo --- src/modules/usrloc/udomain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/usrloc/udomain.c b/src/modules/usrloc/udomain.c index 0c1296bf13e..578ae208aa4 100644 --- a/src/modules/usrloc/udomain.c +++ b/src/modules/usrloc/udomain.c @@ -221,7 +221,7 @@ void print_udomain(FILE *_f, udomain_t *_d) * \brief Convert database values into ucontact_info * * Convert database values into ucontact_info, - * expects 12 rows (contact, expirs, q, callid, cseq, flags, + * expects 12 rows (contact, expires, q, callid, cseq, flags, * ua, received, path, socket, methods, last_modified) * \param vals database values * \param contact contact From e66c2c96908cb8c2169ace2c31c2a6cfae7201d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Sun, 18 Jun 2023 19:06:42 +0200 Subject: [PATCH 17/35] test/misc/code: typos --- test/misc/code/shoot.c | 4 ++-- test/misc/code/shoot2.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/misc/code/shoot.c b/test/misc/code/shoot.c index 9ad32226c6d..3d83c8a5646 100644 --- a/test/misc/code/shoot.c +++ b/test/misc/code/shoot.c @@ -300,10 +300,10 @@ int main(int argc, char *argv[]) shoot(buff, address, lport, rport ); /* visual studio closes the debug console as soon as the - program terminates. this is to hold the window from collapsing + program terminates. This is to hold the window from collapsing Uncomment it if needed. getchar();*/ - + return 0; } diff --git a/test/misc/code/shoot2.c b/test/misc/code/shoot2.c index 884454c878b..fb46daa641f 100644 --- a/test/misc/code/shoot2.c +++ b/test/misc/code/shoot2.c @@ -387,10 +387,10 @@ int main(int argc, char *argv[]) shoot(buff, address, lport, rport ); /* visual studio closes the debug console as soon as the - program terminates. this is to hold the window from collapsing + program terminates. This is to hold the window from collapsing Uncomment it if needed. getchar();*/ - + return 0; } From 437b435c86c109bdda213998c6448ed255790018 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B8=D0=BB=D1=8F=D0=BD=20=D0=9F=D0=B0=D0=BB=D0=B0?= =?UTF-8?q?=D1=83=D0=B7=D0=BE=D0=B2?= Date: Sun, 18 Jun 2023 19:08:12 +0200 Subject: [PATCH 18/35] utils: typos --- utils/db_berkeley/kambdb_recover.c | 16 ++++++++-------- utils/kamcmd/kamcmd.8 | 2 +- utils/kamcmd/kamcmd.c | 2 +- utils/kamctl/kamctl.base | 2 +- utils/kamunix/kamunix.8 | 8 ++++---- utils/pdbt/docs/network_protocol.txt | 2 +- utils/pdbt/pdbt.c | 3 ++- 7 files changed, 18 insertions(+), 17 deletions(-) diff --git a/utils/db_berkeley/kambdb_recover.c b/utils/db_berkeley/kambdb_recover.c index a3fa82dfd61..c5c1401de9e 100644 --- a/utils/db_berkeley/kambdb_recover.c +++ b/utils/db_berkeley/kambdb_recover.c @@ -184,7 +184,7 @@ int create_all(void) * file_list -- * returns a sorted linkedlist of all files in d * - * parmameter d is the directory name + * parameter d is the directory name * parameter tn is optional, * if tablename (tn) is specified returns only jnl files for tablename (tn) * else returns a sorted linkedlist of all files in d @@ -390,13 +390,13 @@ int recover(char* jfn) #ifdef EXTRA_DEBUG printf("Processed journal file: %s.\n", jfn); - printf("INSERT %i records.\n",ci); - printf("UPDATE %i records.\n",cu); - printf("DELETE %i records.\n",cd); - printf("SKIPed %i records.\n",cs); + printf("INSERT %i records.\n", ci); + printf("UPDATE %i records.\n", cu); + printf("DELETE %i records.\n", cd); + printf("SKIPped %i records.\n", cs); printf("------------------------\n"); - printf("Total %i records.\n",i); - + printf("Total %i records.\n", i); + tim2 = time(NULL); i = tim2 - tim1; printf("took %i sec\n", i); @@ -472,7 +472,7 @@ int recover_all(int lastn) /** * extract_key -- uses the internal schema to extract the key from the data * row that was found in the journal. -* caller provides inititialize memory for destination key (k). +* caller provides initialized memory for destination key (k). * data is provided ; key is filled in */ int extract_key(table_p tp, char* k, char* d) diff --git a/utils/kamcmd/kamcmd.8 b/utils/kamcmd/kamcmd.8 index c2355243fd9..9798cbc8a5e 100644 --- a/utils/kamcmd/kamcmd.8 +++ b/utils/kamcmd/kamcmd.8 @@ -40,4 +40,4 @@ see .BR kamailio.cfg(5) .PP Full documentation about kamailio is available at -.I http://www.kamailio.org/. +.I https://www.kamailio.org/. diff --git a/utils/kamcmd/kamcmd.c b/utils/kamcmd/kamcmd.c index 2fec6307d90..b4a8cad8eeb 100644 --- a/utils/kamcmd/kamcmd.c +++ b/utils/kamcmd/kamcmd.c @@ -634,7 +634,7 @@ static int binrpc_errno = 0; * returns < 0 on error, reply size on success + initializes in_pkt * if ret==-2 (parse error), sets binrpc_errno to the binrpc error * error returns: -1 - read error (check errno) - * -2 - binrpc parse error (chekc binrpc_errno) + * -2 - binrpc parse error (check binrpc_errno) * -3 - cookie error (the cookied doesn't match) * -4 - message too big */ static int get_reply(int s, unsigned char *reply_buf, int max_reply_size, diff --git a/utils/kamctl/kamctl.base b/utils/kamctl/kamctl.base index 08cd4412054..9e37f5551fc 100644 --- a/utils/kamctl/kamctl.base +++ b/utils/kamctl/kamctl.base @@ -579,7 +579,7 @@ USAGE_FUNCTIONS="$USAGE_FUNCTIONS usage_mtree" usage_acc() { echo - mecho " -- command 'acc' - manage accounding records" + mecho " -- command 'acc' - manage accounting records" echo cat <carrier=0; /* first carrier we encountered. we can remove it since we are not interested in it. */ else { - node->carrier=OTHER_CARRIERID; /* we already have a carrier we are interested in. this is an exception, set it to a special carrier id. */ + /* We already have a carrier we are interested in. This is an exception, set it to a special carrier id. */ + node->carrier = OTHER_CARRIERID; } } } From 8c934aa97890f288c7f06f4df9acad0f5853e03a Mon Sep 17 00:00:00 2001 From: Joel Centelles Date: Fri, 2 Jun 2023 18:42:16 +0200 Subject: [PATCH 19/35] db_redis: Adding TLS support Enhancing security options by enabling TLS connections and password definition. Added 3 new parameters: * opt_tls: For enabling TLS connections. * ca_path: For specifying a folder containing valid certification chains. * password: For providing DB access password. If opt_tls is provided a temporary SSL context is created to pass it to existing cluster or normal redis context. TLS support is automatically enabled/disabled by checking libhiredis_ssl.so existence. --- src/modules/db_redis/Makefile | 24 ++++- src/modules/db_redis/db_redis_mod.c | 13 ++- src/modules/db_redis/doc/db_redis.xml | 5 ++ src/modules/db_redis/doc/db_redis_admin.xml | 59 +++++++++++++ src/modules/db_redis/redis_connection.c | 98 ++++++++++++++++----- src/modules/db_redis/redis_connection.h | 6 ++ 6 files changed, 177 insertions(+), 28 deletions(-) diff --git a/src/modules/db_redis/Makefile b/src/modules/db_redis/Makefile index 179bc6f4068..e3a2abdd09c 100644 --- a/src/modules/db_redis/Makefile +++ b/src/modules/db_redis/Makefile @@ -20,10 +20,19 @@ endif ifeq ($(HIREDIS_BUILDER),) HIREDISDEFS=-I$(LOCALBASE)/include -I$(LOCALBASE)/include/hiredis -I/usr/include/hiredis - HIREDISLIBS=-L$(LOCALBASE)/lib -lhiredis + HIREDISLIBS=-L$(LOCALBASE)/lib -lhiredis_ssl -lhiredis + ifneq ($(shell ls $(LOCALBASE) | grep libhiredis_ssl.so),) + HIREDISDEFS += -DWITH_SSL + HIREDISLIBS += -lhiredis_ssl + endif else HIREDISDEFS = $(shell $(HIREDIS_BUILDER) --cflags) - HIREDISLIBS = $(shell $(HIREDIS_BUILDER) --libs) + HIREDISLIBS = $(shell $(HIREDIS_BUILDER) --libs) -lhiredis_ssl + HIREDISLIBSPATH = $(shell $(HIREDIS_BUILDER) --libs-only-L | cut -c 3-) + ifneq ($(shell ls $(HIREDISLIBSPATH) | grep libhiredis_ssl.so),) + HIREDISDEFS += -DWITH_SSL + HIREDISLIBS += -lhiredis_ssl + endif ifeq (,$(findstring hiredis,$(HIREDISDEFS))) DEFS+=-DWITH_HIREDIS_PATH @@ -31,7 +40,11 @@ endif ifeq ($(HIREDISLIBS),-L -lhiredis) HIREDISDEFS = $(shell $(HIREDIS_BUILDER) --cflags) /opt/local/include - HIREDISLIBS = -L/opt/local/lib -lhiredis + HIREDISLIBS = -L/opt/local/lib -lhiredis -lhiredis_ssl + ifneq ($(shell ls /opt/local/lib | grep libhiredis_ssl.so),) + HIREDISDEFS += -DWITH_SSL + HIREDISLIBS += -lhiredis_ssl + endif endif endif @@ -42,6 +55,11 @@ LIBS=$(HIREDISLIBS) ifneq ($(HIREDIS_CLUSTER_BUILDER),) HIREDISCLUSTERDEFS = $(shell $(HIREDIS_CLUSTER_BUILDER) --cflags) HIREDISCLUSTERLIBS = $(shell $(HIREDIS_CLUSTER_BUILDER) --libs) + HIREDISCLUSTERLIBSPATH = $(shell $(HIREDIS_CLUSTER_BUILDER) --libs-only-L | cut -c 3-) + ifneq ($(shell ls $(HIREDISCLUSTERLIBSPATH) | grep libhiredis_ssl.so),) + HIREDISCLUSTERDEFS += -DWITH_SSL + HIREDISCLUSTERLIBS += -lhiredis_ssl + endif DEFS+=-DWITH_HIREDIS_CLUSTER DEFS+=$(HIREDISCLUSTERDEFS) LIBS+=$(HIREDISCLUSTERLIBS) diff --git a/src/modules/db_redis/db_redis_mod.c b/src/modules/db_redis/db_redis_mod.c index 837b979956f..9d95686b1b7 100644 --- a/src/modules/db_redis/db_redis_mod.c +++ b/src/modules/db_redis/db_redis_mod.c @@ -29,6 +29,12 @@ #include "redis_dbase.h" #include "redis_table.h" +#ifdef WITH_SSL +int db_redis_opt_tls = 0; +char *ca_path = 0; +#endif +char *db_pass = 0; + MODULE_VERSION str redis_keys = str_init(""); @@ -51,7 +57,12 @@ static cmd_export_t cmds[] = { static param_export_t params[] = { {"keys", PARAM_STRING | USE_FUNC_PARAM, (void *)keys_param}, {"schema_path", PARAM_STR, &redis_schema_path}, - {"verbosity", PARAM_INT, &db_redis_verbosity}, {0, 0, 0}}; + {"verbosity", PARAM_INT, &db_redis_verbosity}, +#ifdef WITH_SSL + {"opt_tls", PARAM_INT, &db_redis_opt_tls}, + {"ca_path", PARAM_STRING, &ca_path }, +#endif + {"db_pass", PARAM_STRING, &db_pass},{0, 0, 0}}; struct module_exports exports = { diff --git a/src/modules/db_redis/doc/db_redis.xml b/src/modules/db_redis/doc/db_redis.xml index 99eea0987f6..6837a4b5a68 100644 --- a/src/modules/db_redis/doc/db_redis.xml +++ b/src/modules/db_redis/doc/db_redis.xml @@ -27,6 +27,11 @@ Balashov abalashov@evaristesys.com + + Joel + Centelles Martin + joel_centellesmartin@baxter.com + 2018 diff --git a/src/modules/db_redis/doc/db_redis_admin.xml b/src/modules/db_redis/doc/db_redis_admin.xml index b3b54c08a20..a7e7c3bb3a9 100644 --- a/src/modules/db_redis/doc/db_redis_admin.xml +++ b/src/modules/db_redis/doc/db_redis_admin.xml @@ -213,6 +213,61 @@ modparam("db_redis", "keys", "version=entry:table_name;location=entry:ruid&u ... modparam("db_redis", "verbosity", 0) +... + + +
+ +
+ <varname>opt_tls</varname> (int) + + Controls TLS usage while connecting to a remote DB. + If set to 1, TLS is used to connect to the DB. + + + Default value: 0. + + + Enabling TLS connection + +... +modparam("db_redis", "opt_tls", 1) +... + + +
+ +
+ <varname>db_pass</varname> (string) + + Sets the password to connect to the DB. + + + Default value: "" (empty). + + + Setting a password + +... +modparam("db_redis", "db_pass", "r3d1sPass") +... + + +
+ +
+ <varname>ac_path</varname> (string) + + Sets the path where Certificates Authorities certs are stored. + + + Default value: "" (empty). + + + Setting CA path + +... +modparam("db_redis", "ca_path", "/etc/ssl/certs") ... @@ -231,6 +286,10 @@ modparam("db_redis", "verbosity", 0) For cluster support you need to set the "db_url" modparam with a comma separated list of cluster hosts: 'redis://host1:port1,host2:port2/'. The database portion is not supported in cluster mode. + + If accessed DB requires TLS connections, you need to enable TLS support setting the "opt_tls" parameter to 1. + In case the DB requires a password, that should be set using the "db_pass" parameter. + Usage diff --git a/src/modules/db_redis/redis_connection.c b/src/modules/db_redis/redis_connection.c index 2afc7e86349..ea8f94fff8d 100644 --- a/src/modules/db_redis/redis_connection.c +++ b/src/modules/db_redis/redis_connection.c @@ -35,6 +35,11 @@ static unsigned int MAX_URL_LENGTH = 1023; #endif extern int db_redis_verbosity; +#ifdef WITH_SSL +extern int db_redis_opt_tls; +extern char *ca_path; +#endif +extern char *db_pass; static void print_query(redis_key_t *query) { @@ -120,12 +125,17 @@ int db_redis_connect(km_redis_con_t *con) #ifndef WITH_HIREDIS_CLUSTER int db; #endif +#ifdef WITH_SSL + redisSSLContext *ssl = NULL; +#endif + char* password = NULL; tv.tv_sec = 1; tv.tv_usec = 0; #ifndef WITH_HIREDIS_CLUSTER db = atoi(con->id->database); #endif + redisSSLContext *ssl = NULL; reply = NULL; if(con->con) { @@ -139,69 +149,109 @@ int db_redis_connect(km_redis_con_t *con) #ifdef WITH_HIREDIS_CLUSTER int status; char hosts[MAX_URL_LENGTH]; - char *host_begin; - char *host_end; - LM_DBG("connecting to redis cluster at %.*s\n", con->id->url.len, + char* host_begin; + char* host_end; + LM_DBG("connecting to redis cluster at %.*s\n", con->id->url.len, con->id->url.s); host_begin = strstr(con->id->url.s, "redis://"); - if(host_begin) { + if (host_begin) { host_begin += 8; } else { LM_ERR("invalid url scheme\n"); goto err; } + +#ifdef WITH_SSL + if (db_redis_opt_tls != 0) { + /* Create SSL context*/ + redisInitOpenSSL(); + ssl = redisCreateSSLContext(NULL, ca_path, NULL, NULL, NULL, NULL); + if (ssl == NULL) { + LM_ERR("Unable to create Redis SSL Context.\n"); + goto err; + } + } +#endif + host_end = strstr(host_begin, "/"); - if(!host_end) { + if (! host_end) { LM_ERR("invalid url: cannot find end of host part\n"); goto err; } - if((host_end - host_begin) > (MAX_URL_LENGTH - 1)) { + if ((host_end - host_begin) > (MAX_URL_LENGTH-1)) { LM_ERR("url too long\n"); goto err; } strncpy(hosts, host_begin, (host_end - host_begin)); - hosts[MAX_URL_LENGTH - 1] = '\0'; + hosts[MAX_URL_LENGTH-1] = '\0'; con->con = redisClusterContextInit(); - if(!con->con) { + if (! con->con) { LM_ERR("no private memory left\n"); goto err; } redisClusterSetOptionAddNodes(con->con, hosts); redisClusterSetOptionConnectTimeout(con->con, tv); +#ifdef WITH_SSL + if (ssl) { + redisClusterSetOptionEnableSSL(con->con, ssl); + } +#endif status = redisClusterConnect2(con->con); - if(status != REDIS_OK) { - LM_ERR("cannot open connection to cluster with hosts: %s, error: %s\n", + if (status != REDIS_OK) { + LM_ERR("cannot open connection to cluster with hosts: %s, error: %s\n", hosts, con->con->errstr); goto err; } #else LM_DBG("connecting to redis at %s:%d\n", con->id->host, con->id->port); + +#ifdef WITH_SSL + if (db_redis_opt_tls != 0) { + /* Create SSL context*/ + redisInitOpenSSL(); + ssl = redisCreateSSLContext(NULL, ca_path, NULL, NULL, NULL, NULL); + if (ssl == NULL) { + LM_ERR("Unable to create Redis SSL Context.\n"); + goto err; + } + } +#endif + con->con = redisConnectWithTimeout(con->id->host, con->id->port, tv); - if(!con->con) { - LM_ERR("cannot open connection: %.*s\n", con->id->url.len, + if (!con->con) { + LM_ERR("cannot open connection: %.*s\n", con->id->url.len, con->id->url.s); goto err; } - if(con->con->err) { - LM_ERR("cannot open connection to %.*s: %s\n", con->id->url.len, + if (con->con->err) { + LM_ERR("cannot open connection to %.*s: %s\n", con->id->url.len, con->id->url.s, con->con->errstr); goto err; } +#ifdef WITH_SSL + if (ssl) { + redisInitiateSSLWithContext(con->con, ssl); + } +#endif #endif - if(con->id->password) { - reply = redisCommand(con->con, "AUTH %s", con->id->password); - if(!reply) { + password = con->id->password; + if (!password) { + password = db_pass; + } + if (password) { + reply = redisCommand(con->con, "AUTH %s", password); + if (!reply) { LM_ERR("cannot authenticate connection %.*s: %s\n", con->id->url.len, con->id->url.s, con->con->errstr); goto err; } - if(reply->type == REDIS_REPLY_ERROR) { + if (reply->type == REDIS_REPLY_ERROR) { LM_ERR("cannot authenticate connection %.*s: %s\n", con->id->url.len, con->id->url.s, reply->str); goto err; } - freeReplyObject(reply); + freeReplyObject(reply); reply = NULL; } @@ -299,11 +349,11 @@ km_redis_con_t *db_redis_new_connection(const struct db_id *id) ptr->id = (struct db_id *)id; /* - LM_DBG("trying to initialize connection to '%.*s' with schema path '%.*s' and keys '%.*s'\n", - id->url.len, id->url.s, - redis_schema_path.len, redis_schema_path.s, - redis_keys.len, redis_keys.s); - */ + LM_DBG("trying to initialize connection to '%.*s' with schema path '%.*s' and keys '%.*s'\n", + id->url.len, id->url.s, + redis_schema_path.len, redis_schema_path.s, + redis_keys.len, redis_keys.s); + */ LM_DBG("trying to initialize connection to '%.*s'\n", id->url.len, id->url.s); if(db_redis_parse_schema(ptr) != 0) { diff --git a/src/modules/db_redis/redis_connection.h b/src/modules/db_redis/redis_connection.h index e3ae36131c2..62bb81f40f2 100644 --- a/src/modules/db_redis/redis_connection.h +++ b/src/modules/db_redis/redis_connection.h @@ -28,8 +28,14 @@ #else #ifdef WITH_HIREDIS_PATH #include +#ifdef WITH_SSL +#include +#endif #else #include +#ifdef WITH_SSL +#include +#endif #endif #endif From 5b4d1d9e6160ab7aec8e77ab1a3e53651f2d37cc Mon Sep 17 00:00:00 2001 From: Joel Centelles Date: Fri, 2 Jun 2023 18:44:09 +0200 Subject: [PATCH 20/35] ndb_redis: Adding TLS support Checks for the tls parameter in the BD schema and, if it's enabled, creates a temporary TLS conext that is used to initialize the redis context. Adds 1 new parameter: * ca_path: For specifying a folder containing valid certification chains. --- src/modules/ndb_redis/Makefile | 15 +++- src/modules/ndb_redis/doc/ndb_redis.xml | 5 ++ src/modules/ndb_redis/doc/ndb_redis_admin.xml | 26 +++++-- src/modules/ndb_redis/ndb_redis_mod.c | 10 ++- src/modules/ndb_redis/redis_client.c | 69 ++++++++++++++++++- src/modules/ndb_redis/redis_client.h | 7 ++ 6 files changed, 124 insertions(+), 8 deletions(-) diff --git a/src/modules/ndb_redis/Makefile b/src/modules/ndb_redis/Makefile index 66c34617fd9..a90e3018b45 100644 --- a/src/modules/ndb_redis/Makefile +++ b/src/modules/ndb_redis/Makefile @@ -14,10 +14,19 @@ endif ifeq ($(HIREDIS_BUILDER),) HIREDISDEFS=-I$(LOCALBASE)/include -I$(LOCALBASE)/include/hiredis -I/usr/include/hiredis - HIREDISLIBS=-L$(LOCALBASE)/lib -lhiredis + HIREDISLIBS=-L$(LOCALBASE)/lib + ifneq ($(shell ls $(LOCALBASE) | grep libhiredis_ssl.so),) + HIREDISDEFS += -DWITH_SSL + HIREDISLIBS += -lhiredis_ssl + endif else HIREDISDEFS = $(shell $(HIREDIS_BUILDER) --cflags) HIREDISLIBS = $(shell $(HIREDIS_BUILDER) --libs) + HIREDISLIBSPATH = $(shell $(HIREDIS_BUILDER) --libs-only-L | cut -c 3-) + ifneq ($(shell ls $(HIREDISLIBSPATH) | grep libhiredis_ssl.so),) + HIREDISDEFS += -DWITH_SSL + HIREDISLIBS += -lhiredis_ssl + endif ifeq (,$(findstring hiredis,$(HIREDISDEFS))) DEFS+=-DWITH_HIREDIS_PATH @@ -26,6 +35,10 @@ endif ifeq ($(HIREDISLIBS),-L -lhiredis) HIREDISDEFS = $(shell $(HIREDIS_BUILDER) --cflags) /opt/local/include HIREDISLIBS = -L/opt/local/lib -lhiredis + ifneq ($(shell ls /opt/local/lib | grep libhiredis_ssl.so),) + HIREDISDEFS += -DWITH_SSL + HIREDISLIBS += -lhiredis_ssl + endif endif endif diff --git a/src/modules/ndb_redis/doc/ndb_redis.xml b/src/modules/ndb_redis/doc/ndb_redis.xml index e33a8a787a3..7adefadc05a 100644 --- a/src/modules/ndb_redis/doc/ndb_redis.xml +++ b/src/modules/ndb_redis/doc/ndb_redis.xml @@ -38,6 +38,11 @@ Bock carsten@ng-voice.com + + Joel + Centelles Martin + joel_centellesmartin@baxter.com + 2011 diff --git a/src/modules/ndb_redis/doc/ndb_redis_admin.xml b/src/modules/ndb_redis/doc/ndb_redis_admin.xml index 217a3d75d3d..024e08aa59a 100644 --- a/src/modules/ndb_redis/doc/ndb_redis_admin.xml +++ b/src/modules/ndb_redis/doc/ndb_redis_admin.xml @@ -63,12 +63,12 @@ <varname>server</varname> (str) Specify the details to connect to REDIS server. It takes a list of attribute=value - separated by semicolon, the attributes can be name, unix, addr, port, db and pass. Name + separated by semicolon, the attributes can be name, unix, addr, port, db, pass and tls. Name is a generic identifier to be used with module functions. unix is the path to the unix domain socket provided by redis server. addr and port are the IP address and the port to - connect to REDIS server. pass is the server password. unix and (addr, port) are mutually - exclusive. If both appear in same server settings unix domain socket is configured. db - is the DB number to use (defaults to 0 if not specified). + connect to REDIS server. pass is the server password. tls is to enable TLS connectivity. + unix and (addr, port) are mutually exclusive. If both appear in same server settings unix + domain socket is configured. db is the DB number to use (defaults to 0 if not specified). You can set this parameter many times, in case you want to connect to @@ -86,6 +86,7 @@ ... modparam("ndb_redis", "server", "name=srvN;addr=127.0.0.1;port=6379;db=1") modparam("ndb_redis", "server", "name=srvX;addr=127.0.0.2;port=6379;db=4;pass=mypassword") +modparam("ndb_redis", "server", "name=srvY;addr=127.0.0.3;port=6379;db=5;pass=mypassword;tls=1") # Unix domain socket modparam("ndb_redis", "server", "name=srvY;unix=/tmp/redis.sock;db=3") @@ -324,6 +325,23 @@ modparam("ndb_redis", "allow_dynamic_nodes", 1) ... modparam("ndb_redis", "debug", 1) +... + + +
+
+ <varname>ac_path</varname> (string) + + Sets the path where Certificates Authorities certs are stored. + + + Default value: "" (empty). + + + Setting CA path + +... +modparam("db_redis", "ca_path", "/etc/ssl/certs") ... diff --git a/src/modules/ndb_redis/ndb_redis_mod.c b/src/modules/ndb_redis/ndb_redis_mod.c index 3db07703a6c..ffbbc684b92 100644 --- a/src/modules/ndb_redis/ndb_redis_mod.c +++ b/src/modules/ndb_redis/ndb_redis_mod.c @@ -54,6 +54,9 @@ int redis_allowed_timeouts_param = -1; int redis_flush_on_reconnect_param = 0; int redis_allow_dynamic_nodes_param = 0; int ndb_redis_debug = L_DBG; +#ifdef WITH_SSL +char *ca_path = 0; +#endif static int w_redis_cmd3( struct sip_msg *msg, char *ssrv, char *scmd, char *sres); @@ -131,7 +134,12 @@ static param_export_t params[] = { {"allowed_timeouts", INT_PARAM, &redis_allowed_timeouts_param}, {"flush_on_reconnect", INT_PARAM, &redis_flush_on_reconnect_param}, {"allow_dynamic_nodes", INT_PARAM, &redis_allow_dynamic_nodes_param}, - {"debug", PARAM_INT, &ndb_redis_debug}, {0, 0, 0}}; + {"debug", PARAM_INT, &ndb_redis_debug}, +#ifdef WITH_SSL + {"ca_path", PARAM_STRING, &ca_path}, +#endif + {0, 0, 0} +}; struct module_exports exports = { "ndb_redis", DEFAULT_DLFLAGS, /* dlopen flags */ diff --git a/src/modules/ndb_redis/redis_client.c b/src/modules/ndb_redis/redis_client.c index a0865dc6125..6cf491f35b8 100644 --- a/src/modules/ndb_redis/redis_client.c +++ b/src/modules/ndb_redis/redis_client.c @@ -62,6 +62,9 @@ extern int redis_allowed_timeouts_param; extern int redis_flush_on_reconnect_param; extern int redis_allow_dynamic_nodes_param; extern int ndb_redis_debug; +#ifdef WITH_SSL +extern char *ca_path; +#endif /* backwards compatibility with hiredis < 0.12 */ #if(HIREDIS_MAJOR == 0) && (HIREDIS_MINOR < 12) @@ -81,6 +84,9 @@ int redisc_init(void) char addr[256], pass[256], unix_sock_path[256], sentinel_group[256]; unsigned int port, db, sock = 0, haspass = 0, sentinel_master = 1; +#ifdef WITH_SSL + unsigned int enable_ssl = 0; +#endif int i, row; redisc_server_t *rsrv = NULL; param_t *pit = NULL; @@ -133,7 +139,14 @@ int redisc_init(void) snprintf(pass, sizeof(pass) - 1, "%.*s", pit->body.len, pit->body.s); haspass = 1; - } else if(pit->name.len == 14 +#ifdef WITH_SSL + } else if(pit->name.len==3 && strncmp(pit->name.s, "tls", 3)==0) { + snprintf(pass, sizeof(pass)-1, "%.*s", + pit->body.len, pit->body.s); + if (str2int(&pit->body, &enable_ssl) < 0) + enable_ssl = 0; +#endif + } else if(pit->name.len==14 && strncmp(pit->name.s, "sentinel_group", 14) == 0) { snprintf(sentinel_group, sizeof(sentinel_group) - 1, "%.*s", pit->body.len, pit->body.s); @@ -218,16 +231,38 @@ int redisc_init(void) } } +#ifdef WITH_SSL + if (enable_ssl) { + /* Create SSL context*/ + redisInitOpenSSL(); + rsrv->sslCtxRedis = redisCreateSSLContext(NULL, NULL, NULL, NULL, NULL, NULL); + if (rsrv->sslCtxRedis == NULL) { + LM_ERR("Unable to create Redis TLS Context.\n"); + } + } +#endif + if(sock != 0) { LOG(ndb_redis_debug, "Connecting to unix socket: %s\n", unix_sock_path); rsrv->ctxRedis = redisConnectUnixWithTimeout(unix_sock_path, tv_conn); } else { +#ifdef WITH_SSL + LOG(ndb_redis_debug, "Connecting to %s %s:%d\n", (enable_ssl) ?"TLS" :"UDP", addr, port); +#else LOG(ndb_redis_debug, "Connecting to %s:%d\n", addr, port); +#endif rsrv->ctxRedis = redisConnectWithTimeout(addr, port, tv_conn); } +#ifdef WITH_SSL + if (enable_ssl) { + /* Negotiate SSL/TLS handshake*/ + redisInitiateSSLWithContext(rsrv->ctxRedis, rsrv->sslCtxRedis); + } +#endif + LOG(ndb_redis_debug, "rsrv->ctxRedis = %p\n", rsrv->ctxRedis); if(!rsrv->ctxRedis) { @@ -420,6 +455,9 @@ int redisc_reconnect_server(redisc_server_t *rsrv) { char addr[256], pass[256], unix_sock_path[256], sentinel_group[256]; unsigned int port, db, sock = 0, haspass = 0, sentinel_master = 1; +#ifdef WITH_SSL + unsigned int enable_ssl = 0; +#endif char sentinels[MAXIMUM_SENTINELS][256]; uint8_t sentinels_count = 0; int i, row; @@ -456,7 +494,13 @@ int redisc_reconnect_server(redisc_server_t *rsrv) snprintf( pass, sizeof(pass) - 1, "%.*s", pit->body.len, pit->body.s); haspass = 1; - } else if(pit->name.len == 14 +#ifdef WITH_SSL + } else if(pit->name.len==3 && strncmp(pit->name.s, "tls", 3)==0) { + snprintf(pass, sizeof(pass)-1, "%.*s", pit->body.len, pit->body.s); + if (str2int(&pit->body, &enable_ssl) < 0) + enable_ssl = 0; +#endif + } else if(pit->name.len == 14 && strncmp(pit->name.s, "sentinel_group", 14) == 0) { snprintf(sentinel_group, sizeof(sentinel_group) - 1, "%.*s", pit->body.len, pit->body.s); @@ -541,12 +585,33 @@ int redisc_reconnect_server(redisc_server_t *rsrv) redisFree(rsrv->ctxRedis); rsrv->ctxRedis = NULL; } +#ifdef WITH_SSL + if(rsrv->sslCtxRedis!=NULL) { + redisFreeSSLContext(rsrv->sslCtxRedis); + rsrv->sslCtxRedis = NULL; + } + + if (enable_ssl) { + /* Create SSL context*/ + redisInitOpenSSL(); + rsrv->sslCtxRedis = redisCreateSSLContext(NULL, NULL, NULL, NULL, NULL, NULL); + if (rsrv->sslCtxRedis == NULL) { + LM_ERR("Unable to create Redis TLS Context.\n"); + } + } +#endif if(sock != 0) { rsrv->ctxRedis = redisConnectUnixWithTimeout(unix_sock_path, tv_conn); } else { rsrv->ctxRedis = redisConnectWithTimeout(addr, port, tv_conn); } +#ifdef WITH_SSL + if (enable_ssl) { + /* Negotiate SSL/TLS handshake*/ + redisInitiateSSLWithContext(rsrv->ctxRedis, rsrv->sslCtxRedis); + } +#endif LM_DBG("rsrv->ctxRedis = %p\n", rsrv->ctxRedis); if(!rsrv->ctxRedis) goto err; diff --git a/src/modules/ndb_redis/redis_client.h b/src/modules/ndb_redis/redis_client.h index 5b1ca593eff..9e1323981da 100644 --- a/src/modules/ndb_redis/redis_client.h +++ b/src/modules/ndb_redis/redis_client.h @@ -30,8 +30,14 @@ #ifdef WITH_HIREDIS_PATH #include +#ifdef WITH_SSL +#include +#endif #else #include +#ifdef WITH_SSL +#include +#endif #endif #include "../../core/str.h" @@ -76,6 +82,7 @@ typedef struct redisc_server param_t *attrs; char *spec; redisContext *ctxRedis; + redisSSLContext *sslCtxRedis; struct redisc_server *next; redisc_piped_cmds_t piped; redisc_srv_disable_t disable; From 6176c95a17f940c130f6219140593b6f08653e38 Mon Sep 17 00:00:00 2001 From: Joel Centelles Date: Thu, 8 Jun 2023 16:45:47 +0200 Subject: [PATCH 21/35] db_redis: Fixing format Fixing malformed C lines --- src/modules/db_redis/db_redis_mod.c | 6 ++-- src/modules/db_redis/redis_connection.c | 46 ++++++++++++------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/modules/db_redis/db_redis_mod.c b/src/modules/db_redis/db_redis_mod.c index 9d95686b1b7..026abeb1485 100644 --- a/src/modules/db_redis/db_redis_mod.c +++ b/src/modules/db_redis/db_redis_mod.c @@ -59,10 +59,10 @@ static param_export_t params[] = { {"schema_path", PARAM_STR, &redis_schema_path}, {"verbosity", PARAM_INT, &db_redis_verbosity}, #ifdef WITH_SSL - {"opt_tls", PARAM_INT, &db_redis_opt_tls}, - {"ca_path", PARAM_STRING, &ca_path }, + {"opt_tls", PARAM_INT, &db_redis_opt_tls}, + {"ca_path", PARAM_STRING, &ca_path}, #endif - {"db_pass", PARAM_STRING, &db_pass},{0, 0, 0}}; + {"db_pass", PARAM_STRING, &db_pass}, {0, 0, 0}}; struct module_exports exports = { diff --git a/src/modules/db_redis/redis_connection.c b/src/modules/db_redis/redis_connection.c index ea8f94fff8d..bfdc2144547 100644 --- a/src/modules/db_redis/redis_connection.c +++ b/src/modules/db_redis/redis_connection.c @@ -128,7 +128,7 @@ int db_redis_connect(km_redis_con_t *con) #ifdef WITH_SSL redisSSLContext *ssl = NULL; #endif - char* password = NULL; + char *password = NULL; tv.tv_sec = 1; tv.tv_usec = 0; @@ -149,12 +149,12 @@ int db_redis_connect(km_redis_con_t *con) #ifdef WITH_HIREDIS_CLUSTER int status; char hosts[MAX_URL_LENGTH]; - char* host_begin; - char* host_end; + char *host_begin; + char *host_end; LM_DBG("connecting to redis cluster at %.*s\n", con->id->url.len, con->id->url.s); host_begin = strstr(con->id->url.s, "redis://"); - if (host_begin) { + if(host_begin) { host_begin += 8; } else { LM_ERR("invalid url scheme\n"); @@ -162,11 +162,11 @@ int db_redis_connect(km_redis_con_t *con) } #ifdef WITH_SSL - if (db_redis_opt_tls != 0) { + if(db_redis_opt_tls != 0) { /* Create SSL context*/ redisInitOpenSSL(); ssl = redisCreateSSLContext(NULL, ca_path, NULL, NULL, NULL, NULL); - if (ssl == NULL) { + if(ssl == NULL) { LM_ERR("Unable to create Redis SSL Context.\n"); goto err; } @@ -174,30 +174,30 @@ int db_redis_connect(km_redis_con_t *con) #endif host_end = strstr(host_begin, "/"); - if (! host_end) { + if(!host_end) { LM_ERR("invalid url: cannot find end of host part\n"); goto err; } - if ((host_end - host_begin) > (MAX_URL_LENGTH-1)) { + if((host_end - host_begin) > (MAX_URL_LENGTH - 1)) { LM_ERR("url too long\n"); goto err; } strncpy(hosts, host_begin, (host_end - host_begin)); - hosts[MAX_URL_LENGTH-1] = '\0'; + hosts[MAX_URL_LENGTH - 1] = '\0'; con->con = redisClusterContextInit(); - if (! con->con) { + if(!con->con) { LM_ERR("no private memory left\n"); goto err; } redisClusterSetOptionAddNodes(con->con, hosts); redisClusterSetOptionConnectTimeout(con->con, tv); #ifdef WITH_SSL - if (ssl) { + if(ssl) { redisClusterSetOptionEnableSSL(con->con, ssl); } #endif status = redisClusterConnect2(con->con); - if (status != REDIS_OK) { + if(status != REDIS_OK) { LM_ERR("cannot open connection to cluster with hosts: %s, error: %s\n", hosts, con->con->errstr); goto err; @@ -206,11 +206,11 @@ int db_redis_connect(km_redis_con_t *con) LM_DBG("connecting to redis at %s:%d\n", con->id->host, con->id->port); #ifdef WITH_SSL - if (db_redis_opt_tls != 0) { + if(db_redis_opt_tls != 0) { /* Create SSL context*/ redisInitOpenSSL(); ssl = redisCreateSSLContext(NULL, ca_path, NULL, NULL, NULL, NULL); - if (ssl == NULL) { + if(ssl == NULL) { LM_ERR("Unable to create Redis SSL Context.\n"); goto err; } @@ -218,40 +218,40 @@ int db_redis_connect(km_redis_con_t *con) #endif con->con = redisConnectWithTimeout(con->id->host, con->id->port, tv); - if (!con->con) { + if(!con->con) { LM_ERR("cannot open connection: %.*s\n", con->id->url.len, con->id->url.s); goto err; } - if (con->con->err) { - LM_ERR("cannot open connection to %.*s: %s\n", con->id->url.len, + if(con->con->err) { + LM_ERR("cannot open connection to %.*s: %s\n", con->id->url.len, con->id->url.s, con->con->errstr); goto err; } #ifdef WITH_SSL - if (ssl) { + if(ssl) { redisInitiateSSLWithContext(con->con, ssl); } #endif #endif password = con->id->password; - if (!password) { + if(!password) { password = db_pass; } - if (password) { + if(password) { reply = redisCommand(con->con, "AUTH %s", password); - if (!reply) { + if(!reply) { LM_ERR("cannot authenticate connection %.*s: %s\n", con->id->url.len, con->id->url.s, con->con->errstr); goto err; } - if (reply->type == REDIS_REPLY_ERROR) { + if(reply->type == REDIS_REPLY_ERROR) { LM_ERR("cannot authenticate connection %.*s: %s\n", con->id->url.len, con->id->url.s, reply->str); goto err; } - freeReplyObject(reply); + freeReplyObject(reply); reply = NULL; } From 23a54de62daf07ace22569baf0a52ee851645200 Mon Sep 17 00:00:00 2001 From: Joel Centelles Date: Thu, 8 Jun 2023 16:48:21 +0200 Subject: [PATCH 22/35] db_redis: Missing format fixes Removing spaces from line ends. --- src/modules/db_redis/redis_connection.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/db_redis/redis_connection.c b/src/modules/db_redis/redis_connection.c index bfdc2144547..1bfc8cdad09 100644 --- a/src/modules/db_redis/redis_connection.c +++ b/src/modules/db_redis/redis_connection.c @@ -170,7 +170,7 @@ int db_redis_connect(km_redis_con_t *con) LM_ERR("Unable to create Redis SSL Context.\n"); goto err; } - } + } #endif host_end = strstr(host_begin, "/"); @@ -214,7 +214,7 @@ int db_redis_connect(km_redis_con_t *con) LM_ERR("Unable to create Redis SSL Context.\n"); goto err; } - } + } #endif con->con = redisConnectWithTimeout(con->id->host, con->id->port, tv); From 93bcb36ee013e4ab02f71342fa2e2163dc380b8e Mon Sep 17 00:00:00 2001 From: Joel Centelles Date: Thu, 8 Jun 2023 16:57:04 +0200 Subject: [PATCH 23/35] ndb_redis: Format fixes Fixing C formatting issues --- src/modules/ndb_redis/ndb_redis_mod.c | 3 +- src/modules/ndb_redis/redis_client.c | 47 +++++++++++++++------------ 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/src/modules/ndb_redis/ndb_redis_mod.c b/src/modules/ndb_redis/ndb_redis_mod.c index ffbbc684b92..11d6cdb9c75 100644 --- a/src/modules/ndb_redis/ndb_redis_mod.c +++ b/src/modules/ndb_redis/ndb_redis_mod.c @@ -138,8 +138,7 @@ static param_export_t params[] = { #ifdef WITH_SSL {"ca_path", PARAM_STRING, &ca_path}, #endif - {0, 0, 0} -}; + {0, 0, 0}}; struct module_exports exports = { "ndb_redis", DEFAULT_DLFLAGS, /* dlopen flags */ diff --git a/src/modules/ndb_redis/redis_client.c b/src/modules/ndb_redis/redis_client.c index 6cf491f35b8..00b01c95964 100644 --- a/src/modules/ndb_redis/redis_client.c +++ b/src/modules/ndb_redis/redis_client.c @@ -140,13 +140,14 @@ int redisc_init(void) pit->body.s); haspass = 1; #ifdef WITH_SSL - } else if(pit->name.len==3 && strncmp(pit->name.s, "tls", 3)==0) { - snprintf(pass, sizeof(pass)-1, "%.*s", - pit->body.len, pit->body.s); - if (str2int(&pit->body, &enable_ssl) < 0) + } else if(pit->name.len==3 + && strncmp(pit->name.s, "tls", 3) == 0) { + snprintf(pass, sizeof(pass) - 1, "%.*s", pit->body.len, + pit->body.s); + if(str2int(&pit->body, &enable_ssl) < 0) enable_ssl = 0; #endif - } else if(pit->name.len==14 + } else if(pit->name.len == 14 && strncmp(pit->name.s, "sentinel_group", 14) == 0) { snprintf(sentinel_group, sizeof(sentinel_group) - 1, "%.*s", pit->body.len, pit->body.s); @@ -232,11 +233,12 @@ int redisc_init(void) } #ifdef WITH_SSL - if (enable_ssl) { + if(enable_ssl) { /* Create SSL context*/ redisInitOpenSSL(); - rsrv->sslCtxRedis = redisCreateSSLContext(NULL, NULL, NULL, NULL, NULL, NULL); - if (rsrv->sslCtxRedis == NULL) { + rsrv->sslCtxRedis = + redisCreateSSLContext(NULL, NULL, NULL, NULL, NULL, NULL); + if(rsrv->sslCtxRedis == NULL) { LM_ERR("Unable to create Redis TLS Context.\n"); } } @@ -249,7 +251,8 @@ int redisc_init(void) redisConnectUnixWithTimeout(unix_sock_path, tv_conn); } else { #ifdef WITH_SSL - LOG(ndb_redis_debug, "Connecting to %s %s:%d\n", (enable_ssl) ?"TLS" :"UDP", addr, port); + LOG(ndb_redis_debug, "Connecting to %s %s:%d\n", + (enable_ssl) ?"TLS" :"UDP", addr, port); #else LOG(ndb_redis_debug, "Connecting to %s:%d\n", addr, port); #endif @@ -257,7 +260,7 @@ int redisc_init(void) } #ifdef WITH_SSL - if (enable_ssl) { + if(enable_ssl) { /* Negotiate SSL/TLS handshake*/ redisInitiateSSLWithContext(rsrv->ctxRedis, rsrv->sslCtxRedis); } @@ -495,12 +498,13 @@ int redisc_reconnect_server(redisc_server_t *rsrv) pass, sizeof(pass) - 1, "%.*s", pit->body.len, pit->body.s); haspass = 1; #ifdef WITH_SSL - } else if(pit->name.len==3 && strncmp(pit->name.s, "tls", 3)==0) { - snprintf(pass, sizeof(pass)-1, "%.*s", pit->body.len, pit->body.s); - if (str2int(&pit->body, &enable_ssl) < 0) + } else if(pit->name.len == 3 && strncmp(pit->name.s, "tls", 3) == 0) { + snprintf( + pass, sizeof(pass)-1, "%.*s", pit->body.len, pit->body.s); + if(str2int(&pit->body, &enable_ssl) < 0) enable_ssl = 0; #endif - } else if(pit->name.len == 14 + } else if(pit->name.len == 14 && strncmp(pit->name.s, "sentinel_group", 14) == 0) { snprintf(sentinel_group, sizeof(sentinel_group) - 1, "%.*s", pit->body.len, pit->body.s); @@ -586,16 +590,17 @@ int redisc_reconnect_server(redisc_server_t *rsrv) rsrv->ctxRedis = NULL; } #ifdef WITH_SSL - if(rsrv->sslCtxRedis!=NULL) { - redisFreeSSLContext(rsrv->sslCtxRedis); - rsrv->sslCtxRedis = NULL; + if(rsrv->sslCtxRedis != NULL) { + redisFreeSSLContext(rsrv->sslCtxRedis); + rsrv->sslCtxRedis = NULL; } - if (enable_ssl) { + if(enable_ssl) { /* Create SSL context*/ redisInitOpenSSL(); - rsrv->sslCtxRedis = redisCreateSSLContext(NULL, NULL, NULL, NULL, NULL, NULL); - if (rsrv->sslCtxRedis == NULL) { + rsrv->sslCtxRedis = + redisCreateSSLContext(NULL, NULL, NULL, NULL, NULL, NULL); + if(rsrv->sslCtxRedis == NULL) { LM_ERR("Unable to create Redis TLS Context.\n"); } } @@ -607,7 +612,7 @@ int redisc_reconnect_server(redisc_server_t *rsrv) rsrv->ctxRedis = redisConnectWithTimeout(addr, port, tv_conn); } #ifdef WITH_SSL - if (enable_ssl) { + if(enable_ssl) { /* Negotiate SSL/TLS handshake*/ redisInitiateSSLWithContext(rsrv->ctxRedis, rsrv->sslCtxRedis); } From 3162c80ee54eab842ddebef07c3c56792f30423b Mon Sep 17 00:00:00 2001 From: Joel Centelles Date: Thu, 8 Jun 2023 16:59:37 +0200 Subject: [PATCH 24/35] db_redis: Fixing build Removing extra declaration outside from WITH_SSL block --- src/modules/db_redis/redis_connection.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/modules/db_redis/redis_connection.c b/src/modules/db_redis/redis_connection.c index 1bfc8cdad09..f38b6698d41 100644 --- a/src/modules/db_redis/redis_connection.c +++ b/src/modules/db_redis/redis_connection.c @@ -135,7 +135,6 @@ int db_redis_connect(km_redis_con_t *con) #ifndef WITH_HIREDIS_CLUSTER db = atoi(con->id->database); #endif - redisSSLContext *ssl = NULL; reply = NULL; if(con->con) { From 52d1959d6ed141ab7c2a96f1f79d8d6fd82cda00 Mon Sep 17 00:00:00 2001 From: Joel Centelles Date: Fri, 9 Jun 2023 13:34:15 +0200 Subject: [PATCH 25/35] db_redis: Fixing Makefile Removing unprotected references to libhiredis_ssl.so --- src/modules/db_redis/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/db_redis/Makefile b/src/modules/db_redis/Makefile index e3a2abdd09c..7d427586e98 100644 --- a/src/modules/db_redis/Makefile +++ b/src/modules/db_redis/Makefile @@ -20,14 +20,14 @@ endif ifeq ($(HIREDIS_BUILDER),) HIREDISDEFS=-I$(LOCALBASE)/include -I$(LOCALBASE)/include/hiredis -I/usr/include/hiredis - HIREDISLIBS=-L$(LOCALBASE)/lib -lhiredis_ssl -lhiredis + HIREDISLIBS=-L$(LOCALBASE)/lib -lhiredis ifneq ($(shell ls $(LOCALBASE) | grep libhiredis_ssl.so),) HIREDISDEFS += -DWITH_SSL HIREDISLIBS += -lhiredis_ssl endif else HIREDISDEFS = $(shell $(HIREDIS_BUILDER) --cflags) - HIREDISLIBS = $(shell $(HIREDIS_BUILDER) --libs) -lhiredis_ssl + HIREDISLIBS = $(shell $(HIREDIS_BUILDER) --libs) HIREDISLIBSPATH = $(shell $(HIREDIS_BUILDER) --libs-only-L | cut -c 3-) ifneq ($(shell ls $(HIREDISLIBSPATH) | grep libhiredis_ssl.so),) HIREDISDEFS += -DWITH_SSL @@ -40,7 +40,7 @@ endif ifeq ($(HIREDISLIBS),-L -lhiredis) HIREDISDEFS = $(shell $(HIREDIS_BUILDER) --cflags) /opt/local/include - HIREDISLIBS = -L/opt/local/lib -lhiredis -lhiredis_ssl + HIREDISLIBS = -L/opt/local/lib -lhiredis ifneq ($(shell ls /opt/local/lib | grep libhiredis_ssl.so),) HIREDISDEFS += -DWITH_SSL HIREDISLIBS += -lhiredis_ssl From 89c9e4eb5df0ef2a8fe064eed961d9b838049cab Mon Sep 17 00:00:00 2001 From: Joel Centelles Date: Mon, 12 Jun 2023 13:24:31 +0200 Subject: [PATCH 26/35] db_redis: Fixing global variables Adding module name prefix to global variables to reduce possible conflicts. --- src/modules/db_redis/db_redis_mod.c | 8 ++++---- src/modules/db_redis/redis_connection.c | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/modules/db_redis/db_redis_mod.c b/src/modules/db_redis/db_redis_mod.c index 026abeb1485..89da2320839 100644 --- a/src/modules/db_redis/db_redis_mod.c +++ b/src/modules/db_redis/db_redis_mod.c @@ -31,9 +31,9 @@ #ifdef WITH_SSL int db_redis_opt_tls = 0; -char *ca_path = 0; +char *db_redis_ca_path = 0; #endif -char *db_pass = 0; +char *db_redis_db_pass = 0; MODULE_VERSION @@ -60,9 +60,9 @@ static param_export_t params[] = { {"verbosity", PARAM_INT, &db_redis_verbosity}, #ifdef WITH_SSL {"opt_tls", PARAM_INT, &db_redis_opt_tls}, - {"ca_path", PARAM_STRING, &ca_path}, + {"ca_path", PARAM_STRING, &db_redis_ca_path}, #endif - {"db_pass", PARAM_STRING, &db_pass}, {0, 0, 0}}; + {"db_pass", PARAM_STRING, &db_redis_db_pass}, {0, 0, 0}}; struct module_exports exports = { diff --git a/src/modules/db_redis/redis_connection.c b/src/modules/db_redis/redis_connection.c index f38b6698d41..0bf001d1528 100644 --- a/src/modules/db_redis/redis_connection.c +++ b/src/modules/db_redis/redis_connection.c @@ -37,9 +37,9 @@ static unsigned int MAX_URL_LENGTH = 1023; extern int db_redis_verbosity; #ifdef WITH_SSL extern int db_redis_opt_tls; -extern char *ca_path; +extern char *db_redis_ca_path; #endif -extern char *db_pass; +extern char *db_redis_db_pass; static void print_query(redis_key_t *query) { @@ -164,7 +164,7 @@ int db_redis_connect(km_redis_con_t *con) if(db_redis_opt_tls != 0) { /* Create SSL context*/ redisInitOpenSSL(); - ssl = redisCreateSSLContext(NULL, ca_path, NULL, NULL, NULL, NULL); + ssl = redisCreateSSLContext(NULL, db_redis_ca_path, NULL, NULL, NULL, NULL); if(ssl == NULL) { LM_ERR("Unable to create Redis SSL Context.\n"); goto err; @@ -208,7 +208,7 @@ int db_redis_connect(km_redis_con_t *con) if(db_redis_opt_tls != 0) { /* Create SSL context*/ redisInitOpenSSL(); - ssl = redisCreateSSLContext(NULL, ca_path, NULL, NULL, NULL, NULL); + ssl = redisCreateSSLContext(NULL, db_redis_ca_path, NULL, NULL, NULL, NULL); if(ssl == NULL) { LM_ERR("Unable to create Redis SSL Context.\n"); goto err; @@ -236,7 +236,7 @@ int db_redis_connect(km_redis_con_t *con) password = con->id->password; if(!password) { - password = db_pass; + password = db_redis_db_pass; } if(password) { reply = redisCommand(con->con, "AUTH %s", password); From 053c65d731ceca121a64f6c599f8b78911636c25 Mon Sep 17 00:00:00 2001 From: Joel Centelles Date: Mon, 12 Jun 2023 13:30:39 +0200 Subject: [PATCH 27/35] ndb_redis: Fixing global variables names Adding module name prefixing global variable names to prevent possible conflicts. Also using ca_path info in SSL context creation. --- src/modules/ndb_redis/ndb_redis_mod.c | 4 ++-- src/modules/ndb_redis/redis_client.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/ndb_redis/ndb_redis_mod.c b/src/modules/ndb_redis/ndb_redis_mod.c index 11d6cdb9c75..48c04a0bcc8 100644 --- a/src/modules/ndb_redis/ndb_redis_mod.c +++ b/src/modules/ndb_redis/ndb_redis_mod.c @@ -55,7 +55,7 @@ int redis_flush_on_reconnect_param = 0; int redis_allow_dynamic_nodes_param = 0; int ndb_redis_debug = L_DBG; #ifdef WITH_SSL -char *ca_path = 0; +char *ndb_redis_ca_path = 0; #endif static int w_redis_cmd3( @@ -136,7 +136,7 @@ static param_export_t params[] = { {"allow_dynamic_nodes", INT_PARAM, &redis_allow_dynamic_nodes_param}, {"debug", PARAM_INT, &ndb_redis_debug}, #ifdef WITH_SSL - {"ca_path", PARAM_STRING, &ca_path}, + {"ca_path", PARAM_STRING, &ndb_redis_ca_path}, #endif {0, 0, 0}}; diff --git a/src/modules/ndb_redis/redis_client.c b/src/modules/ndb_redis/redis_client.c index 00b01c95964..39b33d20660 100644 --- a/src/modules/ndb_redis/redis_client.c +++ b/src/modules/ndb_redis/redis_client.c @@ -63,7 +63,7 @@ extern int redis_flush_on_reconnect_param; extern int redis_allow_dynamic_nodes_param; extern int ndb_redis_debug; #ifdef WITH_SSL -extern char *ca_path; +extern char *ndb_redis_ca_path; #endif /* backwards compatibility with hiredis < 0.12 */ @@ -237,7 +237,7 @@ int redisc_init(void) /* Create SSL context*/ redisInitOpenSSL(); rsrv->sslCtxRedis = - redisCreateSSLContext(NULL, NULL, NULL, NULL, NULL, NULL); + redisCreateSSLContext(NULL, ndb_redis_ca_path, NULL, NULL, NULL, NULL); if(rsrv->sslCtxRedis == NULL) { LM_ERR("Unable to create Redis TLS Context.\n"); } @@ -599,7 +599,7 @@ int redisc_reconnect_server(redisc_server_t *rsrv) /* Create SSL context*/ redisInitOpenSSL(); rsrv->sslCtxRedis = - redisCreateSSLContext(NULL, NULL, NULL, NULL, NULL, NULL); + redisCreateSSLContext(NULL, ndb_redis_ca_path, NULL, NULL, NULL, NULL); if(rsrv->sslCtxRedis == NULL) { LM_ERR("Unable to create Redis TLS Context.\n"); } From 1cde6d38a5d12950f5c405677ba652248881cd64 Mon Sep 17 00:00:00 2001 From: Joel Centelles Date: Tue, 13 Jun 2023 13:34:31 +0200 Subject: [PATCH 28/35] ndb_redis: Missing uprotected redisSSLContext Fixing unprotected redisSSLContext reference in redis_client.h --- src/modules/ndb_redis/redis_client.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/ndb_redis/redis_client.h b/src/modules/ndb_redis/redis_client.h index 9e1323981da..fd13d712902 100644 --- a/src/modules/ndb_redis/redis_client.h +++ b/src/modules/ndb_redis/redis_client.h @@ -82,7 +82,9 @@ typedef struct redisc_server param_t *attrs; char *spec; redisContext *ctxRedis; +#ifdef WITH_SSL redisSSLContext *sslCtxRedis; +#endif struct redisc_server *next; redisc_piped_cmds_t piped; redisc_srv_disable_t disable; From d0e84ab04921a01bfb980aa6ff5fb8df50ccd759 Mon Sep 17 00:00:00 2001 From: Joel Centelles Date: Fri, 16 Jun 2023 20:25:48 +0200 Subject: [PATCH 29/35] db_redis: Searching SSL support in gcc search library path Checking libhiredis_ssl.so in gcc --print-search-dirs --- src/modules/db_redis/Makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/modules/db_redis/Makefile b/src/modules/db_redis/Makefile index 7d427586e98..f2231c26aec 100644 --- a/src/modules/db_redis/Makefile +++ b/src/modules/db_redis/Makefile @@ -29,10 +29,18 @@ else HIREDISDEFS = $(shell $(HIREDIS_BUILDER) --cflags) HIREDISLIBS = $(shell $(HIREDIS_BUILDER) --libs) HIREDISLIBSPATH = $(shell $(HIREDIS_BUILDER) --libs-only-L | cut -c 3-) - ifneq ($(shell ls $(HIREDISLIBSPATH) | grep libhiredis_ssl.so),) + ifeq ($(HIREDISLIBSPATH),) + GCCSEARCHDIRS = $(shell $(CC) -print-search-dirs | grep -Po '^.*libraries: =.*' | cut -d "=" -f2- | tr : ' ') + ifneq ($(shell find $(GCCSEARCHDIRS) libhiredis_ssl.so),) + HIREDISDEFS += -DWITH_SSL + HIREDISLIBS += -lhiredis_ssl + endif + else + ifneq ($(shell ls $(HIREDISLIBSPATH) | grep libhiredis_ssl.so),) HIREDISDEFS += -DWITH_SSL HIREDISLIBS += -lhiredis_ssl - endif + endif + endif ifeq (,$(findstring hiredis,$(HIREDISDEFS))) DEFS+=-DWITH_HIREDIS_PATH From 6c0bc1d276921fae02c06cadc0d96a8ff17b2a2f Mon Sep 17 00:00:00 2001 From: Joel Centelles Date: Fri, 16 Jun 2023 20:30:28 +0200 Subject: [PATCH 30/35] ndb_redis: Searching SSL support in gcc search library path Checking libhiredis_ssl.so in gcc --print-search-dirs --- src/modules/ndb_redis/Makefile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/modules/ndb_redis/Makefile b/src/modules/ndb_redis/Makefile index a90e3018b45..6b27f72386a 100644 --- a/src/modules/ndb_redis/Makefile +++ b/src/modules/ndb_redis/Makefile @@ -23,10 +23,18 @@ else HIREDISDEFS = $(shell $(HIREDIS_BUILDER) --cflags) HIREDISLIBS = $(shell $(HIREDIS_BUILDER) --libs) HIREDISLIBSPATH = $(shell $(HIREDIS_BUILDER) --libs-only-L | cut -c 3-) - ifneq ($(shell ls $(HIREDISLIBSPATH) | grep libhiredis_ssl.so),) - HIREDISDEFS += -DWITH_SSL - HIREDISLIBS += -lhiredis_ssl - endif + ifeq ($(HIREDISLIBSPATH),) + GCCSEARCHDIRS = $(shell $(CC) -print-search-dirs | grep -Po '^.*libraries: =.*' | cut -d "=" -f2- | tr : ' ') + ifneq ($(shell find $(GCCSEARCHDIRS) libhiredis_ssl.so),) + HIREDISDEFS += -DWITH_SSL + HIREDISLIBS += -lhiredis_ssl + endif + else + ifneq ($(shell ls $(HIREDISLIBSPATH) | grep libhiredis_ssl.so),) + HIREDISDEFS += -DWITH_SSL + HIREDISLIBS += -lhiredis_ssl + endif + endif ifeq (,$(findstring hiredis,$(HIREDISDEFS))) DEFS+=-DWITH_HIREDIS_PATH From 03ae83161307feeb95f36a60ef4f50d948a877b2 Mon Sep 17 00:00:00 2001 From: Joel Centelles Date: Fri, 16 Jun 2023 21:07:29 +0200 Subject: [PATCH 31/35] db_redis: Format fixes Fixing some spaces --- src/modules/db_redis/redis_connection.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/modules/db_redis/redis_connection.c b/src/modules/db_redis/redis_connection.c index 0bf001d1528..5a49346b431 100644 --- a/src/modules/db_redis/redis_connection.c +++ b/src/modules/db_redis/redis_connection.c @@ -150,7 +150,7 @@ int db_redis_connect(km_redis_con_t *con) char hosts[MAX_URL_LENGTH]; char *host_begin; char *host_end; - LM_DBG("connecting to redis cluster at %.*s\n", con->id->url.len, + LM_DBG("connecting to redis cluster at %.*s\n", con->id->url.len, con->id->url.s); host_begin = strstr(con->id->url.s, "redis://"); if(host_begin) { @@ -164,7 +164,8 @@ int db_redis_connect(km_redis_con_t *con) if(db_redis_opt_tls != 0) { /* Create SSL context*/ redisInitOpenSSL(); - ssl = redisCreateSSLContext(NULL, db_redis_ca_path, NULL, NULL, NULL, NULL); + ssl = redisCreateSSLContext( + NULL, db_redis_ca_path, NULL, NULL, NULL, NULL); if(ssl == NULL) { LM_ERR("Unable to create Redis SSL Context.\n"); goto err; @@ -197,7 +198,7 @@ int db_redis_connect(km_redis_con_t *con) #endif status = redisClusterConnect2(con->con); if(status != REDIS_OK) { - LM_ERR("cannot open connection to cluster with hosts: %s, error: %s\n", + LM_ERR("cannot open connection to cluster with hosts: %s, error: %s\n", hosts, con->con->errstr); goto err; } @@ -208,7 +209,8 @@ int db_redis_connect(km_redis_con_t *con) if(db_redis_opt_tls != 0) { /* Create SSL context*/ redisInitOpenSSL(); - ssl = redisCreateSSLContext(NULL, db_redis_ca_path, NULL, NULL, NULL, NULL); + ssl = redisCreateSSLContext( + NULL, db_redis_ca_path, NULL, NULL, NULL, NULL); if(ssl == NULL) { LM_ERR("Unable to create Redis SSL Context.\n"); goto err; @@ -218,7 +220,7 @@ int db_redis_connect(km_redis_con_t *con) con->con = redisConnectWithTimeout(con->id->host, con->id->port, tv); if(!con->con) { - LM_ERR("cannot open connection: %.*s\n", con->id->url.len, + LM_ERR("cannot open connection: %.*s\n", con->id->url.len, con->id->url.s); goto err; } From 279cf4e805838f897c2b71f2ea8c828de1725391 Mon Sep 17 00:00:00 2001 From: Joel Centelles Date: Fri, 16 Jun 2023 21:08:40 +0200 Subject: [PATCH 32/35] ndb_redis: Fixing format Fixing some spaces and indentations --- src/modules/ndb_redis/ndb_redis_mod.c | 2 +- src/modules/ndb_redis/redis_client.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/modules/ndb_redis/ndb_redis_mod.c b/src/modules/ndb_redis/ndb_redis_mod.c index 48c04a0bcc8..4d0491547db 100644 --- a/src/modules/ndb_redis/ndb_redis_mod.c +++ b/src/modules/ndb_redis/ndb_redis_mod.c @@ -134,7 +134,7 @@ static param_export_t params[] = { {"allowed_timeouts", INT_PARAM, &redis_allowed_timeouts_param}, {"flush_on_reconnect", INT_PARAM, &redis_flush_on_reconnect_param}, {"allow_dynamic_nodes", INT_PARAM, &redis_allow_dynamic_nodes_param}, - {"debug", PARAM_INT, &ndb_redis_debug}, + {"debug", PARAM_INT, &ndb_redis_debug}, #ifdef WITH_SSL {"ca_path", PARAM_STRING, &ndb_redis_ca_path}, #endif diff --git a/src/modules/ndb_redis/redis_client.c b/src/modules/ndb_redis/redis_client.c index 39b33d20660..13701438f11 100644 --- a/src/modules/ndb_redis/redis_client.c +++ b/src/modules/ndb_redis/redis_client.c @@ -140,14 +140,14 @@ int redisc_init(void) pit->body.s); haspass = 1; #ifdef WITH_SSL - } else if(pit->name.len==3 - && strncmp(pit->name.s, "tls", 3) == 0) { + } else if(pit->name.len == 3 + && strncmp(pit->name.s, "tls", 3) == 0) { snprintf(pass, sizeof(pass) - 1, "%.*s", pit->body.len, pit->body.s); if(str2int(&pit->body, &enable_ssl) < 0) enable_ssl = 0; #endif - } else if(pit->name.len == 14 + } else if(pit->name.len == 14 && strncmp(pit->name.s, "sentinel_group", 14) == 0) { snprintf(sentinel_group, sizeof(sentinel_group) - 1, "%.*s", pit->body.len, pit->body.s); @@ -236,8 +236,8 @@ int redisc_init(void) if(enable_ssl) { /* Create SSL context*/ redisInitOpenSSL(); - rsrv->sslCtxRedis = - redisCreateSSLContext(NULL, ndb_redis_ca_path, NULL, NULL, NULL, NULL); + rsrv->sslCtxRedis = redisCreateSSLContext( + NULL, ndb_redis_ca_path, NULL, NULL, NULL, NULL); if(rsrv->sslCtxRedis == NULL) { LM_ERR("Unable to create Redis TLS Context.\n"); } @@ -251,8 +251,8 @@ int redisc_init(void) redisConnectUnixWithTimeout(unix_sock_path, tv_conn); } else { #ifdef WITH_SSL - LOG(ndb_redis_debug, "Connecting to %s %s:%d\n", - (enable_ssl) ?"TLS" :"UDP", addr, port); + LOG(ndb_redis_debug, "Connecting to %s %s:%d\n", + (enable_ssl) ? "TLS" : "UDP", addr, port); #else LOG(ndb_redis_debug, "Connecting to %s:%d\n", addr, port); #endif @@ -500,7 +500,7 @@ int redisc_reconnect_server(redisc_server_t *rsrv) #ifdef WITH_SSL } else if(pit->name.len == 3 && strncmp(pit->name.s, "tls", 3) == 0) { snprintf( - pass, sizeof(pass)-1, "%.*s", pit->body.len, pit->body.s); + pass, sizeof(pass) - 1, "%.*s", pit->body.len, pit->body.s); if(str2int(&pit->body, &enable_ssl) < 0) enable_ssl = 0; #endif @@ -598,8 +598,8 @@ int redisc_reconnect_server(redisc_server_t *rsrv) if(enable_ssl) { /* Create SSL context*/ redisInitOpenSSL(); - rsrv->sslCtxRedis = - redisCreateSSLContext(NULL, ndb_redis_ca_path, NULL, NULL, NULL, NULL); + rsrv->sslCtxRedis = redisCreateSSLContext( + NULL, ndb_redis_ca_path, NULL, NULL, NULL, NULL); if(rsrv->sslCtxRedis == NULL) { LM_ERR("Unable to create Redis TLS Context.\n"); } From e9cc9fc15b9ebb87d64478be93980e4c7766d941 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Tue, 20 Jun 2023 11:03:04 +0200 Subject: [PATCH 33/35] db_redis: Makefile - updated find command for libhiredis_ssl - silent warnings about not existing directories --- src/modules/db_redis/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/db_redis/Makefile b/src/modules/db_redis/Makefile index f2231c26aec..815cd056b9d 100644 --- a/src/modules/db_redis/Makefile +++ b/src/modules/db_redis/Makefile @@ -31,7 +31,7 @@ else HIREDISLIBSPATH = $(shell $(HIREDIS_BUILDER) --libs-only-L | cut -c 3-) ifeq ($(HIREDISLIBSPATH),) GCCSEARCHDIRS = $(shell $(CC) -print-search-dirs | grep -Po '^.*libraries: =.*' | cut -d "=" -f2- | tr : ' ') - ifneq ($(shell find $(GCCSEARCHDIRS) libhiredis_ssl.so),) + ifneq ($(shell find $(GCCSEARCHDIRS) -name libhiredis_ssl.so 2>/dev/null),) HIREDISDEFS += -DWITH_SSL HIREDISLIBS += -lhiredis_ssl endif From 50f592c63ae8e91b2ba33323a3b7641ad9967c92 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Tue, 20 Jun 2023 11:04:30 +0200 Subject: [PATCH 34/35] ndb_redis: Makefile - updated find command for libhiredis_ssl - silent warnings about not existing directories --- src/modules/ndb_redis/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/ndb_redis/Makefile b/src/modules/ndb_redis/Makefile index 6b27f72386a..ba085ca2735 100644 --- a/src/modules/ndb_redis/Makefile +++ b/src/modules/ndb_redis/Makefile @@ -25,7 +25,7 @@ else HIREDISLIBSPATH = $(shell $(HIREDIS_BUILDER) --libs-only-L | cut -c 3-) ifeq ($(HIREDISLIBSPATH),) GCCSEARCHDIRS = $(shell $(CC) -print-search-dirs | grep -Po '^.*libraries: =.*' | cut -d "=" -f2- | tr : ' ') - ifneq ($(shell find $(GCCSEARCHDIRS) libhiredis_ssl.so),) + ifneq ($(shell find $(GCCSEARCHDIRS) -name libhiredis_ssl.so 2>/dev/null),) HIREDISDEFS += -DWITH_SSL HIREDISLIBS += -lhiredis_ssl endif From 290f50eede5f22a732e3ab9435682e6bf3d23825 Mon Sep 17 00:00:00 2001 From: Kamailio Dev Date: Tue, 20 Jun 2023 11:16:33 +0200 Subject: [PATCH 35/35] modules: readme files regenerated - db_redis ... [skip ci] --- src/modules/db_redis/README | 62 +++++++++++++++++++++++++++++++++--- src/modules/ndb_redis/README | 46 +++++++++++++++++++------- 2 files changed, 92 insertions(+), 16 deletions(-) diff --git a/src/modules/db_redis/README b/src/modules/db_redis/README index ab56c61379b..d2baa50e72d 100644 --- a/src/modules/db_redis/README +++ b/src/modules/db_redis/README @@ -14,6 +14,10 @@ Alex Balashov +Joel Centelles Martin + + + Copyright © 2018 sipwise.com __________________________________________________________________ @@ -33,6 +37,9 @@ Alex Balashov 4.1. schema_path (string) 4.2. keys (string) 4.3. verbosity (int) + 4.4. opt_tls (int) + 4.5. db_pass (string) + 4.6. ac_path (string) 5. Usage 6. Module Specific Considerations @@ -44,8 +51,11 @@ Alex Balashov 1.1. Setting schema_path module parameter 1.2. Setting keys module parameter 1.3. Setting verbosity module parameter - 1.4. Usage - 1.5. Usage + 1.4. Enabling TLS connection + 1.5. Setting a password + 1.6. Setting CA path + 1.7. Usage + 1.8. Usage Chapter 1. Admin Guide @@ -63,6 +73,9 @@ Chapter 1. Admin Guide 4.1. schema_path (string) 4.2. keys (string) 4.3. verbosity (int) + 4.4. opt_tls (int) + 4.5. db_pass (string) + 4.6. ac_path (string) 5. Usage 6. Module Specific Considerations @@ -188,6 +201,9 @@ allid,time_hires&cid:callid 4.1. schema_path (string) 4.2. keys (string) 4.3. verbosity (int) + 4.4. opt_tls (int) + 4.5. db_pass (string) + 4.6. ac_path (string) 4.1. schema_path (string) @@ -226,6 +242,40 @@ m:username,domain&timer:partition,keepalive") modparam("db_redis", "verbosity", 0) ... +4.4. opt_tls (int) + + Controls TLS usage while connecting to a remote DB. If set to 1, TLS is + used to connect to the DB. + + Default value: 0. + + Example 1.4. Enabling TLS connection +... +modparam("db_redis", "opt_tls", 1) +... + +4.5. db_pass (string) + + Sets the password to connect to the DB. + + Default value: "" (empty). + + Example 1.5. Setting a password +... +modparam("db_redis", "db_pass", "r3d1sPass") +... + +4.6. ac_path (string) + + Sets the path where Certificates Authorities certs are stored. + + Default value: "" (empty). + + Example 1.6. Setting CA path +... +modparam("db_redis", "ca_path", "/etc/ssl/certs") +... + 5. Usage Load the module and set the "db_url" modparam for specific modules to: @@ -236,7 +286,11 @@ modparam("db_redis", "verbosity", 0) separated list of cluster hosts: 'redis://host1:port1,host2:port2/'. The database portion is not supported in cluster mode. - Example 1.4. Usage + If accessed DB requires TLS connections, you need to enable TLS support + setting the "opt_tls" parameter to 1. In case the DB requires a + password, that should be set using the "db_pass" parameter. + + Example 1.7. Usage ... loadmodule "db_redis.so" ... @@ -269,7 +323,7 @@ modparam("dialog", "db_url", DBURL_DLG) Samples adding records for address table using 'redis-cli': - Example 1.5. Usage + Example 1.8. Usage ... SELECT 8 HMSET address:entry::1 id 1 grp 1 ip_addr "127.0.0.1" mask 32 port 0 diff --git a/src/modules/ndb_redis/README b/src/modules/ndb_redis/README index 46081b7ec84..1cdfc842db3 100644 --- a/src/modules/ndb_redis/README +++ b/src/modules/ndb_redis/README @@ -22,6 +22,10 @@ Carsten Bock +Joel Centelles Martin + + + Copyright © 2011 asipto.com Copyright © 2012 www.systemonenoc.com @@ -51,6 +55,7 @@ Carsten Bock 3.8. flush_on_reconnect (integer) 3.9. allow_dynamic_nodes (integer) 3.10. debug (integer) + 3.11. ac_path (string) 4. Functions @@ -71,9 +76,10 @@ Carsten Bock 1.8. Set flush_on_reconnect parameter 1.9. Set allow_dynamic_nodes parameter 1.10. Set debug parameter - 1.11. redis_cmd usage - 1.12. redis_execute usage - 1.13. redis_free usage + 1.11. Setting CA path + 1.12. redis_cmd usage + 1.13. redis_execute usage + 1.14. redis_free usage Chapter 1. Admin Guide @@ -97,6 +103,7 @@ Chapter 1. Admin Guide 3.8. flush_on_reconnect (integer) 3.9. allow_dynamic_nodes (integer) 3.10. debug (integer) + 3.11. ac_path (string) 4. Functions @@ -142,18 +149,20 @@ Chapter 1. Admin Guide 3.8. flush_on_reconnect (integer) 3.9. allow_dynamic_nodes (integer) 3.10. debug (integer) + 3.11. ac_path (string) 3.1. server (str) Specify the details to connect to REDIS server. It takes a list of attribute=value separated by semicolon, the attributes can be name, - unix, addr, port, db and pass. Name is a generic identifier to be used - with module functions. unix is the path to the unix domain socket + unix, addr, port, db, pass and tls. Name is a generic identifier to be + used with module functions. unix is the path to the unix domain socket provided by redis server. addr and port are the IP address and the port - to connect to REDIS server. pass is the server password. unix and - (addr, port) are mutually exclusive. If both appear in same server - settings unix domain socket is configured. db is the DB number to use - (defaults to 0 if not specified). + to connect to REDIS server. pass is the server password. tls is to + enable TLS connectivity. unix and (addr, port) are mutually exclusive. + If both appear in same server settings unix domain socket is + configured. db is the DB number to use (defaults to 0 if not + specified). You can set this parameter many times, in case you want to connect to many REDIS servers, just give different attributes and use the specific @@ -166,6 +175,8 @@ Chapter 1. Admin Guide modparam("ndb_redis", "server", "name=srvN;addr=127.0.0.1;port=6379;db=1") modparam("ndb_redis", "server", "name=srvX;addr=127.0.0.2;port=6379;db=4;pass=my password") +modparam("ndb_redis", "server", "name=srvY;addr=127.0.0.3;port=6379;db=5;pass=my +password;tls=1") # Unix domain socket modparam("ndb_redis", "server", "name=srvY;unix=/tmp/redis.sock;db=3") @@ -335,6 +346,17 @@ modparam("ndb_redis", "allow_dynamic_nodes", 1) modparam("ndb_redis", "debug", 1) ... +3.11. ac_path (string) + + Sets the path where Certificates Authorities certs are stored. + + Default value: "" (empty). + + Example 1.11. Setting CA path +... +modparam("db_redis", "ca_path", "/etc/ssl/certs") +... + 4. Functions 4.1. redis_cmd(srvname, command, ..., replyid) @@ -375,7 +397,7 @@ modparam("ndb_redis", "debug", 1) value. The key can be: rpl_str, rpl_arr, rpl_int, rpl_err, rpl_sts, rpl_nil. - Example 1.11. redis_cmd usage + Example 1.12. redis_cmd usage ... if(redis_cmd("srvN", "INCR cnt", "r")) { # success - the incremented value is in $redis(r=>value) @@ -454,7 +476,7 @@ if (redis_cmd("srvN", "EXEC", "r")) { If cluster parameter is set to 1, this function will log an error and do nothing. - Example 1.12. redis_execute usage + Example 1.13. redis_execute usage ... After several redis command calls: redis_pipe_cmd("srvA", "SET foo bar", "r1"); @@ -502,7 +524,7 @@ d commands. The call is not necessary function. When ndb_redis module closes, all pending replies are freed automatically. - Example 1.13. redis_free usage + Example 1.14. redis_free usage ... After a redis command call: redis_cmd("srvN", "INCR cnt", "r");