Bugs item #2824350, was opened at 2009-07-20 17:49
Message generated for change (Tracker Item Submitted) made by axlh
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=743020&aid=2824350&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: modules
Group: ver 1.5.x
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Alex Hermann (axlh)
Assigned to: Nobody/Anonymous (nobody)
Summary: Presence DB support completely broken
Initial Comment:
As subject.
commit 5840 did the damage
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=743020&aid=2824350&group_…
Module: sip-router
Branch: master
Commit: d6f5b4b05166f3124379337ca3c0e28c54b7ab09
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d6f5b4b…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Mon Jul 20 17:21:25 2009 +0200
tm: rpc_uac* support
fifo/unixsock uac revived in rpc form and updated to the latest
tm:
- tm.t_uac_start - fifo_uac rpc equivalent with the following
differences:
* extra send_socket parameter for kamailio compatibility.
* empty parameters can be specified either by '.' (backwards
compatibility) or by "" (empty string).
* it doesn't wait for the final reply and it doesn't include
the sip reply in the rpc reply (it sends immediately an
empty reply indicating only success or failure)
- tm.t_uac_wait - like above, but it's supposed to wait and
return the final reply. However right now it will only return
an error (it's not yet fully implemented).
---
modules/tm/rpc_uac.c | 482 ++++++++++++++++++++++++++++++++++++++++++++++++++
modules/tm/rpc_uac.h | 40 ++++
modules/tm/tm.c | 3 +
3 files changed, 525 insertions(+), 0 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=d6f…
>> i'm basin my assumption about buggyness of dialog module just on the
>> large number bugs that has been reported and fixed during its lifetime.
>> according to some theory, the number of past bugs is an indication of
>> remaining ones.
>>
>> -- juha
>
> That seems believable, but I hope it is not true or I am really screwed!
The dialog message is also rather ambitious in its aims; it tackles some
rather complicated state-keeping tasks. Complex design, many possible
state permutations, and the need to carefully and precisely manage
numerous elements of data persistence in all scenarios in a deductively
rigourous way are attributes that result in more bugs as well.
Expecting dialog to be un-buggy is, in my opinion, sort of like expecting
TM to be less buggy than, say, alias_db.
--
Alex Balashov
Evariste Systems
Web : http://www.evaristesys.com/
Tel : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671
Mobile : (+1) (678) 237-1775
Module: sip-router
Branch: master
Commit: df088fb86adaf8f10bbdfebd5502ea9590341bc8
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=df088fb…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Mon Jul 20 13:00:37 2009 +0200
core: parse_phostport split for k compatibility
parse_phostport in sr and ser returned a list of pkg_malloc'ed
addresses belonging to the same multi-homed "group". For example
sctp:(1.2.3.4, 5.6.7.8):5080 is a valid address and it means
that this sctp listening socket must use multi-homing on the 2
IPs. However several kamailio modules use parse_phostport and
expect the old integer returning version. In this case it was
easier to split the function in the core into parse_phostport()
(old behaviour) and parse_phostport_mh() (returns list of MH
addresses) and make the core command line parser use the MH
supporting version.
---
main.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++-------
socket_info.h | 2 +-
2 files changed, 48 insertions(+), 8 deletions(-)
diff --git a/main.c b/main.c
index 8d7bc57..23455e7 100644
--- a/main.c
+++ b/main.c
@@ -963,7 +963,21 @@ error:
* returns fills proto, port, host and returns list of addresses on success
* (pkg malloc'ed) and 0 on failure
*/
-struct name_lst* parse_phostport(char* s, char** host, int* hlen,
+/** get protocol host and port from a string representation.
+ * parses [proto:]host[:port] or
+ * [proto:](host_1, host_2, ... host_n)[:port]
+ * where proto= udp|tcp|tls|sctp
+ * @param s - string (like above)
+ * @param host - will be filled with the host part
+ * Note: for multi-homing it wil contain all the addresses
+ * (e.g.: "sctp:(1.2.3.4, 5.6.7.8)" => host="(1.2.3.4, 5.6.7.8)")
+ * @param hlen - will be filled with the length of the host part.
+ * @param port - will be filled with the port if present or 0 if it's not.
+ * @param proto - will be filled with the protocol if present or PROTO_NONE
+ * if it's not.
+ * @return fills proto, port, host and returns 0 on success and -1 on failure.
+ */
+int parse_phostport(char* s, char** host, int* hlen,
int* port, int* proto)
{
char* first; /* first ':' occurrence */
@@ -997,7 +1011,7 @@ struct name_lst* parse_phostport(char* s, char** host, int* hlen,
break;
}
}
- if (p==s) return 0;
+ if (p==s) return -1;
if (*(p-1)==':') goto error_colons;
if (first==0){ /* no ':' => only host */
@@ -1030,22 +1044,48 @@ struct name_lst* parse_phostport(char* s, char** host, int* hlen,
*hlen=(int)(first-*host);
}
end:
- return parse_name_lst(*host, *hlen);
+ return 0;
error_brackets:
LOG(L_ERR, "ERROR: parse_phostport: too many brackets in %s\n", s);
- return 0;
+ return -1;
error_colons:
LOG(L_ERR, "ERROR: parse_phostport: too many colons in %s\n", s);
- return 0;
+ return -1;
error_proto:
LOG(L_ERR, "ERROR: parse_phostport: bad protocol in %s\n", s);
- return 0;
+ return -1;
error_port:
LOG(L_ERR, "ERROR: parse_phostport: bad port number in %s\n", s);
+ return -1;
+}
+
+
+
+/** get protocol host, port and MH addresses list from a string representation.
+ * parses [proto:]host[:port] or
+ * [proto:](host_1, host_2, ... host_n)[:port]
+ * where proto= udp|tcp|tls|sctp
+ * @param s - string (like above)
+ * @param host - will be filled with the host part
+ * Note: for multi-homing it wil contain all the addresses
+ * (e.g.: "sctp:(1.2.3.4, 5.6.7.8)" => host="(1.2.3.4, 5.6.7.8)")
+ * @param hlen - will be filled with the length of the host part.
+ * @param port - will be filled with the port if present or 0 if it's not.
+ * @param proto - will be filled with the protocol if present or PROTO_NONE
+ * if it's not.
+ * @return fills proto, port, host and returns list of addresses on success
+ * (pkg malloc'ed) and 0 on failure
+ */
+static struct name_lst* parse_phostport_mh(char* s, char** host, int* hlen,
+ int* port, int* proto)
+{
+ if (parse_phostport(s, host, hlen, port, proto)==0)
+ return parse_name_lst(*host, *hlen);
return 0;
}
+
/** Update \c cfg_file variable to contain full pathname. The function updates
* the value of \c cfg_file global variable to contain full absolute pathname
* to the main configuration file of SER. The function uses CFG_FILE macro to
@@ -1712,7 +1752,7 @@ try_again:
}
break;
case 'l':
- if ((n_lst=parse_phostport(optarg, &tmp, &tmp_len,
+ if ((n_lst=parse_phostport_mh(optarg, &tmp, &tmp_len,
&port, &proto))==0){
fprintf(stderr, "bad -l address specifier: %s\n",
optarg);
diff --git a/socket_info.h b/socket_info.h
index 4179869..6da9437 100644
--- a/socket_info.h
+++ b/socket_info.h
@@ -97,7 +97,7 @@ struct socket_info* find_si(struct ip_addr* ip, unsigned short port,
struct socket_info** get_sock_info_list(unsigned short proto);
-struct name_lst* parse_phostport(char* s, char** host, int* hlen,
+int parse_phostport(char* s, char** host, int* hlen,
int* port, int* proto);
/* helper function:
Module: sip-router
Branch: master
Commit: beb71da826ed6e8b533bb1c62b7e5ff179ed5e6f
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=beb71da…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Mon Jul 20 10:21:36 2009 +0200
tmx(k): missing type for mi_tm_uac_dlg callback
sr tm t_uac() does not automatically register any transaction
callback (unlike old ser or kamailio versions). If a callback is
desired, besides the callback pointer, the callback type mask must
also be specified (in this case TMCB_LOCAL_COMPLETED).
---
modules_k/tmx/t_mi.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/modules_k/tmx/t_mi.c b/modules_k/tmx/t_mi.c
index 4c73a54..e2fa5b4 100644
--- a/modules_k/tmx/t_mi.c
+++ b/modules_k/tmx/t_mi.c
@@ -623,6 +623,7 @@ struct mi_root* mi_tm_uac_dlg(struct mi_root* cmd_tree, void* param)
{
uac_r.cb = mi_uac_dlg_hdl;
uac_r.cbp = (void*)cmd_tree->async_hdl;
+ uac_r.cb_flags = TMCB_LOCAL_COMPLETED;
}
n = _tmx_tmb.t_uac(&uac_r);
Module: sip-router
Branch: master
Commit: f0ab0db3b66fcc7912065ee960aff71615e9ce3e
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f0ab0db…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Mon Jul 20 10:16:10 2009 +0200
tm: AS added needed membar
When compiled with -DWITH_AS_SUPPORT build_local_ack() needed
a membar_write_atomic_op() before setting the new local ack retr.
buf pointer (this will force the local_ack content to be fully
written before replacing the pointer and it's need on some non-x86
archs.).
---
modules/tm/t_reply.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c
index ba06cd1..ea5db73 100644
--- a/modules/tm/t_reply.c
+++ b/modules/tm/t_reply.c
@@ -414,6 +414,10 @@ static char *build_local_ack(struct sip_msg* rpl, struct cell *trans,
}
/* set the new buffer, but only if not already set (concurrent 2xx) */
+ /* a memory write barrier is needed to make sure the local_ack
+ content is fully written, before we try to add it to the transaction
+ -- andrei */
+ membar_write_atomic_op();
if ((old_lack = (struct retr_buf *)atomic_cmpxchg_long(
(void *)&trans->uac[0].local_ack, 0, (long)local_ack))) {
/* buffer already set: trash current and use the winning one */
i have never used k dialog module because it is by far the buggies
module that k has. now i ventured to try and, by no surprise, i crashed
sr before a single message went through. looks like it started to play
with db although i had not defined any.
-- juha
(gdb) where
#0 0x00000000 in ?? ()
#1 0xb728bba4 in dlg_connect_db (db_url=0xb72ab574) at dlg_db_handler.c:119
#2 0xb72885e8 in child_init (rank=2) at dialog.c:576
#3 0x080e0f1b in init_mod_child (m=0x8231b20, rank=2) at sr_module.c:808
#4 0x080e0e90 in init_mod_child (m=0x8231d10, rank=2) at sr_module.c:785
#5 0x080e0e90 in init_mod_child (m=0x8231e20, rank=2) at sr_module.c:785
#6 0x080e0e90 in init_mod_child (m=0x8231ef8, rank=2) at sr_module.c:785
#7 0x080e0e90 in init_mod_child (m=0x82320e8, rank=2) at sr_module.c:785
#8 0x080e0e90 in init_mod_child (m=0x8232248, rank=2) at sr_module.c:785
#9 0x080e0e90 in init_mod_child (m=0x8232450, rank=2) at sr_module.c:785
#10 0x080e0e90 in init_mod_child (m=0x8232a70, rank=2) at sr_module.c:785
#11 0x080e0e90 in init_mod_child (m=0x8232c18, rank=2) at sr_module.c:785
#12 0x080a0b75 in fork_process (child_id=2,
desc=0xbfd5db7c "udp receiver child=1 sock=192.98.101.10:5060",
make_sock=1) at pt.c:329
#13 0x08088119 in main_loop () at main.c:1307
#14 0x0808ae4f in main (argc=-2082109099, argv=0x7d8928ec) at main.c:2108