Module: sip-router
Branch: master
Commit: 8632598cac189adb557ad0c65f15744ef4256e45
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8632598…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Wed Jun 24 20:01:46 2009 +0200
tm: safety checks for possible escaped neg. ACKs
In normal operation looking up a transaction corresponding to an ACK to a
neg. reply or to a local transaction should end up in script
termination, so when t_relay_to() is called for a neg. ACK, the
transaction should not have been looked up previously. If this
assumption fails, the ACK will be processed normally (resulting at
worst in calling the TMCB_ACK_NEG_IN callback multiple times for
the same ACK) and a warning message will be logged.
---
modules/tm/t_funcs.c | 28 +++++++++++++++++++++++-----
1 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/modules/tm/t_funcs.c b/modules/tm/t_funcs.c
index d60c99e..aa7d1f4 100644
--- a/modules/tm/t_funcs.c
+++ b/modules/tm/t_funcs.c
@@ -271,11 +271,10 @@ int t_relay_to( struct sip_msg *p_msg , struct proxy_l *proxy, int proto,
/* parsing error, memory alloc, whatever ... if via is bad
and we are forced to reply there, return with 0 (->break),
pass error status otherwise
-
- MMA: return value E_SCRIPT means that transaction was already started from the script
- so continue with that transaction
+ MMA: return value E_SCRIPT means that transaction was already started
+ from the script so continue with that transaction
*/
- if (new_tran!=E_SCRIPT) {
+ if (likely(new_tran!=E_SCRIPT)) {
if (new_tran<0) {
ret = (ser_error==E_BAD_VIA && reply_to_via) ? 0 : new_tran;
goto done;
@@ -285,11 +284,30 @@ int t_relay_to( struct sip_msg *p_msg , struct proxy_l *proxy, int proto,
ret = 1;
goto done;
}
+ }else if (unlikely(p_msg->REQ_METHOD==METHOD_ACK)) {
+ /* transaction previously found (E_SCRIPT) and msg==ACK
+ => ack to neg. reply or ack to local trans.
+ => process it and exit */
+ /* FIXME: there's no way to distinguish here between acks to
+ local trans. and neg. acks */
+ /* in normal operation we should never reach this point, if we
+ do WARN(), it might hide some real bug (apart from possibly
+ hiding a bug the most harm done is calling the TMCB_ACK_NEG
+ callbacks twice) */
+ WARN("negative or local ACK caught, please report\n");
+ t=get_t();
+ if (unlikely(has_tran_tmcbs(t, TMCB_ACK_NEG_IN)))
+ run_trans_callbacks(TMCB_ACK_NEG_IN, t, p_msg, 0,
+ p_msg->REQ_METHOD);
+ t_release_transaction(t);
+ ret=1;
+ goto done;
}
/* new transaction */
- /* ACKs do not establish a transaction and are fwd-ed statelessly */
+ /* at this point if the msg is an ACK it is an e2e ACK and
+ e2e ACKs do not establish a transaction and are fwd-ed statelessly */
if ( p_msg->REQ_METHOD==METHOD_ACK) {
DBG( "SER: forwarding ACK statelessly \n");
if (proxy==0) {
If nobody disagrees, I'll change the version number to 2.99.0 in the
idea that both kamailio and ser first releases based on sip-router will
bear the 3.0.x number (3.0 is greater then both ser and k current
versions).
Andrei
Hi,
We have noticed that the server tries to connect to user's contact IP:port when there is no existing TCP connection with the client. This can happen when the client-server TLS connection brakes for some reason (for example flaky Internet). After that when consequent requests need to be proxied to that user (NOTIFYs, SUBSCRIBEs) we can see in the logs that the server tries to connect to the user's IP and port because there is not existing TCP (TLS) connection with it. In our setup though the cients are behind NAT and the serveer is in the public Internet.
In most such cases the server fails "normally" after 10 seconds and during that time if the same client tries to REGISTER, the REGISTER packets are processed on the server by the same process that has been blocked for 10 seconds, after the blocking 10 secs have elapsed. In effect this makes it harder for the clent to re-REGISTER when the connection has been broken.
There are cases though, when we can see in the server logs that there are no logs for more than 3 minutes and we can see that two server processes have been trying outgoing connection to the old client's IP:port for more than 3 minutes and we can see how both processes report unsuccessfull tcp blocking connect to the client after the logs resume after more than 3 minutes have elapsed. During such cases the server simply doesn't respond to client's attempts to REGISTER and is in effect blocked.
We have no clue as to why the server is blocked for more than 3 minutes since the tcp connect timeout seems to be just 10 seconds.
What we think is best is if we can configure the server to not try outgoing TCP connections to clients (when TCP conenction doesn't exist)? Is there a configration setting for that? If there is no configuration for that, what is the best place in code to make this change in the code? If this is not easy or not recommended, can we set the server's timeout for outgoing TCP connection to something smaller, for example 1-2 seconds, or even 0 seconds? We feel in our setup it will be better if the server does not try to connect at all, becasue anyway the connection attempt will fail.
Any information will be appreciated.
Thanks in advance,
Ivan
Module: sip-router
Branch: master
Commit: 30ea1726754fdc12646e35a6ec49a636a57ab7f0
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=30ea172…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Wed Jun 24 15:06:26 2009 +0200
tm: fix t_check messing up replies branch
- when t_check was called twice for a reply (e.g. t_check_trans() in
script in the main onreply_route and then internally in tm
reply_received), the second call did return an invalid branch.
Now the current branch is remembered along T so t_check will
always return a valid branch.
- added T_branch, a new global variable that holds the current
branch corresponding to T (is valid only if T is valid).
- set_t() takes now 2 parameters: a transaction and the current
branch for the transaction. If the current branch does not make
sense (e.g. for requests), T_BR_UNDEFINED must be used.
This change ensures that every time T is set or changed, the
current branch is also updated.
- more comments added
---
modules/tm/t_lookup.c | 138 ++++++++++++++++++++++++++++++++++++++-----------
modules/tm/t_lookup.h | 6 ++-
modules/tm/t_reply.c | 17 ++++--
3 files changed, 123 insertions(+), 38 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=30e…
Hello,
I finished my import of missing pieces from Kamailio SVN repository. The
commit message did not make it though to the list because it was too big. I
haven't commited my changes into the master branch yet, I uploaded them to the
branch janakj/missing_imports and I would appreciate if people (especially
K. developers) could review them, here is a link to the new branch:
http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-router;a=shortlog;h=refs…
And here is a short summary of the changes:
1) kamailio/etc was imported into sip-router/etc
In Kamailio trunk the etc directory contains a kamailio.cfg files,
a RADIUS dictionary and TLS certificates and related files.
2) kamailio/packaging was imported into sip-router/pkg/kamailio
I thought that it would be good to have both version of packaging
files under one directory in the shared repository. To avoid conflicts with
existing directories and files, I imported Kamailio stuff into
pkg/kamailio. We will need to go through these files and merge them at some
point (or alternatively keep one version and delete the other).
3) kamailio/scripts was imported into sip-router/tools
No coflics there, so I did not touch the files imported from Kamailio. I
would, however, suggest that as the next step we move kamctl and kamdbctl
into subdirectories. Booth tools consist of several files and would be,
IMHO, better to have them cleanly separated.
4) kamailio/utils/{db_berkeley,db_oracle,kamunix,profile} were imported into
sip-router/utils.
I omited kamailio/utils/fif_relay because the same tool is already present
in sip-router repository--and it is not needed anymore anyway.
What is missing:
I also found extra TLS documentation in kamailio/tls/doc. The documentation
was probably not yet imported into the sip-router repository so I will look
into that.
Please take a moment and review the layout, if people are happy with my
proposed layout and nobody speaks up then I will merge those changes into the
master branch on Wednesday.
Jan.
i just pushed a new version of lcr module, which resulted from
discussions on the mailing lists.
most important new feature is support for any number of independent lcr
instances, which improves virtualization of sr. for example, different
domains can now manage their own least cost routing to their own gws.
i also replaced aliveness check with new defunct_gw() function, which
script writer can use to defunct an unresponsive or busy gw for a
desired period of time.
in order to keep lcr module manageable, i removed gw group related
functions (which were not efficient anyway). if someone is using them, i
hope that they can be replaced by lcr instances.
-- juha