THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#83 - ds_reload fails (MySQL backend)
User who did this - Daniel-Constantin Mierla (miconda)
----------
Is it 3.0.2 from tarball/packages or is latest git branch kamailio_30?
----------
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=83#comment107
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
A new Flyspray task has been opened. Details are below.
User who did this - Kim Jakobsson (kjakobsson)
Attached to Project - sip-router
Summary - ds_reload fails (MySQL backend)
Task Type - Bug Report
Category - Module
Status - Unconfirmed
Assigned To -
Operating System - Linux
Severity - Medium
Priority - Normal
Reported Version - Development
Due in Version - Undecided
Due Date - Undecided
Details - - Kamailio v3.0.2.
- dispathcer module with mysql backend
- Kamailio starts up ok and ds_select_domain() works.
When trying to issue 'ds_reload' with sercmd, the reload fails.
Module configuration:
modparam("dispatcher", "db_url", "mysql://openser:openserrw@localhost/openser")
> **> sercmd mi_fifo ds_list**
>200 OK
SET_NO:: 1
SET:: 1
URI:: sip:127.0.0.1:5060 flag=A
> **> sercmd mi_fifo ds_reload**
>500 ERROR Reloading data
> **> tail -1 /var/log/kamailio.log**
>ERROR: dispatcher [dispatch.c:555]: invalid DB handler
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=83
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
Module: sip-router
Branch: andrei/raw_sock
Commit: fbf0d2e03c019e51281ce569b93843ab0577cc0f
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=fbf0d2e…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Tue Aug 10 11:20:26 2010 +0200
cfg: delay cfg_shmize to just before forking
cfg_shmize() delayed to allow late changes in the default config
(any changes in the default config after cfg_shmize() are ignored).
---
main.c | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/main.c b/main.c
index d157a6b..9b594a0 100644
--- a/main.c
+++ b/main.c
@@ -1285,6 +1285,15 @@ int main_loop()
" (no fork)\n");
}
+ /* delay cfg_shmize to the last moment (it must be called _before_
+ forking). Changes to default cfgs after this point will be
+ ignored.
+ */
+ if (cfg_shmize() < 0) {
+ LOG(L_CRIT, "could not initialize shared configuration\n");
+ goto error;
+ }
+
/* Register the children that will keep updating their
* local configuration */
cfg_register_child(
@@ -1503,6 +1512,14 @@ int main_loop()
* sending) so we open all first*/
if (do_suid()==-1) goto error; /* try to drop privileges */
+ /* delay cfg_shmize to the last moment (it must be called _before_
+ forking). Changes to default cfgs after this point will be
+ ignored (cfg_shmize() will copy the default cfgs into shmem).
+ */
+ if (cfg_shmize() < 0) {
+ LOG(L_CRIT, "could not initialize shared configuration\n");
+ goto error;
+ }
/* 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
@@ -2328,11 +2345,6 @@ try_select_again: tval.tv_usec = 0;
goto error;
}
- if (cfg_shmize() < 0) {
- LOG(L_CRIT, "could not initialize shared configuration\n");
- goto error;
- }
-
/* initialize process_table, add core process no. (calc_proc_no()) to the
* processes registered from the modules*/
if (init_pt(calc_proc_no())==-1)
Module: sip-router
Branch: andrei/raw_sock
Commit: 53cc96bd61778fec14ebabd6a6182313bb778aa9
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=53cc96b…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Tue Aug 10 11:16:38 2010 +0200
core: always compile the raw sockets code on linux
Raw sockets support is compiled always on linux.
Note that while the code is there, one still needs to explicitly
enable them in ser.cfg or at runtime (e.g. setting udp4_raw = 1 at
runtime will switch to using raw sockets for sending if possible).
---
Makefile.defs | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Makefile.defs b/Makefile.defs
index 1eb19f5..4cc1ee6 100644
--- a/Makefile.defs
+++ b/Makefile.defs
@@ -1628,7 +1628,7 @@ ifeq ($(OS), linux)
use_futex= yes
C_DEFS+=-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
-DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \
- -DHAVE_TIMEGM -DHAVE_SCHED_SETSCHEDULER
+ -DHAVE_TIMEGM -DHAVE_SCHED_SETSCHEDULER -DUSE_RAW_SOCKS
ifneq ($(found_lock_method), yes)
#C_DEFS+= -DUSE_POSIX_SEM
C_DEFS+=-DUSE_PTHREAD_MUTEX
Module: sip-router
Branch: andrei/raw_sock
Commit: 9eb54078fd76b53f27cb57a13ccae9e14e3b5237
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9eb5407…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Tue Aug 10 11:09:19 2010 +0200
raw sockets: ttl can be set or auto-detected
The IP TTL used when sending on raw sockets can be set using the
core.udp4_raw_ttl config variable.
By default it is auto-detected on startup (the same IP TTL as the
one for the first udp4 socket is used).
---
cfg_core.c | 24 ++++++++++++++++++++
cfg_core.h | 1 +
main.c | 16 +++++++++++++
raw_sock.c | 9 +++----
sock_ut.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sock_ut.h | 39 +++++++++++++++++++++++++++++++++
6 files changed, 155 insertions(+), 5 deletions(-)
diff --git a/cfg_core.c b/cfg_core.c
index 7f2018c..88f234f 100644
--- a/cfg_core.c
+++ b/cfg_core.c
@@ -56,6 +56,8 @@
#include "pt.h"
#endif
#include "msg_translator.h" /* fix_global_req_flags() */
+#include "globals.h"
+#include "sock_ut.h"
#include "cfg/cfg.h"
#include "cfg_core.h"
@@ -113,6 +115,7 @@ struct cfg_group_core default_core_cfg = {
0, /*!< udp_mtu_try_proto -> default disabled */
0, /**< udp4_raw (disabled by default) */
1500, /**< udp4_raw_mtu (1500 by default) */
+ -1, /**< udp4_raw_ttl (auto detect by default) */
0, /*!< force_rport */
L_DBG, /*!< memlog */
1 /*!< mem_summary -flags: 0 off, 1 shm/pkg_status, 2 shm/pkg_sums */
@@ -153,6 +156,24 @@ static int check_raw_sock_support(void* cfg_h, str* gname, str* name,
+static int udp4_raw_ttl_fixup(void* cfg_h, str* gname, str* name, void** val)
+{
+ int v;
+ v = (int)(long)(*val);
+ if (v < 0) {
+ if (sendipv4)
+ v = sock_get_ttl(sendipv4->socket);
+ }
+ if (v < 0) {
+ /* some error => use a reasonable default */
+ v = 63;
+ }
+ *val = (void*)(long)v;
+ return 0;
+}
+
+
+
cfg_def_t core_cfg_def[] = {
{"debug", CFG_VAR_INT|CFG_ATOMIC, 0, 0, 0, 0,
"debug level"},
@@ -264,6 +285,9 @@ cfg_def_t core_cfg_def[] = {
"set the MTU used when using raw sockets for udp sending."
" This value will be used when deciding whether or not to fragment"
" the packets."},
+ {"udp4_raw_ttl", CFG_VAR_INT | CFG_ATOMIC, -1, 255, udp4_raw_ttl_fixup, 0,
+ "set the IP TTL used when using raw sockets for udp sending."
+ " -1 will use the same value as for normal udp sockets."},
{"force_rport", CFG_VAR_INT, 0, 1, 0, fix_global_req_flags,
"force rport for all the received messages" },
{"memlog", CFG_VAR_INT|CFG_ATOMIC, 0, 0, 0, 0,
diff --git a/cfg_core.h b/cfg_core.h
index 1c4b3e7..df15c05 100644
--- a/cfg_core.h
+++ b/cfg_core.h
@@ -103,6 +103,7 @@ struct cfg_group_core {
int udp_mtu_try_proto; /*!< if packet> udp_mtu, try proto (e.g. TCP) */
int udp4_raw; /* use raw sockets for sending on udp ipv 4 */
int udp4_raw_mtu; /* mtu used when using udp raw socket */
+ int udp4_raw_ttl; /* ttl used when using udp raw sockets */
int force_rport; /*!< if set rport will always be forced*/
int memlog; /*!< log level for memory status/summary info */
int mem_summary; /*!< display memory status/summary info on exit */
diff --git a/main.c b/main.c
index a90e855..d157a6b 100644
--- a/main.c
+++ b/main.c
@@ -188,6 +188,7 @@
#include "basex.h" /* init */
#include "pvapi_init.h" /* init */
#include "pv_core.h" /* register core pvars */
+#include "sock_ut.h"
#ifdef DEBUG_DMALLOC
#include <dmalloc.h>
@@ -1266,6 +1267,13 @@ int main_loop()
default_core_cfg.udp4_raw = 1; /* enabled */
DBG("raw socket possible => turning it on\n");
}
+ if (default_core_cfg.udp4_raw_ttl < 0) {
+ /* auto-detect */
+ default_core_cfg.udp4_raw_ttl = sock_get_ttl(sendipv4->socket);
+ if (default_core_cfg.udp4_raw_ttl < 0)
+ /* error, use some default value */
+ default_core_cfg.udp4_raw_ttl = 63;
+ }
}
#else
default_core.cfg.udp4_raw = 0;
@@ -1417,6 +1425,14 @@ int main_loop()
default_core_cfg.udp4_raw = 1; /* enabled */
DBG("raw socket possible => turning it on\n");
}
+ if (default_core_cfg.udp4_raw_ttl < 0) {
+ /* auto-detect */
+ default_core_cfg.udp4_raw_ttl =
+ sock_get_ttl(sendipv4->socket);
+ if (default_core_cfg.udp4_raw_ttl < 0)
+ /* error, use some default value */
+ default_core_cfg.udp4_raw_ttl = 63;
+ }
}
}
#else
diff --git a/raw_sock.c b/raw_sock.c
index 37ac6e5..5c56e18 100644
--- a/raw_sock.c
+++ b/raw_sock.c
@@ -56,6 +56,8 @@
#include <netinet/udp.h>
#include "raw_sock.h"
+#include "cfg/cfg.h"
+#include "cfg_core.h"
/** create and return a raw socket.
@@ -79,11 +81,8 @@ int raw_socket(int proto, struct ip_addr* ip, str* iface, int iphdr_incl)
char* ifname;
sock = socket(PF_INET, SOCK_RAW, proto);
- if (sock==-1){
- ERR("raw_socket: socket() failed: %s [%d]\n",
- strerror(errno), errno);
+ if (sock==-1)
goto error;
- }
/* set socket options */
if (iphdr_incl) {
t=1;
@@ -426,7 +425,7 @@ inline static int mk_ip_hdr(struct ip* iph, struct in_addr* from,
iph->ip_len = htons(payload_len);
iph->ip_id = 0;
iph->ip_off = 0; /* frag.: first 3 bits=flags=0, last 13 bits=offset */
- iph->ip_ttl = 63; /* FIXME: use some configured value */
+ iph->ip_ttl = cfg_get(core, core_cfg, udp4_raw_ttl);
iph->ip_p = proto;
iph->ip_sum = 0;
iph->ip_src = *from;
diff --git a/sock_ut.c b/sock_ut.c
new file mode 100644
index 0000000..3aee2cd
--- /dev/null
+++ b/sock_ut.c
@@ -0,0 +1,71 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2010 iptelorg GmbH
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/** various socket related functions.
+ * @file sock_ut.c
+ * @ingroup: core
+ */
+/*
+ * History:
+ * --------
+ * 2010-08-09 initial version (andrei)
+*/
+
+#include "sock_ut.h"
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <errno.h>
+#include <arpa/inet.h>
+
+
+/** get the IP TTL.
+ * @return ttl on success, < 0 on error
+ */
+int sock_get_ttl(int sock)
+{
+ int ioptval;
+ unsigned int ioptvallen;
+
+ ioptvallen=sizeof(ioptval);
+ if (getsockopt( sock, IPPROTO_IP, IP_TTL, (void*) &ioptval,
+ &ioptvallen) == -1 )
+ {
+ return -1;
+ }
+ return ioptval;
+}
+
+
+
+/** set the IP TTL on a socket.
+ * @return ttl on success, < 0 on error
+ */
+int sock_set_ttl(int sock, int ttl)
+{
+ int ioptval;
+
+ if (setsockopt( sock, IPPROTO_IP, IP_TTL, (void*) &ioptval,
+ sizeof(ioptval)) == -1 )
+ return -1;
+ return ioptval;
+}
+
+/* vi: set ts=4 sw=4 tw=79:ai:cindent: */
diff --git a/sock_ut.h b/sock_ut.h
new file mode 100644
index 0000000..e9613d1
--- /dev/null
+++ b/sock_ut.h
@@ -0,0 +1,39 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2010 iptelorg GmbH
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/** various socket related functions.
+ * @file sock_ut.h
+ * @ingroup: core
+ */
+/*
+ * History:
+ * --------
+ * 2010-08-09 initial version (andrei)
+*/
+
+#ifndef __sock_ut_h
+#define __sock_ut_h
+
+
+
+int sock_get_ttl(int sock);
+int sock_set_ttl(int sock, int ttl);
+
+
+#endif /*__sock_ut_h*/
+
+/* vi: set ts=4 sw=4 tw=79:ai:cindent: */