andrei 2009/07/17 15:37:11 CEST
SER CVS Repository
Modified files:
. cfg.lex cfg.y
Log:
core: config parser listen if names fix
If no quotes were used in listen=x, it was assumed that x was an
ip or a valid hostname (each domain part starts with a letter,
numbers and '_' are not allowed as first chars). However this
assumption failed when interface names were used, e.g. eth0.1 is a
valid interface name, but listen=eth0.1 resulted in error (it
worked only if quotes were used, e.g. listen="eth0.1").
Revision Changes Path
1.126 +30 -13 sip_router/cfg.lex
http://cvs.berlios.de/cgi-bin/viewcvs.cgi/ser/sip_router/cfg.lex.diff?r1=1.…
1.184 +36 -4 sip_router/cfg.y
http://cvs.berlios.de/cgi-bin/viewcvs.cgi/ser/sip_router/cfg.y.diff?r1=1.18…
andrei 2009/07/17 15:37:02 CEST
SER CVS Repository
Modified files:
. cfg.y
Log:
core: config parser listen fix
- do not crash when the listen=host line contains an invalid host (e.g. foo.1)
- more null checks
Reported-by: Cristian Constantin cristian.constantin at iptel org
Revision Changes Path
1.183 +45 -32 sip_router/cfg.y
http://cvs.berlios.de/cgi-bin/viewcvs.cgi/ser/sip_router/cfg.y.diff?r1=1.18…
Module: sip-router
Branch: master
Commit: dd5490500f006f86e520958c5ca2646a1e3a96b7
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=dd54905…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Fri Jul 17 00:15:39 2009 +0200
domain: API framework to be used by other modules
Add a new data structure and function bind_domain that can be used by
other modules to gain access to internal functions of domain module.
Implement inline function load_domain_api that does everything that
is necessary to make the API of the domain module available to the
caller.
---
modules_s/domain/domain_api.c | 35 ++++++++++++++++++++++++++
modules_s/domain/domain_api.h | 54 +++++++++++++++++++++++++++++++++++++++++
modules_s/domain/domain_mod.c | 2 +
3 files changed, 91 insertions(+), 0 deletions(-)
diff --git a/modules_s/domain/domain_api.c b/modules_s/domain/domain_api.c
new file mode 100644
index 0000000..c88e5c8
--- /dev/null
+++ b/modules_s/domain/domain_api.c
@@ -0,0 +1,35 @@
+/*
+ * Domain module internal API
+ *
+ * Copyright (C) 2002-2003 Juha Heinanen
+ *
+ * This file is part of sip-router, a free SIP server.
+ *
+ * sip-router is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version
+ *
+ * sip-router is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "domain_api.h"
+#include "../../dprint.h"
+#include "domain.h"
+
+
+int bind_domain(domain_api_t* api)
+{
+ if (api == NULL) {
+ ERR("Invalid parameter value\n");
+ return -1;
+ }
+ return 0;
+}
diff --git a/modules_s/domain/domain_api.h b/modules_s/domain/domain_api.h
new file mode 100644
index 0000000..16ddd1f
--- /dev/null
+++ b/modules_s/domain/domain_api.h
@@ -0,0 +1,54 @@
+/*
+ * Domain module internal API
+ *
+ * Copyright (C) 2002-2003 Juha Heinanen
+ *
+ * This file is part of sip-router, a free SIP server.
+ *
+ * sip-router is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version
+ *
+ * sip-router is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _DOMAIN_API_H
+#define _DOMAIN_API_H
+
+#include "../../sr_module.h"
+#include "../../dprint.h"
+
+typedef struct domain_api {
+
+} domain_api_t;
+
+typedef int (*bind_domain_f)(domain_api_t* api);
+int bind_domain(domain_api_t* api);
+
+static inline int load_domain_api(domain_api_t* api)
+{
+ bind_domain_f bind_domain;
+
+ bind_domain = (bind_domain_f)find_export("bind_domain", 0, 0);
+
+ if (bind_domain == NULL) {
+ ERR("Cannot import bind_domain function from domain module\n");
+ return -1;
+ }
+
+ if (bind_domain(api) == -1) {
+ return -1;
+ }
+ return 0;
+}
+
+
+#endif /* _DOMAIN_API_H */
diff --git a/modules_s/domain/domain_mod.c b/modules_s/domain/domain_mod.c
index 957973f..c7e0515 100644
--- a/modules_s/domain/domain_mod.c
+++ b/modules_s/domain/domain_mod.c
@@ -38,6 +38,7 @@
#include "../../parser/parse_from.h"
#include "../../parser/parse_uri.h"
#include "../../usr_avp.h"
+#include "domain_api.h"
#include "domain_rpc.h"
#include "hash.h"
#include "domain.h"
@@ -124,6 +125,7 @@ static cmd_export_t cmds[] = {
{"lookup_domain", lookup_domain, 2, lookup_domain_fixup,
REQUEST_ROUTE|FAILURE_ROUTE },
{"get_did", (cmd_function)get_did, 0, 0, 0},
+ {"bind_domain", (cmd_function)bind_domain, 0, 0, 0},
{0, 0, 0, 0, 0}
};
Module: sip-router
Branch: master
Commit: c4dbb39571c5e8d801956d8afc5134387de1a59a
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c4dbb39…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Fri Jul 17 11:34:24 2009 +0200
domain: Documentation of internal API
Add docbook documentation for the internal API of domain module.
---
modules_s/domain/doc/domain.xml | 1 +
modules_s/domain/doc/domain_api.xml | 47 +++++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/modules_s/domain/doc/domain.xml b/modules_s/domain/doc/domain.xml
index 0e4879f..9c8aa57 100644
--- a/modules_s/domain/doc/domain.xml
+++ b/modules_s/domain/doc/domain.xml
@@ -241,5 +241,6 @@ iptel
<xi:include href="params.xml"/>
<xi:include href="functions.xml"/>
<xi:include href="fifo.xml"/>
+ <xi:include href="domain_api.xml"/>
</section>
diff --git a/modules_s/domain/doc/domain_api.xml b/modules_s/domain/doc/domain_api.xml
new file mode 100644
index 0000000..27c2c10
--- /dev/null
+++ b/modules_s/domain/doc/domain_api.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<section id="domain.api" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <title>Internal API</title>
+ <para>The domain module has an internal API which can be used to access
+ additional functions of the module (i.e. functions that are normally not
+ available from the routing script). Currently the API exports only the
+ function <function>is_domain_local</function>. That function can be used
+ to determine whether a given domain name is on the list of locally
+ configured domain names.</para>
+
+ <para>If you want to use the internal API of domain module from your
+ module then you need to include the header file
+ <filename>domain_api.h</filename> and call
+ <function>load_domain_api</function> first.</para>
+
+ <example>
+ <title>Calling <function>load_domain_api</function></title>
+ <programlisting>
+#include "../domain/domain_api.h"
+
+domain_api_t dom_api;
+
+if (load_domain_api(&dom_api) != 0) {
+ /* error */
+}
+</programlisting>
+ </example>
+
+ <para>After that you can call function
+ <function>is_domain_local</function> whose pointer is stored in the
+ initialized data structure:</para>
+
+ <programlisting>
+str tmp = STR_STATIC_INIT("mydomain.com");
+
+if (dom_api.is_domain_local(&tmp) == 1) {
+ /* Domain is local */
+} else {
+ /* Domain is not local or an error was encountered */
+}
+ </programlisting>
+</section>
+
+
\ No newline at end of file
Module: sip-router
Branch: master
Commit: d8fdebf9c589516185d5c6a4ff9453148f1b76f2
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d8fdebf…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Fri Jul 17 11:10:51 2009 +0200
domain: Add internal function is_domain_local
Add internal function is_domain_local that can be used to determine if
the domain name given in parameter is on the list of local domains. The
comparison of the domain name is always case insensitive.
There already is is_local function that does something similar, so we
can reuse the code from that function. is_domain_local takes a pointer
to str as parameter and this function is then called by is_local which
takes all the usual parameters that function which can be called from
the script take.
Finally, is_domain_local is exported through the internal API of the
domain module.
Function is_domain_local is now located in file domain.c and because of
db_get_did was also moved to file domain.c
---
modules_s/domain/domain.c | 104 +++++++++++++++++++++++++++++++++++++++++
modules_s/domain/domain.h | 17 +++++++
modules_s/domain/domain_api.c | 1 +
modules_s/domain/domain_api.h | 3 +-
modules_s/domain/domain_mod.c | 91 +-----------------------------------
5 files changed, 126 insertions(+), 90 deletions(-)
diff --git a/modules_s/domain/domain.c b/modules_s/domain/domain.c
index cd347bf..cb5cb32 100644
--- a/modules_s/domain/domain.c
+++ b/modules_s/domain/domain.c
@@ -22,6 +22,7 @@
#include <string.h>
#include "domain_mod.h"
+#include "hash.h"
#include "../../dprint.h"
#include "../../mem/shm_mem.h"
#include "../../lib/srdb2/db.h"
@@ -308,3 +309,106 @@ int load_domains(domain_t** dest)
free_domain_list(list);
return 1;
}
+
+
+/* Retrieve did directly from database, without using memory cache. Use 0 as
+ * the value of first parameter if you only want to know whether the entry is
+ * in the database. The function returns 1 if there is such entry, 0 if not,
+ * and -1 on error. The result is allocated using pkg_malloc and must be
+ * freed.
+ */
+int db_get_did(str* did, str* domain)
+{
+ db_res_t* res = NULL;
+ db_rec_t* rec;
+
+ if (!domain) {
+ ERR("BUG:Invalid parameter value\n");
+ goto err;
+ }
+
+ get_did_cmd->match[0].v.lstr = *domain;
+
+ if (db_exec(&res, get_did_cmd) < 0) {
+ ERR("Error in database query\n");
+ goto err;
+ }
+
+ rec = db_first(res);
+ if (rec) {
+ /* Test flags first, we are only interested in rows
+ * that are not disabled
+ */
+ if (rec->fld[1].flags & DB_NULL || (rec->fld[1].v.bitmap &
+ SRDB_DISABLED)) {
+ db_res_free(res);
+ return 0;
+ }
+
+ if (did) {
+ if (rec->fld[0].flags & DB_NULL) {
+ did->len = 0;
+ did->s = 0;
+ WARN("Domain '%.*s' has NULL did\n",
+ domain->len, ZSW(domain->s));
+ } else {
+ did->s = pkg_malloc(rec->fld[0].v.lstr.len);
+ if (!did->s) {
+ ERR("No memory left\n");
+ goto err;
+ }
+ memcpy(did->s, rec->fld[0].v.lstr.s, rec->fld[0].v.lstr.len);
+ did->len = rec->fld[0].v.lstr.len;
+ }
+ }
+
+ db_res_free(res);
+ return 1;
+ } else {
+ db_res_free(res);
+ return 0;
+ }
+
+ err:
+ if (res) db_res_free(res);
+ return -1;
+}
+
+
+/* Check if the domain name given in the parameter is one
+ * of the locally configured domain names.
+ * Returns 1 if yes and -1 otherwise
+ */
+int is_domain_local(str* domain)
+{
+ str tmp;
+
+ /* Make a temporary copy, domain name comparisons are always
+ * case insensitive
+ */
+ tmp.s = pkg_malloc(domain->len);
+ if (!tmp.s) {
+ ERR("No memory left\n");
+ return -1;
+ }
+ memcpy(tmp.s, domain->s, domain->len);
+ tmp.len = domain->len;
+ strlower(&tmp);
+
+ if (!db_mode) {
+ switch(db_get_did(0, &tmp)) {
+ case 1: goto found;
+ default: goto not_found;
+ }
+ } else {
+ if (hash_lookup(0, *active_hash, &tmp) == 1) goto found;
+ else goto not_found;
+ }
+
+ found:
+ pkg_free(tmp.s);
+ return 1;
+ not_found:
+ pkg_free(tmp.s);
+ return -1;
+}
diff --git a/modules_s/domain/domain.h b/modules_s/domain/domain.h
index d79a593..e0d0d37 100644
--- a/modules_s/domain/domain.h
+++ b/modules_s/domain/domain.h
@@ -72,4 +72,21 @@ void free_domain_list(domain_t* list);
typedef int (*domain_get_did_t)(str* did, str* domain);
+
+/* Retrieve did directly from database, without using memory cache. Use 0 as
+ * the value of first parameter if you only want to know whether the entry is
+ * in the database. The function returns 1 if there is such entry, 0 if not,
+ * and -1 on error. The result is allocated using pkg_malloc and must be
+ * freed.
+ */
+int db_get_did(str* did, str* domain);
+
+/* Check if the domain name given in the parameter is one
+ * of the locally configured domain names.
+ * Returns 1 if yes and -1 otherwise
+ */
+typedef int (*is_domain_local_f)(str* domain);
+int is_domain_local(str* domain);
+
+
#endif /* _DOMAIN_H */
diff --git a/modules_s/domain/domain_api.c b/modules_s/domain/domain_api.c
index c88e5c8..0996c67 100644
--- a/modules_s/domain/domain_api.c
+++ b/modules_s/domain/domain_api.c
@@ -31,5 +31,6 @@ int bind_domain(domain_api_t* api)
ERR("Invalid parameter value\n");
return -1;
}
+ api->is_domain_local = is_domain_local;
return 0;
}
diff --git a/modules_s/domain/domain_api.h b/modules_s/domain/domain_api.h
index 16ddd1f..2882332 100644
--- a/modules_s/domain/domain_api.h
+++ b/modules_s/domain/domain_api.h
@@ -25,9 +25,10 @@
#include "../../sr_module.h"
#include "../../dprint.h"
+#include "domain.h"
typedef struct domain_api {
-
+ is_domain_local_f is_domain_local;
} domain_api_t;
typedef int (*bind_domain_f)(domain_api_t* api);
diff --git a/modules_s/domain/domain_mod.c b/modules_s/domain/domain_mod.c
index c7e0515..e5d5cb0 100644
--- a/modules_s/domain/domain_mod.c
+++ b/modules_s/domain/domain_mod.c
@@ -381,107 +381,20 @@ static void destroy(void)
}
-/* Retrieve did directly from database, without using memory cache. Use 0 as
- * the value of first parameter if you only want to know whether the entry is
- * in the database. The function returns 1 if there is such entry, 0 if not,
- * and -1 on error. The result is allocated using pkg_malloc and must be
- * freed.
- */
-static int db_get_did(str* did, str* domain)
-{
- db_res_t* res = NULL;
- db_rec_t* rec;
-
- if (!domain) {
- ERR("BUG:Invalid parameter value\n");
- goto err;
- }
-
- get_did_cmd->match[0].v.lstr = *domain;
-
- if (db_exec(&res, get_did_cmd) < 0) {
- ERR("Error in database query\n");
- goto err;
- }
-
- rec = db_first(res);
- if (rec) {
- /* Test flags first, we are only interested in rows
- * that are not disabled
- */
- if (rec->fld[1].flags & DB_NULL || (rec->fld[1].v.bitmap &
- SRDB_DISABLED)) {
- db_res_free(res);
- return 0;
- }
-
- if (did) {
- if (rec->fld[0].flags & DB_NULL) {
- did->len = 0;
- did->s = 0;
- WARN("Domain '%.*s' has NULL did\n",
- domain->len, ZSW(domain->s));
- } else {
- did->s = pkg_malloc(rec->fld[0].v.lstr.len);
- if (!did->s) {
- ERR("No memory left\n");
- goto err;
- }
- memcpy(did->s, rec->fld[0].v.lstr.s, rec->fld[0].v.lstr.len);
- did->len = rec->fld[0].v.lstr.len;
- }
- }
-
- db_res_free(res);
- return 1;
- } else {
- db_res_free(res);
- return 0;
- }
-
- err:
- if (res) db_res_free(res);
- return -1;
-}
-
/*
* Check if domain is local
*/
static int is_local(struct sip_msg* msg, char* fp, char* s2)
{
- str domain, tmp;
+ str domain;
if (get_str_fparam(&domain, msg, (fparam_t*)fp) != 0) {
ERR("Unable to get domain to check\n");
return -1;
}
- tmp.s = pkg_malloc(domain.len);
- if (!tmp.s) {
- ERR("No memory left\n");
- return -1;
- }
- memcpy(tmp.s, domain.s, domain.len);
- tmp.len = domain.len;
- strlower(&tmp);
-
- if (!db_mode) {
- switch(db_get_did(0, &tmp)) {
- case 1: goto found;
- default: goto not_found;
- }
- } else {
- if (hash_lookup(0, *active_hash, &tmp) == 1) goto found;
- else goto not_found;
- }
-
- found:
- pkg_free(tmp.s);
- return 1;
- not_found:
- pkg_free(tmp.s);
- return -1;
+ return is_domain_local(&domain);
}
Module: sip-router
Branch: master
Commit: 04938dc72661dfe0c8954f392558812f7aa3da78
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=04938dc…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Jul 16 14:05:50 2009 +0200
core: futexlock include hack for older futex.h
Older non-fixed linux/futex.h version (<2.6.20) cannot be included from
userspace without additional type declarations (which otherwise
are included only if __KERNEL__ is defined).
Note that most distribution fix this problem by distributing a
modified /usr/include/linux/futex.h and not the default kernel
one. However there are other distributions (like CentOS 5) for
which this hack is needed.
---
futexlock.h | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/futexlock.h b/futexlock.h
index 19e816d..df93b81 100644
--- a/futexlock.h
+++ b/futexlock.h
@@ -49,6 +49,12 @@
between linux-libc-dev andlibc headers
in recent (6.08.2008) x86_64 debian sid
installations */
+/* hack to work with old linux/futex.h versions, that depend on sched.h in
+ __KERNEL__ mode (futex.h < 2.6.20) */
+#include <linux/types.h>
+typedef __u32 u32;
+struct task_struct;
+/* end of the hack */
#include <linux/futex.h>
#include <sys/syscall.h>
#include <unistd.h>
Bugs item #2822344, was opened at 2009-07-16 11:06
Message generated for change (Tracker Item Submitted) made by axlh
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=743020&aid=2822344&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: ver 1.4.x
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Alex Hermann (axlh)
Assigned to: Nobody/Anonymous (nobody)
Summary: Branch route has wrong ruri or missing headers
Initial Comment:
The scenario:
In branch route, I rewrite the ruri and add an additional header. When the destination fails and DNS-based failover takes place, the branch route is called again. For this second branch, the ruri is not the same as the ruri at t_relay time. Also the extra header is missing.
So this bug could be either:
- The ruri and rest of variables/packet for each branch should be the same as the ruri at t_relay time
or
- The header added in the first branch route should also be present for the second branch (in the case of DNS-based failover)
I would either expect the ruri and all other variables and headers to be exactly the same as at t_relay time for each branch, or (for DNS-based failover ONLY) the packet sent to a failover destination to be exactly the same as the first branch (including any added headers / from replacement, etc.) Not a mix of both.
Before t_relay:
$rU = "*1234567890"
t_relay("0x03");
my branch route:
xlog("L_NOTICE", "Branch: <$ru> via <$du>\n");
if (is_method("INVITE") and $(rU{s.substr,0,3}) == "*12") {
strip(3);
append_hf("X-Test: 12\r\n");
}
The log:
Jul 15 09:14:38 Branch: <sip:*1234567890@test.domain;transport=udp> via <<null>>
Jul 15 09:14:38 Reply Status: 503 Service Unavailable
Jul 15 09:14:38 Branch: <sip:234567890@test.domain;transport=udp> via <<null>>
Jul 15 09:14:38 Reply Status: 100 Trying
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=743020&aid=2822344&group_…
Module: sip-router
Branch: master
Commit: d6e8fdb3a06aab44c01ce5e5a2ca4f2d43117676
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d6e8fdb…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Thu Jul 16 10:38:14 2009 +0200
xmlrpc(s) doc: added the autoconversion parameter
---
modules_s/xmlrpc/doc/params.xml | 29 ++++++++++++++++++++++++++++-
1 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/modules_s/xmlrpc/doc/params.xml b/modules_s/xmlrpc/doc/params.xml
index 324495d..be7fd63 100644
--- a/modules_s/xmlrpc/doc/params.xml
+++ b/modules_s/xmlrpc/doc/params.xml
@@ -41,8 +41,35 @@ modparam("xmlrpc", "route", "route_for_xmlrpcs")
</example>
</section>
+ <section id="autoconversion">
+ <title><varname>autoconversion</varname> (string)</title>
+ <para>
+ Enable or disable automatic parameter type conversion globally,
+ for all the methods parameters.
+ If on, a type mismatch in a method parameter
+ will not cause a fault if it is possible to automatically
+ convert it to the type expected by the method.
+ </para>
+ <para>
+ Default: off.
+ </para>
+ <para>
+ It is recommended to leave this parameter to its default off value
+ and fix instead the client application (which should use the
+ proper types) or to modify the target rpc to accept any type
+ (see the rpc scan '.' modifier).
+ </para>
+ <example>
+ <title>Set the <varname>autoconversion</varname> parameter</title>
+ <programlisting>
+modparam("xmlrpc", "autoconversion", 1)
+ </programlisting>
+ </example>
+ </section>
+
<!--
- Seems to be obsolete (on always) -andrei
+ Obsolete (hardwired on in the rpc core functions, cannot be turned off)
+ -andrei
<section id="enable_introspection">
<title><varname>enable_introspection</varname> (integer)</title>
<para>