Module: sip-router
Branch: master
Commit: 5d3449a06ac523575ba029325048efc20cd053b7
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5d3449a…
Author: Miklos Tirpak <miklos(a)iptel.org>
Committer: Miklos Tirpak <miklos(a)iptel.org>
Date: Tue Jun 7 20:58:38 2011 +0200
cfg framework: set the local config in PROC_INIT
The local configuration of the main process is temporary
set during initialization in child_init with rank==PROC_INIT,
which makes the configuration group instances available for
the modules.
The local configuration is reset back to NULL afterwards to make
sure that each child process updates its own config the usual way.
---
cfg/cfg_struct.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
cfg/cfg_struct.h | 15 +++++++++++++++
main.c | 15 +++++++++++++++
3 files changed, 74 insertions(+), 0 deletions(-)
diff --git a/cfg/cfg_struct.c b/cfg/cfg_struct.c
index c10dd55..e07098a 100644
--- a/cfg/cfg_struct.c
+++ b/cfg/cfg_struct.c
@@ -95,6 +95,8 @@ cfg_group_t *cfg_new_group(char *name, int name_len,
group->vars = vars;
group->size = size;
group->handle = handle;
+ if (handle)
+ group->orig_handle = *handle;
group->name_len = name_len;
memcpy(&group->name, name, name_len);
@@ -115,6 +117,8 @@ void cfg_set_group(cfg_group_t *group,
group->vars = vars;
group->size = size;
group->handle = handle;
+ if (handle)
+ group->orig_handle = *handle;
}
/* clones a string to shared memory
@@ -1256,3 +1260,43 @@ int cfg_select_next(cfg_group_t *group)
return 0;
}
+/* Temporary set the local configuration in the main process before forking.
+ * This makes the group instances usable in the main process after
+ * the configuration is shmized, but before the children are forked.
+ */
+void cfg_main_set_local(void)
+{
+ /* Disable the execution of child-process callbacks,
+ * they can cause trouble because the children inherit all the
+ * values later */
+ cfg_child_cb = CFG_NO_CHILD_CBS;
+ cfg_update_no_cbs();
+}
+
+/* Reset the local configuration of the main process back to its original state
+ * to make sure that the forked processes are not affected.
+ */
+void cfg_main_reset_local(void)
+{
+ cfg_group_t *group;
+
+ /* Unref the local config, and set it back to NULL.
+ * Each child will set its own local configuration. */
+ if (cfg_local) {
+ CFG_UNREF(cfg_local);
+ cfg_local = NULL;
+
+ /* restore the original value of the module handles */
+ for ( group = cfg_group;
+ group;
+ group = group->next
+ )
+ *(group->handle) = group->orig_handle;
+ /* The handle might have pointed to a group instance,
+ * reset the instance counter. */
+ cfg_ginst_count = 0;
+ }
+ cfg_child_cb = NULL;
+}
+
+
diff --git a/cfg/cfg_struct.h b/cfg/cfg_struct.h
index 2e91691..dca39a0 100644
--- a/cfg/cfg_struct.h
+++ b/cfg/cfg_struct.h
@@ -99,6 +99,10 @@ typedef struct _cfg_group {
by the modules to access the variables.
It is registered when the group is created,
and updated every time the block is replaced */
+ void *orig_handle; /*!< Original value that the handle points to
+ when the config group is registered. This is needed
+ to temporary set the handle in the main process and
+ restore it later to its original value. */
unsigned char dynamic; /*!< indicates whether the variables within the group
are dynamically allocated or not */
@@ -534,4 +538,15 @@ int cfg_select_first(cfg_group_t *group);
*/
int cfg_select_next(cfg_group_t *group);
+/* Temporary set the local configuration in the main process before forking.
+ * This makes the group instances usable in the main process after
+ * the configuration is shmized, but before the children are forked.
+ */
+void cfg_main_set_local(void);
+
+/* Reset the local configuration of the main process back to its original state
+ * to make sure that the forked processes are not affected.
+ */
+void cfg_main_reset_local(void);
+
#endif /* _CFG_STRUCT_H */
diff --git a/main.c b/main.c
index 22ed613..2fcb40b 100644
--- a/main.c
+++ b/main.c
@@ -1310,6 +1310,11 @@ int main_loop()
as new processes are forked (while skipping 0 reserved for main
*/
+ /* Temporary set the local configuration of the main process
+ * to make the group instances available in PROC_INIT.
+ */
+ cfg_main_set_local();
+
/* init childs with rank==PROC_INIT before forking any process,
* this is a place for delayed (after mod_init) initializations
* (e.g. shared vars that depend on the total number of processes
@@ -1320,8 +1325,10 @@ int main_loop()
if (init_child(PROC_INIT) < 0) {
LOG(L_ERR, "ERROR: main_dontfork: init_child(PROC_INT) --"
" exiting\n");
+ cfg_main_reset_local();
goto error;
}
+ cfg_main_reset_local();
if (counters_prefork_init(get_max_procs()) == -1) goto error;
#ifdef USE_SLOW_TIMER
@@ -1523,6 +1530,12 @@ int main_loop()
LOG(L_CRIT, "could not initialize shared configuration\n");
goto error;
}
+
+ /* Temporary set the local configuration of the main process
+ * to make the group instances available in PROC_INIT.
+ */
+ cfg_main_set_local();
+
/* init childs with rank==PROC_INIT before forking any process,
* this is a place for delayed (after mod_init) initializations
* (e.g. shared vars that depend on the total number of processes
@@ -1533,8 +1546,10 @@ int main_loop()
if (init_child(PROC_INIT) < 0) {
LOG(L_ERR, "ERROR: main: error in init_child(PROC_INT) --"
" exiting\n");
+ cfg_main_reset_local();
goto error;
}
+ cfg_main_reset_local();
if (counters_prefork_init(get_max_procs()) == -1) goto error;
Module: sip-router
Branch: master
Commit: 1ecf8867f4310ac47e8d52421930c9fd00dfc693
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1ecf886…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Fri Jun 24 00:04:01 2011 +0200
core: replace redundant for-loop memset/ memcpy with standard (faster) libc versions
---
md5.c | 97 ++++++++++++++++-------------------------------------------------
1 files changed, 24 insertions(+), 73 deletions(-)
diff --git a/md5.c b/md5.c
index 28fef81..92f3273 100644
--- a/md5.c
+++ b/md5.c
@@ -1,29 +1,24 @@
/*
-
-$Id$
-
-MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
-
-Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
-rights reserved.
-
-License to copy and use this software is granted provided that it
-is identified as the "RSA Data Security, Inc. MD5 Message-Digest
-Algorithm" in all material mentioning or referencing this software
-or this function.
-
-License is also granted to make and use derivative works provided
-that such works are identified as "derived from the RSA Data
-Security, Inc. MD5 Message-Digest Algorithm" in all material
-mentioning or referencing the derived work.
-
-RSA Data Security, Inc. makes no representations concerning either
-the merchantability of this software or the suitability of this
-software for any particular purpose. It is provided "as is"
-without express or implied warranty of any kind.
-
-These notices must be retained in any copies of any part of this
-documentation and/or software.
+ * MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
+ * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
+ * rights reserved.
+ * License to copy and use this software is granted provided that it
+ * is identified as the "RSA Data Security, Inc. MD5 Message-Digest
+ * Algorithm" in all material mentioning or referencing this software
+ * or this function.
+ *
+ * License is also granted to make and use derivative works provided
+ * that such works are identified as "derived from the RSA Data
+ * Security, Inc. MD5 Message-Digest Algorithm" in all material
+ * mentioning or referencing the derived work.
+ *
+ * RSA Data Security, Inc. makes no representations concerning either
+ * the merchantability of this software or the suitability of this
+ * software for any particular purpose. It is provided "as is"
+ * without express or implied warranty of any kind.
+ *
+ * These notices must be retained in any copies of any part of this
+ * documentation and/or software.
*/
/*!
@@ -39,14 +34,9 @@ documentation and/or software.
#include "md5.h"
-#define USE_MEM
-
/* Constants for MD5Transform routine.
*/
-
-
-
#define S11 7
#define S12 12
#define S13 17
@@ -69,8 +59,6 @@ static void Encode PROTO_LIST
((unsigned char *, UINT4 *, unsigned int));
static void Decode PROTO_LIST
((UINT4 *, unsigned char *, unsigned int));
-static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
-static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
static unsigned char PADDING[64] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -153,7 +141,7 @@ unsigned int inputLen; /* length of input block */
/* Transform as many times as possible.
*/
if (inputLen >= partLen) {
- MD5_memcpy
+ memcpy
((POINTER)&context->buffer[index], (POINTER)input, partLen);
MD5Transform (context->state, context->buffer);
@@ -166,7 +154,7 @@ unsigned int inputLen; /* length of input block */
i = 0;
/* Buffer remaining input */
- MD5_memcpy
+ memcpy
((POINTER)&context->buffer[index], (POINTER)&input[i],
inputLen-i);
}
@@ -198,7 +186,7 @@ MD5_CTX *context; /* context */
/* Zeroize sensitive information.
*/
- MD5_memset ((POINTER)context, 0, sizeof (*context));
+ memset ((POINTER)context, 0, sizeof (*context));
}
/* MD5 basic transformation. Transforms state based on block.
@@ -290,7 +278,7 @@ unsigned char block[64];
/* Zeroize sensitive information.
*/
- MD5_memset ((POINTER)x, 0, sizeof (x));
+ memset ((POINTER)x, 0, sizeof (x));
}
/* Encodes input (UINT4) into output (unsigned char). Assumes len is
@@ -325,40 +313,3 @@ unsigned int len;
output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
(((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
}
-
-/* Note: Replace "for loop" with standard memcpy if possible.
- */
-
-static void MD5_memcpy (output, input, len)
-POINTER output;
-POINTER input;
-unsigned int len;
-{
-
-#ifndef USE_MEM
- unsigned int i;
-
- for (i = 0; i < len; i++)
- output[i] = input[i];
-#else
- memcpy( output, input, len );
-#endif
-}
-
-/* Note: Replace "for loop" with standard memset if possible.
- */
-static void MD5_memset (output, value, len)
-POINTER output;
-int value;
-unsigned int len;
-{
-
-#ifndef USE_MEM
- unsigned int i;
- for (i = 0; i < len; i++)
- ((char *)output)[i] = (char)value;
-#else
- memset( output, value, len );
-#endif
-}
-
Module: sip-router
Branch: master
Commit: f992d9b4549d858944b620195611940ce1cf42b7
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f992d9b…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Thu Jun 23 23:32:50 2011 +0200
doxygen: add missing group definition to dialog module
---
modules_k/dialog/dialog.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/modules_k/dialog/dialog.c b/modules_k/dialog/dialog.c
index 839cf2f..79688a8 100644
--- a/modules_k/dialog/dialog.c
+++ b/modules_k/dialog/dialog.c
@@ -38,6 +38,19 @@
* 2010-06-16 added sip-router rpc interface (osas)
*/
+/**
+ * @defgroup dialog dialog :: Kamailio dialog module
+ * @brief Kamailio dialog module
+ *
+ * The dialog module provides dialog awareness to the Kamailio proxy. Its
+ * functionality is to keep track of the current dialogs, to offer
+ * information about them (like how many dialogs are active) or to manage
+ * them. The module exports several functions that could be used directly
+ * from scripts.
+ * The module, via an internal API, also provide the foundation to build
+ * on top of it more complex dialog-based functionalities via other
+ * Kamailio modules.
+ */
#include <stdio.h>
#include <string.h>
Module: sip-router
Branch: master
Commit: 09b8aec4d4296354aaaa36abbafea9c834492778
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=09b8aec…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Thu Jun 23 22:03:43 2011 +0200
doxygen: small syntax fix in cfg support and sl module
---
cfg/cfg_struct.h | 2 +-
modules/sl/sl.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cfg/cfg_struct.h b/cfg/cfg_struct.h
index d3231dc..f835a7e 100644
--- a/cfg/cfg_struct.h
+++ b/cfg/cfg_struct.h
@@ -118,7 +118,7 @@ typedef struct _cfg_group_inst {
unsigned char vars[1]; /*!< block for the values */
} cfg_group_inst_t;
-/*! \bried Meta-data which is stored before each variable group
+/*! \brief Meta-data which is stored before each variable group
* within the blob. This structure is used to handle the multivalue
* instances of the variables, i.e. manages the array for the
* additional values. */
diff --git a/modules/sl/sl.h b/modules/sl/sl.h
index 8a133ed..892c43b 100644
--- a/modules/sl/sl.h
+++ b/modules/sl/sl.h
@@ -60,7 +60,7 @@ typedef struct sl_cbp {
typedef void (*sl_cbf_f)(sl_cbp_t *slcbp);
/**
- * @bried SL callback structure definition
+ * @brief SL callback structure definition
*/
typedef struct sl_cbelem {
unsigned int type; /* type of callback - can be a mask of types */
Hi, I've opened an issue in the tracker since it seems that sip-router
(today's master branch) does not properly react upon TCP rejection or
TCP timeout (in outgoing transactions):
http://sip-router.org/tracker/index.php?do=details&task_id=136
Could somebody attemp these two calls?
1) sip:lalala@91.121.79.216:7777;transport=tcp
The server will reject (iptables REJECT action) so sip-router should
inmediately generate a 503 for the transaction (but instead it
generates a local 408 after fr_timer, usually 32 seconds).
2) sip:lalala@1.2.3.4:5060;transport=tcp
The server will not respond as 1.2.3.4 is not reachable, so sip-router
should wait for "tcp_connect_timeout" value (10 seconds by default)
and then generate a local 408 (but instead it generates a local 408
after fr_timer, usually 32 seconds).
Thanks a lot.
--
Iñaki Baz Castillo
<ibc(a)aliax.net>