Module: sip-router
Branch: kamailio_3.0
Commit: a22dc9b151d44dede21e3f500455eab568d14f28
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a22dc9b…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Sep 30 01:28:00 2010 +0200
mem: fix f_malloc big fragments search
In some situation (depending on previous allocation and frees)
trying to allocate a "big" fragment (>16k) would fail even if
enough memory was available (the fragment search algorithm missed
fallback to bigger buckets when using the free bitmap).
(cherry picked from commit 1ccbd33558e7e09f36f39fd984ac99a7bfd3eba2)
---
mem/f_malloc.c | 28 +++++++++++++++++++++++-----
1 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/mem/f_malloc.c b/mem/f_malloc.c
index 49c4b7a..6fa88c3 100644
--- a/mem/f_malloc.c
+++ b/mem/f_malloc.c
@@ -34,6 +34,12 @@
* 2007-02-23 added fm_available() (andrei)
* 2007-06-23 added hash bitmap (andrei)
* 2009-09-28 added fm_sums() (patch from Dragos Vingarzan)
+ * 2010-03-11 fix big fragments bug (smaller fragment was wrongly
+ * returned sometimes) (andrei)
+ * 2010-03-12 fix real_used stats for realloc: a realloc that shrank an
+ * allocation accounted twice fro the frag. overhead (andrei)
+ * 2010-09-30 fixed search for big fragments using the hash bitmap
+ * (only the first bucket was tried) (andrei)
*/
@@ -336,11 +342,23 @@ void* fm_malloc(struct fm_block* qm, unsigned long size)
#ifdef F_MALLOC_HASH_BITMAP
hash=fm_bmp_first_set(qm, GET_HASH(size));
if (likely(hash>=0)){
- f=&(qm->free_hash[hash].first);
- if (likely(hash<=F_MALLOC_OPTIMIZE/ROUNDTO)) /* return first match */
- goto found;
- for(;(*f); f=&((*f)->u.nxt_free))
- if ((*f)->size>=size) goto found;
+ if (likely(hash<=F_MALLOC_OPTIMIZE/ROUNDTO)) { /* return first match */
+ f=&(qm->free_hash[hash].first);
+ goto found;
+ }
+ /* if we are here we are searching for a "big" fragment
+ between F_MALLOC_OPTIMIZE/ROUNDTO+1
+ and F_MALLOC_OPTIMIZE/ROUNDTO + (32|64) - F_MALLOC_OPTIMIZE_FACTOR
+ => 18 hash buckets on 32 bits and 50 buckets on 64 bits
+ The free hash bitmap is used to jump directly to non-empty
+ hash buckets.
+ */
+ do {
+ for(f=&(qm->free_hash[hash].first);(*f); f=&((*f)->u.nxt_free))
+ if ((*f)->size>=size) goto found;
+ hash++; /* try in next hash cell */
+ }while((hash < F_HASH_SIZE) &&
+ ((hash=fm_bmp_first_set(qm, hash)) >= 0));
}
#else /* F_MALLOC_HASH_BITMAP */
for(hash=GET_HASH(size);hash<F_HASH_SIZE;hash++){
Module: sip-router
Branch: sr_3.0
Commit: fad8152367ba9ed3bde85a4fabb85cae469e58d3
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=fad8152…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Sep 30 01:28:00 2010 +0200
mem: fix f_malloc big fragments search
In some situation (depending on previous allocation and frees)
trying to allocate a "big" fragment (>16k) would fail even if
enough memory was available (the fragment search algorithm missed
fallback to bigger buckets when using the free bitmap).
(cherry picked from commit 1ccbd33558e7e09f36f39fd984ac99a7bfd3eba2)
---
mem/f_malloc.c | 28 +++++++++++++++++++++++-----
1 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/mem/f_malloc.c b/mem/f_malloc.c
index 49c4b7a..6fa88c3 100644
--- a/mem/f_malloc.c
+++ b/mem/f_malloc.c
@@ -34,6 +34,12 @@
* 2007-02-23 added fm_available() (andrei)
* 2007-06-23 added hash bitmap (andrei)
* 2009-09-28 added fm_sums() (patch from Dragos Vingarzan)
+ * 2010-03-11 fix big fragments bug (smaller fragment was wrongly
+ * returned sometimes) (andrei)
+ * 2010-03-12 fix real_used stats for realloc: a realloc that shrank an
+ * allocation accounted twice fro the frag. overhead (andrei)
+ * 2010-09-30 fixed search for big fragments using the hash bitmap
+ * (only the first bucket was tried) (andrei)
*/
@@ -336,11 +342,23 @@ void* fm_malloc(struct fm_block* qm, unsigned long size)
#ifdef F_MALLOC_HASH_BITMAP
hash=fm_bmp_first_set(qm, GET_HASH(size));
if (likely(hash>=0)){
- f=&(qm->free_hash[hash].first);
- if (likely(hash<=F_MALLOC_OPTIMIZE/ROUNDTO)) /* return first match */
- goto found;
- for(;(*f); f=&((*f)->u.nxt_free))
- if ((*f)->size>=size) goto found;
+ if (likely(hash<=F_MALLOC_OPTIMIZE/ROUNDTO)) { /* return first match */
+ f=&(qm->free_hash[hash].first);
+ goto found;
+ }
+ /* if we are here we are searching for a "big" fragment
+ between F_MALLOC_OPTIMIZE/ROUNDTO+1
+ and F_MALLOC_OPTIMIZE/ROUNDTO + (32|64) - F_MALLOC_OPTIMIZE_FACTOR
+ => 18 hash buckets on 32 bits and 50 buckets on 64 bits
+ The free hash bitmap is used to jump directly to non-empty
+ hash buckets.
+ */
+ do {
+ for(f=&(qm->free_hash[hash].first);(*f); f=&((*f)->u.nxt_free))
+ if ((*f)->size>=size) goto found;
+ hash++; /* try in next hash cell */
+ }while((hash < F_HASH_SIZE) &&
+ ((hash=fm_bmp_first_set(qm, hash)) >= 0));
}
#else /* F_MALLOC_HASH_BITMAP */
for(hash=GET_HASH(size);hash<F_HASH_SIZE;hash++){
Module: sip-router
Branch: master
Commit: 1ccbd33558e7e09f36f39fd984ac99a7bfd3eba2
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1ccbd33…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Sep 30 01:28:00 2010 +0200
mem: fix f_malloc big fragments search
In some situation (depending on previous allocation and frees)
trying to allocate a "big" fragment (>16k) would fail even if
enough memory was available (the fragment search algorithm missed
fallback to bigger buckets when using the free bitmap).
---
mem/f_malloc.c | 28 +++++++++++++++++++++++-----
1 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/mem/f_malloc.c b/mem/f_malloc.c
index 49c4b7a..6fa88c3 100644
--- a/mem/f_malloc.c
+++ b/mem/f_malloc.c
@@ -34,6 +34,12 @@
* 2007-02-23 added fm_available() (andrei)
* 2007-06-23 added hash bitmap (andrei)
* 2009-09-28 added fm_sums() (patch from Dragos Vingarzan)
+ * 2010-03-11 fix big fragments bug (smaller fragment was wrongly
+ * returned sometimes) (andrei)
+ * 2010-03-12 fix real_used stats for realloc: a realloc that shrank an
+ * allocation accounted twice fro the frag. overhead (andrei)
+ * 2010-09-30 fixed search for big fragments using the hash bitmap
+ * (only the first bucket was tried) (andrei)
*/
@@ -336,11 +342,23 @@ void* fm_malloc(struct fm_block* qm, unsigned long size)
#ifdef F_MALLOC_HASH_BITMAP
hash=fm_bmp_first_set(qm, GET_HASH(size));
if (likely(hash>=0)){
- f=&(qm->free_hash[hash].first);
- if (likely(hash<=F_MALLOC_OPTIMIZE/ROUNDTO)) /* return first match */
- goto found;
- for(;(*f); f=&((*f)->u.nxt_free))
- if ((*f)->size>=size) goto found;
+ if (likely(hash<=F_MALLOC_OPTIMIZE/ROUNDTO)) { /* return first match */
+ f=&(qm->free_hash[hash].first);
+ goto found;
+ }
+ /* if we are here we are searching for a "big" fragment
+ between F_MALLOC_OPTIMIZE/ROUNDTO+1
+ and F_MALLOC_OPTIMIZE/ROUNDTO + (32|64) - F_MALLOC_OPTIMIZE_FACTOR
+ => 18 hash buckets on 32 bits and 50 buckets on 64 bits
+ The free hash bitmap is used to jump directly to non-empty
+ hash buckets.
+ */
+ do {
+ for(f=&(qm->free_hash[hash].first);(*f); f=&((*f)->u.nxt_free))
+ if ((*f)->size>=size) goto found;
+ hash++; /* try in next hash cell */
+ }while((hash < F_HASH_SIZE) &&
+ ((hash=fm_bmp_first_set(qm, hash)) >= 0));
}
#else /* F_MALLOC_HASH_BITMAP */
for(hash=GET_HASH(size);hash<F_HASH_SIZE;hash++){
Hello,
I published a tutorial of how to implement a SIP SIMPLE Presence & XCAP
server with latest Kamailio/SER version. You can find it at:
http://bit.ly/btrJij
Last build of SIP Communicator softphone was used to exemplify some use
cases.
xcap_server is a new module in upcoming v3.1.0, I have tested it with
several SIP clients, but I have to say is not easy to find one that
implements many presence & xcap extensions (filled already couple of
bugs so far). So consider it a young component by now, however, with it
inside our SIP server, deploying a SIP presence server becomes trivial.
Hope is helpful,
Daniel
--
Daniel-Constantin Mierla
http://www.asipto.com
Hi!
Recently Asterisk implemented authentication of incoming OPTIONS
request. This means, that OPTIONS might be challenged - responding with
401/407.
Currently, the respone codes which are accept by dispatcher module as
SUCCESS are hard coded. Maybe there should be a configuration option to
configure SUCCESS response code.
regards
klaus
-------- Original-Nachricht --------
Betreff: Re: [asterisk-dev] [Code Review] SIP: authenticate OPTIONS
requests just like we would an INVITE
Datum: Fri, 3 Sep 2010 13:07:18 -0500 (CDT)
Von: David Vossel <dvossel(a)digium.com>
Antwort an: Asterisk Developers Mailing List <asterisk-dev(a)lists.digium.com>
An: Asterisk Developers Mailing List <asterisk-dev(a)lists.digium.com>
----- Original Message -----
> From: "Klaus Darilion" <klaus.mailinglists(a)pernau.at>
> To: "Asterisk Developers Mailing List" <asterisk-dev(a)lists.digium.com>
> Cc: "Olle E. Johansson" <oej(a)edvina.net>
> Sent: Wednesday, September 1, 2010 12:53:41 PM
> Subject: Re: [asterisk-dev] [Code Review] SIP: authenticate OPTIONS requests just like we would an INVITE
> looks like 401 will be an error, only 200, 501, 403 and 405 will be
> accepted. So we have to add 401 for Asterisk? ;-)
>
Yes, it appears the 401 response will have to be added there. Do you
have commit access to this project? How can we get that done?
David Vossel
Digium, Inc. | Software Developer, Open Source Software
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: www.digium.com & www.asterisk.org
The_Boy_Wonder in #asterisk-dev
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-dev
Module: sip-router
Branch: master
Commit: 671bc7b32097bb690a95253e9585236e99b67310
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=671bc7b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Sep 30 00:17:35 2010 +0200
dispatcher(k): regenerated readme file
---
modules_k/dispatcher/README | 116 ++++++++++++++++++++++++++-----------------
1 files changed, 70 insertions(+), 46 deletions(-)
diff --git a/modules_k/dispatcher/README b/modules_k/dispatcher/README
index f5fabd3..78d0b8c 100644
--- a/modules_k/dispatcher/README
+++ b/modules_k/dispatcher/README
@@ -56,12 +56,13 @@ Carsten Bock
3.19. ds_ping_from (string)
3.20. ds_ping_interval (int)
3.21. ds_probing_threshhold (int)
- 3.22. ds_probing_mode (int)
- 3.23. ds_append_branch (int)
- 3.24. ds_hash_size (int)
- 3.25. ds_hash_expire (int)
- 3.26. ds_hash_initexpire (int)
- 3.27. ds_hash_check_interval (int)
+ 3.22. ds_ping_reply_codes (string)
+ 3.23. ds_probing_mode (int)
+ 3.24. ds_append_branch (int)
+ 3.25. ds_hash_size (int)
+ 3.26. ds_hash_expire (int)
+ 3.27. ds_hash_initexpire (int)
+ 3.28. ds_hash_check_interval (int)
4. Exported Functions
@@ -113,16 +114,17 @@ Carsten Bock
1.20. Set the “ds_ping_from” parameter
1.21. Set the “ds_ping_interval” parameter
1.22. Set the “ds_probing_threshhold” parameter
- 1.23. Set the “ds_probing_mode” parameter
- 1.24. Set the “ds_append_branch” parameter
- 1.25. Set the “ds_hash_size” parameter
- 1.26. Set the “ds_hash_expire” parameter
- 1.27. Set the “ds_hash_initexpire” parameter
- 1.28. Set the “ds_hash_check_interval” parameter
- 1.29. ds_select_dst usage
- 1.30. ds_load_unset usage
- 1.31. dispatcher list file
- 1.32. Kamailio config script - sample dispatcher usage
+ 1.23. Set the “ds_ping_reply_codes” parameter
+ 1.24. Set the “ds_probing_mode” parameter
+ 1.25. Set the “ds_append_branch” parameter
+ 1.26. Set the “ds_hash_size” parameter
+ 1.27. Set the “ds_hash_expire” parameter
+ 1.28. Set the “ds_hash_initexpire” parameter
+ 1.29. Set the “ds_hash_check_interval” parameter
+ 1.30. ds_select_dst usage
+ 1.31. ds_load_unset usage
+ 1.32. dispatcher list file
+ 1.33. Kamailio config script - sample dispatcher usage
Chapter 1. Admin Guide
@@ -157,12 +159,13 @@ Chapter 1. Admin Guide
3.19. ds_ping_from (string)
3.20. ds_ping_interval (int)
3.21. ds_probing_threshhold (int)
- 3.22. ds_probing_mode (int)
- 3.23. ds_append_branch (int)
- 3.24. ds_hash_size (int)
- 3.25. ds_hash_expire (int)
- 3.26. ds_hash_initexpire (int)
- 3.27. ds_hash_check_interval (int)
+ 3.22. ds_ping_reply_codes (string)
+ 3.23. ds_probing_mode (int)
+ 3.24. ds_append_branch (int)
+ 3.25. ds_hash_size (int)
+ 3.26. ds_hash_expire (int)
+ 3.27. ds_hash_initexpire (int)
+ 3.28. ds_hash_check_interval (int)
4. Exported Functions
@@ -236,12 +239,13 @@ Chapter 1. Admin Guide
3.19. ds_ping_from (string)
3.20. ds_ping_interval (int)
3.21. ds_probing_threshhold (int)
- 3.22. ds_probing_mode (int)
- 3.23. ds_append_branch (int)
- 3.24. ds_hash_size (int)
- 3.25. ds_hash_expire (int)
- 3.26. ds_hash_initexpire (int)
- 3.27. ds_hash_check_interval (int)
+ 3.22. ds_ping_reply_codes (string)
+ 3.23. ds_probing_mode (int)
+ 3.24. ds_append_branch (int)
+ 3.25. ds_hash_size (int)
+ 3.26. ds_hash_expire (int)
+ 3.27. ds_hash_initexpire (int)
+ 3.28. ds_hash_check_interval (int)
3.1. list_file (string)
@@ -531,7 +535,8 @@ Note
If you want to set a gateway into probing mode, you will need a
specific number of requests until it will change from "active" to
- probing. The number of attempts can be set with this parameter.
+ probing. The number of attempts can be set with this parameter. This
+ parameter can be modified via ser config framework.
Default value is “3”.
@@ -540,7 +545,25 @@ Note
modparam("dispatcher", "ds_probing_threshhold", 10)
...
-3.22. ds_probing_mode (int)
+3.22. ds_ping_reply_codes (string)
+
+ This parameter defines the valid response codes, which are accepted as
+ a valid reply to the PING-Method. It is a list separated by colons,
+ whery you may define either a single code (e.g. "code=202" would accept
+ 202 as an additional, valid response) or a class of responses, you want
+ to accept (e.g. "class=2" would accept everything from 200 to 299 as
+ valid response). This parameter can be modified via ser config
+ framework.
+
+ Default value is “” (only 200 OK is accepted).
+
+ Example 1.23. Set the “ds_ping_reply_codes” parameter
+ ...
+ modparam("dispatcher", "ds_ping_reply_codes", "class=2;code=403;code=488;class=
+3")
+ ...
+
+3.23. ds_probing_mode (int)
Controls what gateways are tested to see if they are reachable. If set
to 0, only the gateways with state PROBING are tested, if set to 1, all
@@ -549,12 +572,12 @@ Note
Default value is “0”.
- Example 1.23. Set the “ds_probing_mode” parameter
+ Example 1.24. Set the “ds_probing_mode” parameter
...
modparam("dispatcher", "ds_probing_mode", 1)
...
-3.23. ds_append_branch (int)
+3.24. ds_append_branch (int)
If set to 1, functions will automaticall append a new branch if called
in FAILURE_ROUTE. If set to 0, script writer has to call
@@ -562,12 +585,12 @@ Note
Default value is “1”.
- Example 1.24. Set the “ds_append_branch” parameter
+ Example 1.25. Set the “ds_append_branch” parameter
...
modparam("dispatcher", "ds_append_branch", 0)
...
-3.24. ds_hash_size (int)
+3.25. ds_hash_size (int)
The value to be used as power of two to set the number of slots to hash
table storing data for call load dispatching (e.g., value 8 will create
@@ -576,24 +599,24 @@ Note
Default value is “0”.
- Example 1.25. Set the “ds_hash_size” parameter
+ Example 1.26. Set the “ds_hash_size” parameter
...
modparam("dispatcher", "ds_hash_size", 9)
...
-3.25. ds_hash_expire (int)
+3.26. ds_hash_expire (int)
Expiration time in seconds to remove the load on a destination if no
BYE was received meanwhile.
Default value is “7200”.
- Example 1.26. Set the “ds_hash_expire” parameter
+ Example 1.27. Set the “ds_hash_expire” parameter
...
modparam("dispatcher", "ds_hash_expire", 3600)
...
-3.26. ds_hash_initexpire (int)
+3.27. ds_hash_initexpire (int)
Expiration time in seconds to remove the load on a destination if no
200 for INVITE was received meanwhile and state updated with
@@ -601,19 +624,19 @@ Note
Default value is “7200”.
- Example 1.27. Set the “ds_hash_initexpire” parameter
+ Example 1.28. Set the “ds_hash_initexpire” parameter
...
modparam("dispatcher", "ds_hash_initexpire", 60)
...
-3.27. ds_hash_check_interval (int)
+3.28. ds_hash_check_interval (int)
Time interval in seconds to scan internal hash table with call load
dispatching data for expired items.
Default value is “30”.
- Example 1.28. Set the “ds_hash_check_interval” parameter
+ Example 1.29. Set the “ds_hash_check_interval” parameter
...
modparam("dispatcher", "ds_hash_check_interval", 60)
...
@@ -680,7 +703,7 @@ Note
This function can be used from REQUEST_ROUTE.
- Example 1.29. ds_select_dst usage
+ Example 1.30. ds_select_dst usage
...
ds_select_dst("1", "0");
...
@@ -776,7 +799,7 @@ ds_select_dst("1", "$var(a)");
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
BRANCH_ROUTE and ONREPLY_ROUTE.
- Example 1.30. ds_load_unset usage
+ Example 1.31. ds_load_unset usage
...
route {
...
@@ -884,14 +907,15 @@ setid(int) destination(sip uri) flags(int,opt) priority(int,opt) attrs(str,opt)
For database, each element of a line resides in a different column.
Next is a dispatcher.list file example:
- Example 1.31. dispatcher list file
+ Example 1.32. dispatcher list file
...
# $Id$
# dispatcher destination sets
#
# line format
-# setit(integer) destination(sip uri) flags (integer, optional)
+# setit(int) destination(sip uri) flags(int,opt) priority(int,opt) attributes(st
+r,opt)
# proxies
2 sip:127.0.0.1:5080
@@ -908,7 +932,7 @@ setid(int) destination(sip uri) flags(int,opt) priority(int,opt) attrs(str,opt)
Next picture displays a sample usage of dispatcher.
- Example 1.32. Kamailio config script - sample dispatcher usage
+ Example 1.33. Kamailio config script - sample dispatcher usage
...
# $Id$
# sample config file for dispatcher module