Module: sip-router
Branch: tirpi/cfg_framework_multivalue
Commit: 92f85d59c0bd582b396d09c509a78902c8ccffab
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=92f85d5…
Author: Miklos Tirpak <miklos(a)iptel.org>
Committer: Miklos Tirpak <miklos(a)iptel.org>
Date: Tue Sep 28 11:44:29 2010 +0200
cfg framework: apply the additional variable list
The additional variable list which is linked to the groups
is applied when the config is shmized. During this process,
the array of group instances is created, the values are fixed-up,
the changes are applied to each instance, and the list is freed.
Any change after the config is shmized is directly made in the
memory block as opposed to using the list.
(The list is necessary at the beginning because not even shm_malloc
is available, and the number of group instances is not known.)
---
cfg/cfg_ctx.c | 175 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
cfg/cfg_ctx.h | 7 ++
cfg/cfg_struct.c | 102 +++++++++++++++++++++++++++++++-
cfg/cfg_struct.h | 3 +
4 files changed, 286 insertions(+), 1 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=92f…
Module: sip-router
Branch: master
Commit: 2f95266d695532fd5ade1cd45b61c61055577d62
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=2f95266…
Author: Juha Heinanen <jh(a)tutpro.com>
Committer: Juha Heinanen <jh(a)tutpro.com>
Date: Tue Sep 28 08:28:49 2010 +0300
modules/lcr: README improvement and a new script
- Added a paragraph on lcr weights.
- Added a script that can be used to determine probabilities
corresponding to a set of weights.
---
modules/lcr/README | 9 ++++++-
modules/lcr/doc/lcr_admin.xml | 11 +++++++-
modules/lcr/utils/lcr_weight_test.php | 43 +++++++++++++++++++++++++++++++++
3 files changed, 60 insertions(+), 3 deletions(-)
diff --git a/modules/lcr/README b/modules/lcr/README
index 44b9f1f..8fa8a98 100644
--- a/modules/lcr/README
+++ b/modules/lcr/README
@@ -230,7 +230,14 @@ Chapter 1. Admin Guide
expression (see 'man pcresyntax' for syntax), an empty string, or NULL.
An empty or NULL from pattern or prefix matches anything. Smaller
priority value means higher priority (highest priority value being 0
- and lowest being 255). Weight is an integer value from 1 to 254.
+ and lowest being 255).
+
+ Weight is an integer value from 1 to 254. Weight implementation is
+ fast, but unfair favoring larger weight values at the expense smaller
+ ones. For example, if two gateways have weights 1 and 2, probability
+ that the gateway with weight 1 is tried first is 1/4, not 1/3. A script
+ is provided in lcr/utils directory that can be used to check the
+ probabilities resulting from a given set of weight values.
The function next_gw() can then be used to select one gateway at a time
for forwarding. Upon each call, unless "dont_strip_of_tag" flag is set,
diff --git a/modules/lcr/doc/lcr_admin.xml b/modules/lcr/doc/lcr_admin.xml
index ab0b45e..562a7c0 100644
--- a/modules/lcr/doc/lcr_admin.xml
+++ b/modules/lcr/doc/lcr_admin.xml
@@ -66,8 +66,15 @@
pcresyntax' for syntax), an empty string, or NULL. An empty or
NULL from pattern or prefix matches anything.
Smaller priority value means higher priority (highest priority
- value being 0 and lowest being 255). Weight is an integer value
- from 1 to 254.
+ value being 0 and lowest being 255).
+ </para>
+ <para>
+ Weight is an integer value from 1 to 254. Weight implementation is
+ fast, but unfair favoring larger weight values at the expense smaller
+ ones. For example, if two gateways have weights 1 and 2, probability
+ that the gateway with weight 1 is tried first is 1/4, not 1/3.
+ A script is provided in lcr/utils directory that can be used to
+ check the probabilities resulting from a given set of weight values.
</para>
<para>
The function <emphasis>next_gw()</emphasis> can then be used to
diff --git a/modules/lcr/utils/lcr_weight_test.php b/modules/lcr/utils/lcr_weight_test.php
new file mode 100755
index 0000000..53c9319
--- /dev/null
+++ b/modules/lcr/utils/lcr_weight_test.php
@@ -0,0 +1,43 @@
+#!/usr/bin/php
+<?php
+
+ // This script can be used to find out actual probabilities
+ // that correspond to a list of LCR gateway weights.
+
+if ($argc < 2) {
+ echo "Usage: lcr_weight_test.php <list of weights (integers 1-254)>\n";
+ exit;
+ }
+
+$iters = 10000;
+
+$rands = array();
+for ($i = 1; $i <= $iters; $i++) {
+ $elem = array();
+ for ($j = 1; $j < $argc; $j++) {
+ $elem["$j"] = $argv[$j] * (rand() >> 8);
+ }
+ $rands[] = $elem;
+ }
+
+$sorted = array();
+foreach ($rands as $rand) {
+ asort($rand);
+ $sorted[] = $rand;
+ }
+
+$counts = array();
+for ($j = 1; $j < $argc; $j++) {
+ $counts["$j"] = 0;
+ }
+
+foreach ($sorted as $rand) {
+ end($rand);
+ $counts[key($rand)]++;
+ }
+
+for ($j = 1; $j < $argc; $j++) {
+ echo "weight " . $argv[$j] . " probability " . $counts["$j"]/$iters . "\n";
+ }
+
+?>
Module: sip-router
Branch: master
Commit: e8e372698904c6afae4952d0291b051b4116bbd8
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=e8e3726…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Mon Sep 27 21:51:16 2010 +0200
debugger: some fixes in documentation
---
modules/debugger/README | 17 ++++++++++-------
modules/debugger/doc/debugger_admin.xml | 18 ++++++++++--------
2 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/modules/debugger/README b/modules/debugger/README
index ce05b89..8e55a64 100644
--- a/modules/debugger/README
+++ b/modules/debugger/README
@@ -96,12 +96,13 @@ Chapter 1. Admin Guide
the config.
Debugging can be done from local or remote host via RPC interface
- (e.g., XMLRPC, sercmd).
+ (e.g., XMLRPC, sercmd, siremis).
The framework to set breakpoints on specific actions and config lines
- is not exported to RPC yet, right now each action has an breakpoint.
- The breakpoint can be enabled/disabled at runtime. Also the config
- running trace can be enabled/disabled at runtime.
+ is not exported to RPC yet. Each action can be accompanied by an
+ breakpoint or you can use dbg_breakpoint() function to set a breakpoint
+ at certain line. Global breakpoint can be enabled/disabled at runtime.
+ Also the config running trace can be enabled/disabled at runtime.
When the SIP router process is stopped at a breakpoint, you can
investigate the values of any pseudo-varaibles. Note that some of
@@ -139,6 +140,8 @@ Chapter 1. Admin Guide
3.1. cfgtrace (int)
Control whether config running trace is enabled or disabled at startup.
+ You can change the value at runtime without restart, globally or per
+ process.
Default value is “0” (disabled).
@@ -149,7 +152,7 @@ modparam("debugger", "cfgtrace", 1)
3.2. breakpoint (int)
- Control whether every line (for now) breakpoint is enabled or disabled
+ Control whether every line (global) breakpoint is enabled or disabled
at startup.
Default value is “0” (disabled).
@@ -224,7 +227,7 @@ modparam("debugger", "step_loops", 100)
4.1. dbg_breakpoint(mode)
- Achor a breakpoint at that line in config. Mode specifies whether the
+ Anchor a breakpoint at that line in config. Mode specifies whether the
breakpoint is enabled (1) or disabled (0) at startup.
Note that this version does not export this anchors to RPC for
@@ -282,7 +285,7 @@ if($si=="10.0.0.10")
Parameters:
* _cmd_ : inner command, see next section for the list of available
values.
- * _pid_ : pid for which to apply the inner command. If it missing,
+ * _pid_ : pid for which to apply the inner command. If it is missing,
then will be applied for all processes.
* _params_ : extra params specific for each inner command.
diff --git a/modules/debugger/doc/debugger_admin.xml b/modules/debugger/doc/debugger_admin.xml
index 30fb574..78d5582 100644
--- a/modules/debugger/doc/debugger_admin.xml
+++ b/modules/debugger/doc/debugger_admin.xml
@@ -24,13 +24,14 @@
</para>
<para>
Debugging can be done from local or remote host via RPC interface (e.g.,
- XMLRPC, sercmd).
+ XMLRPC, sercmd, siremis).
</para>
<para>
The framework to set breakpoints on specific actions and config lines
- is not exported to RPC yet, right now each action has an breakpoint. The
- breakpoint can be enabled/disabled at runtime. Also the config running
- trace can be enabled/disabled at runtime.
+ is not exported to RPC yet. Each action can be accompanied by an
+ breakpoint or you can use dbg_breakpoint() function to set a breakpoint
+ at certain line. Global breakpoint can be enabled/disabled at runtime.
+ Also the config running trace can be enabled/disabled at runtime.
</para>
<para>
When the SIP router process is stopped at a breakpoint, you can
@@ -77,7 +78,8 @@
<title><varname>cfgtrace</varname> (int)</title>
<para>
Control whether config running trace is enabled or disabled
- at startup.
+ at startup. You can change the value at runtime without
+ restart, globally or per process.
</para>
<para>
<emphasis>
@@ -97,7 +99,7 @@ modparam("debugger", "cfgtrace", 1)
<section>
<title><varname>breakpoint</varname> (int)</title>
<para>
- Control whether every line (for now) breakpoint is enabled
+ Control whether every line (global) breakpoint is enabled
or disabled at startup.
</para>
<para>
@@ -228,7 +230,7 @@ modparam("debugger", "step_loops", 100)
<function moreinfo="none">dbg_breakpoint(mode)</function>
</title>
<para>
- Achor a breakpoint at that line in config. Mode specifies
+ Anchor a breakpoint at that line in config. Mode specifies
whether the breakpoint is enabled (1) or disabled (0) at startup.
</para>
<para>
@@ -321,7 +323,7 @@ if($si=="10.0.0.10")
the list of available values.</para>
</listitem>
<listitem><para>_pid_ : pid for which to apply the inner command.
- If it missing, then will be applied for all processes.</para>
+ If it is missing, then will be applied for all processes.</para>
</listitem>
<listitem><para>_params_ : extra params specific for each inner
command.</para>
Hello,
I am proposing to release the next major version in about one week and a
half, Wednesday, Oct 6. Stability of new features looks very good, it
was an extended tresting period since couple of weeks overlapped yearly
common summer holidays.
Now we need to put a bit of efforts in migration documentation.
Cheers,
Daniel
--
Daniel-Constantin Mierla
http://www.asipto.com
Module: sip-router
Branch: master
Commit: 6ab93de37f2f1991d3406f52ac9502a7c795ef55
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6ab93de…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Sun Sep 26 21:28:47 2010 +0200
core: switch(string) memleak fix
When a switch(string) is used and one of the case blocks exits the
script (by drop, exit or a module function that causes the script
to end), the dynamic string rvals were not cleaned up.
This happened because run_actions() uses longjmp() to quickly end
the script (skipping this way over the cleanups done after the
run_actions() call).
Reported-by: Daniel-Constantin Mierla <miconda(a)gmail.com>
Reported-by: C�sar Pinto Mag�n Cesar.Pinto a-e es
---
action.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/action.c b/action.c
index 8349ff9..ec098ff 100644
--- a/action.c
+++ b/action.c
@@ -1320,17 +1320,39 @@ sw_jt_def:
regexec(mct->match[i].l.regex, s.s, 0, 0, 0) == 0)
){
if (likely(mct->jump[i])){
+ /* make sure we cleanup first, in case run_actions()
+ exits the script directly via longjmp() */
+ if (rv1){
+ rval_destroy(rv1);
+ rval_destroy(rv);
+ rval_cache_clean(&c1);
+ }else if (rv){
+ rval_destroy(rv);
+ rval_cache_clean(&c1);
+ }
ret=run_actions(h, mct->jump[i], msg);
h->run_flags &= ~BREAK_R_F; /* catch breaks, but let
returns passthrough */
+ break;
}
goto match_cleanup;
}
match_cond_def:
if (mct->def){
+ /* make sure we cleanup first, in case run_actions()
+ exits the script directly via longjmp() */
+ if (rv1){
+ rval_destroy(rv1);
+ rval_destroy(rv);
+ rval_cache_clean(&c1);
+ }else if (rv){
+ rval_destroy(rv);
+ rval_cache_clean(&c1);
+ }
ret=run_actions(h, mct->def, msg);
h->run_flags &= ~BREAK_R_F; /* catch breaks, but let
returns passthrough */
+ break;
}
match_cleanup:
if (rv1){