partysip-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Partysip-dev] loop detection


From: Fredrik Thulin
Subject: [Partysip-dev] loop detection
Date: Mon, 2 Sep 2002 16:38:11 +0200
User-agent: KMail/1.4.3

Hi

Last thursday I sent an e-mail to the libosip mailing list about some core 
dumps I was getting because I had the following config (this is from that 
said e-mail) :

>lab08.lab.it.su.se.     IN A         130.237.90.27
>sipserver.su.se.        IN CNAME     lab08.lab.it.su.se.
>_sip._udp.sip.su.se.    IN SRV       0 0 5060 sipserver.su.se.
>
>I entered the following in partysip.conf :
>
>serverip    = 130.237.90.27
>servername  = lab08.lab.it.su.se
>serverrealm = "sip.su.se"

and when I call address@hidden, the partysip server at lab08 fails to 
realize that it is to treat the request as local and forwards it - to itself. 
A loop is formed, more and more Via: headers are appended to the SIP message 
and eventually libosip dumps core.

According to Aymeric Moizard, someone has already written patches for libosip 
to fix this (again, I would be happy to help you test them if you want me to) 
but besides fixing the real problem (the buffer overrun in libosip) partysip 
should get some loop detection.

First of all, let me tell you all that I am yet very unfamiliar with SIP so if 
I have got something wrong then tell me and I'll learn from it and then try 
again ;)

It appears to me that loop detection for a SIP proxy server is very much like 
loop detection for a mail server (something I'm much more familiar with). 
First of all you want to make sure you are not going to send something to 
yourself, and secondly you want to make sure that noone has made up a new 
name for you that you are not aware of (so that noone can add a CNAME for 
'is.stupid.example.com' to sipserver.su.se and then call me at 
'address@hidden' instead of any of my real addresses). Third thing 
you want to do is check if there are too many Via: headers in there. I 
haven't read the SIP documentations yet (sorry for speaking up before doing 
my homework, I will as soon as I get the time) but there seems to be 
something called Max-Forwards which I suspect is designed to solve this 
problem.

So I started poking around the partysip code, but I couldn't really get it to 
work so I humbly ask for lights in the dark. It seemed like too much work has 
been done (resources allocated etc) to do the loop checking after the DNS 
resolving, so I tried to add DNS resolving in the 
psp_core_is_responsible_for_this_route() routine.
However, as DNS lookups seems to be done asynchronously by a thread or 
something this loop prevention usually fails the first time because there is 
nothing in the cache.
How can I make it wait until the answer is available, or do you think it is 
more suitable to do the loop checking later on when evaluating destinations? 
Maybe the latter is better after all...

Please give me some advise as to where this should go and also how to reject a 
destination.

Attached are three patches,

        * fredrik-partysip-debugging-patch1: more/improved debugging
        * fredrik-partysip-recvfrom-patch1: use recvfrom() instead of recv() to
          be able to show the source IP of received datagrams. Maybe there
          is some other better way to do it - if so, please show me ;)
        * fredrik-partysip-loop-detection-patch1: my work in progress

do with them as you please.

/Fredrik

Attachment: fredrik-partysip-debugging-patch1
Description: Text Data

Attachment: fredrik-partysip-recvfrom-patch1
Description: Text Data

Attachment: fredrik-partysip-loop-detection-patch1
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]